aboutsummaryrefslogtreecommitdiff
path: root/weed/query/json/seralize.go
blob: 9bbddc2fff21531a7ad9181206228cc105fe54d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
}