MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / DecodeBitArrayDescending

Function DecodeBitArrayDescending

pkg/util/encoding/encoding.go:1212–1242  ·  view source on GitHub ↗

DecodeBitArrayDescending is the descending version of DecodeBitArrayAscending.

(b []byte)

Source from the content-addressed store, hash-verified

1210
1211// DecodeBitArrayDescending is the descending version of DecodeBitArrayAscending.
1212func DecodeBitArrayDescending(b []byte) ([]byte, bitarray.BitArray, error) {
1213 if PeekType(b) != BitArrayDesc {
1214 return nil, bitarray.BitArray{}, errors.Errorf("did not find marker %x", b)
1215 }
1216 b = b[1:]
1217
1218 // First compute the length.
1219 numWords, _, err := getBitArrayWordsLen(b, bitArrayDataDescTerminator)
1220 if err != nil {
1221 return b, bitarray.BitArray{}, err
1222 }
1223 // Decode the words.
1224 words := make([]uint64, numWords)
1225 for i := range words {
1226 b, words[i], err = DecodeUvarintDescending(b)
1227 if err != nil {
1228 return b, bitarray.BitArray{}, err
1229 }
1230 }
1231 // Decode the final part.
1232 if len(b) == 0 || b[0] != bitArrayDataDescTerminator {
1233 return b, bitarray.BitArray{}, errBitArrayTerminatorMissing
1234 }
1235 b = b[1:]
1236 b, lastVal, err := DecodeUvarintDescending(b)
1237 if err != nil {
1238 return b, bitarray.BitArray{}, err
1239 }
1240 ba, err := bitarray.FromEncodingParts(words, lastVal)
1241 return b, ba, err
1242}
1243
1244// Type represents the type of a value encoded by
1245// Encode{Null,NotNull,Varint,Uvarint,Float,Bytes}.

Callers 1

prettyPrintFirstValueFunction · 0.85

Calls 4

FromEncodingPartsFunction · 0.92
PeekTypeFunction · 0.85
getBitArrayWordsLenFunction · 0.85
DecodeUvarintDescendingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…