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

Function getInvertedIndexKeyLength

pkg/util/encoding/encoding.go:2543–2556  ·  view source on GitHub ↗

getInvertedIndexKeyLength finds the length of an inverted index key encoded as a byte array.

(b []byte)

Source from the content-addressed store, hash-verified

2541// getInvertedIndexKeyLength finds the length of an inverted index key
2542// encoded as a byte array.
2543func getInvertedIndexKeyLength(b []byte) (int, error) {
2544 skipped := 0
2545 for {
2546 i := bytes.IndexByte(b[skipped:], escape)
2547 if i == -1 {
2548 return 0, errors.Errorf("malformed inverted index key in buffer %#x", b)
2549 }
2550 skipped += i + escapeLength
2551 switch b[skipped-1] {
2552 case escapedTerm, jsonEmptyObject, jsonEmptyArray:
2553 return skipped, nil
2554 }
2555 }
2556}
2557
2558// getJSONInvertedIndexKeyLength returns the length of encoded JSON inverted index
2559// key at the start of b.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…