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

Function getBytesLength

pkg/util/encoding/encoding.go:615–631  ·  view source on GitHub ↗

getBytesLength finds the length of a bytes encoding.

(b []byte, e escapes)

Source from the content-addressed store, hash-verified

613
614// getBytesLength finds the length of a bytes encoding.
615func getBytesLength(b []byte, e escapes) (int, error) {
616 // Skip the tag.
617 skipped := 1
618 for {
619 i := bytes.IndexByte(b[skipped:], e.escape)
620 if i == -1 {
621 return 0, errors.Errorf("did not find terminator %#x in buffer %#x", e.escape, b)
622 }
623 if i+1 >= len(b) {
624 return 0, errors.Errorf("malformed escape in buffer %#x", b)
625 }
626 skipped += i + escapeLength
627 if b[skipped-1] == e.escapedTerm {
628 return skipped, nil
629 }
630 }
631}
632
633// prettyPrintInvertedIndexKey returns a string representation of the path part of a JSON inverted
634// index.

Callers 1

PeekLengthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…