support basic json filtering and selection

This commit is contained in:
Chris Lu
2019-10-06 22:35:05 -07:00
parent e26670c67a
commit f8d4b7d1c0
7 changed files with 418 additions and 186 deletions

View File

@@ -0,0 +1,17 @@
package json
import "github.com/chrislusf/seaweedfs/weed/query/sqltypes"
func ToJson(buf []byte, selections []string, values []sqltypes.Value) []byte {
buf = append(buf, '{')
for i, value := range values {
if i > 0 {
buf = append(buf, ',')
}
buf = append(buf, selections[i]...)
buf = append(buf, ':')
buf = append(buf, value.Raw()...)
}
buf = append(buf, '}')
return buf
}