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

Function PeekValueLength

pkg/util/encoding/encoding.go:3214–3226  ·  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

3212// The length returned is the full length of the encoded value, including the
3213// entire tag.
3214func PeekValueLength(b []byte) (typeOffset int, length int, err error) {
3215 if len(b) == 0 {
3216 return 0, 0, nil
3217 }
3218 var dataOffset int
3219 var typ Type
3220 typeOffset, dataOffset, _, typ, err = DecodeValueTag(b)
3221 if err != nil {
3222 return 0, 0, err
3223 }
3224 length, err = PeekValueLengthWithOffsetsAndType(b, dataOffset, typ)
3225 return typeOffset, length, err
3226}
3227
3228// PeekValueLengthWithOffsetsAndType is the same as PeekValueLength, except it
3229// 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…