Encode encodes the vector as a byte array suitable for storing in KV.
(appendTo []byte, t T)
| 115 | |
| 116 | // Encode encodes the vector as a byte array suitable for storing in KV. |
| 117 | func 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. |
| 126 | func Decode(b []byte) (remaining []byte, ret T, err error) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…