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)
| 3212 | // The length returned is the full length of the encoded value, including the |
| 3213 | // entire tag. |
| 3214 | func 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 |
no test coverage detected
searching dependent graphs…