MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / EncodeTSQuery

Function EncodeTSQuery

pkg/util/tsearch/encoding.go:169–181  ·  view source on GitHub ↗

EncodeTSQuery encodes a tsquery into a serialized representation for on-disk storage.

(appendTo []byte, query TSQuery)

Source from the content-addressed store, hash-verified

167// EncodeTSQuery encodes a tsquery into a serialized representation for on-disk
168// storage.
169func EncodeTSQuery(appendTo []byte, query TSQuery) ([]byte, error) {
170 // First, append a uint32 of the number of nodes in the query. We'll come
171 // back and fill this in later.
172 lengthIdx := len(appendTo)
173 appendTo = encoding.EncodeUint32Ascending(appendTo, 0)
174 var encoder tsNodeCodec
175 var err error
176 appendTo, err = encoder.encodeTSNode(query.root, appendTo)
177 if err != nil {
178 return nil, err
179 }
180 return encoding.PutUint32Ascending(appendTo, uint32(encoder.nTokens), lengthIdx), nil
181}
182
183// DecodeTSQuery deserializes a serialized TSQuery in on-disk format.
184func DecodeTSQuery(b []byte) (ret TSQuery, err error) {

Callers

nothing calls this directly

Calls 3

encodeTSNodeMethod · 0.95
EncodeUint32AscendingFunction · 0.92
PutUint32AscendingFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…