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

Function EncodeValueTag

pkg/util/encoding/encoding.go:1812–1824  ·  view source on GitHub ↗

EncodeValueTag encodes the prefix that is used by each of the EncodeFooValue methods. The prefix uses varints to encode a column id and type, packing them into a single byte when they're small (colID < 8 and typ < 15). This works by shifting the colID "left" by 4 and putting any type less than 15 i

(appendTo []byte, colID uint32, typ Type)

Source from the content-addressed store, hash-verified

1810// Together, this means the everything but the last byte of the first uvarint
1811// can be dropped if the column id isn't needed.
1812func EncodeValueTag(appendTo []byte, colID uint32, typ Type) []byte {
1813 if typ >= SentinelType {
1814 appendTo = EncodeNonsortingUvarint(appendTo, uint64(colID)<<4|uint64(SentinelType))
1815 return EncodeNonsortingUvarint(appendTo, uint64(typ))
1816 }
1817 if colID == NoColumnID {
1818 // TODO(dan): EncodeValueTag is not inlined by the compiler. Copying this
1819 // special case into one of the EncodeFooValue functions speeds it up by
1820 // ~4ns.
1821 return append(appendTo, byte(typ))
1822 }
1823 return EncodeNonsortingUvarint(appendTo, uint64(colID)<<4|uint64(typ))
1824}
1825
1826// EncodeNullValue encodes a null value, appends it to the supplied buffer, and
1827// returns the final buffer.

Callers 15

EncodeNullValueFunction · 0.85
EncodeNotNullValueFunction · 0.85
EncodeBoolValueFunction · 0.85
EncodeIntValueFunction · 0.85
EncodeFloatValueFunction · 0.85
EncodeBytesValueFunction · 0.85
EncodeArrayValueFunction · 0.85
EncodeTimeValueFunction · 0.85
EncodeTimeTZValueFunction · 0.85
EncodeDecimalValueFunction · 0.85
EncodeDurationValueFunction · 0.85
EncodeBitArrayValueFunction · 0.85

Calls 1

EncodeNonsortingUvarintFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…