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

Function Encode

pkg/util/vector/vector.go:117–123  ·  view source on GitHub ↗

Encode encodes the vector as a byte array suitable for storing in KV.

(appendTo []byte, t T)

Source from the content-addressed store, hash-verified

115
116// Encode encodes the vector as a byte array suitable for storing in KV.
117func Encode(appendTo []byte, t T) ([]byte, error) {
118 appendTo = encoding.EncodeUint32Ascending(appendTo, uint32(len(t)))
119 for i := range t {
120 appendTo = encoding.EncodeUntaggedFloat32Value(appendTo, t[i])
121 }
122 return appendTo, nil
123}
124
125// Decode decodes the byte array into a vector and returns any remaining bytes.
126func Decode(b []byte) (remaining []byte, ret T, err error) {

Callers

nothing calls this directly

Calls 2

EncodeUint32AscendingFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…