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

Function PeekValueLength

pkg/util/encoding/encoding.go:2330–2342  ·  view source on GitHub ↗

PeekValueLength returns the length of the encoded value at the start of b. Note: If this function succeeds, it's not a guarantee that decoding the value will succeed. `b` can point either at beginning of the "full tag" with the column id, or it can point to the beginning of the type part of the tag

(b []byte)

Source from the content-addressed store, hash-verified

2328// The length returned is the full length of the encoded value, including the
2329// entire tag.
2330func PeekValueLength(b []byte) (typeOffset int, length int, err error) {
2331 if len(b) == 0 {
2332 return 0, 0, nil
2333 }
2334 var dataOffset int
2335 var typ Type
2336 typeOffset, dataOffset, _, typ, err = DecodeValueTag(b)
2337 if err != nil {
2338 return 0, 0, err
2339 }
2340 length, err = PeekValueLengthWithOffsetsAndType(b, dataOffset, typ)
2341 return typeOffset, length, err
2342}
2343
2344// PeekValueLengthWithOffsetsAndType is the same as PeekValueLength, except it
2345// expects a dataOffset and typ value from a previous call to DecodeValueTag

Callers 1

Calls 2

DecodeValueTagFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…