seralize.go 393 B

1234567891011121314151617
  1. package json
  2. import "github.com/chrislusf/seaweedfs/weed/query/sqltypes"
  3. func ToJson(buf []byte, selections []string, values []sqltypes.Value) []byte {
  4. buf = append(buf, '{')
  5. for i, value := range values {
  6. if i > 0 {
  7. buf = append(buf, ',')
  8. }
  9. buf = append(buf, selections[i]...)
  10. buf = append(buf, ':')
  11. buf = append(buf, value.Raw()...)
  12. }
  13. buf = append(buf, '}')
  14. return buf
  15. }