MCPcopy
hub / github.com/pingcap/tidb / EncodeHandleInUniqueIndexValue

Function EncodeHandleInUniqueIndexValue

pkg/tablecodec/tablecodec.go:1807–1818  ·  view source on GitHub ↗

EncodeHandleInUniqueIndexValue encodes handle in data.

(h kv.Handle, isUntouched bool)

Source from the content-addressed store, hash-verified

1805
1806// EncodeHandleInUniqueIndexValue encodes handle in data.
1807func EncodeHandleInUniqueIndexValue(h kv.Handle, isUntouched bool) []byte {
1808 if h.IsInt() {
1809 var data [8]byte
1810 binary.BigEndian.PutUint64(data[:], uint64(h.IntValue()))
1811 return data[:]
1812 }
1813 var untouchedFlag byte
1814 if isUntouched {
1815 untouchedFlag = 1
1816 }
1817 return encodeCommonHandle([]byte{untouchedFlag}, h)
1818}
1819
1820func encodeCommonHandle(idxVal []byte, h kv.Handle) []byte {
1821 idxVal = append(idxVal, CommonHandleFlag)

Callers 3

TestTempIndexValueCodecFunction · 0.85
genIndexValueVersion0Function · 0.85

Calls 3

encodeCommonHandleFunction · 0.85
IsIntMethod · 0.65
IntValueMethod · 0.65

Tested by 2

TestTempIndexValueCodecFunction · 0.68