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

Function DecodeIndexID

pkg/tablecodec/tablecodec.go:298–306  ·  view source on GitHub ↗

DecodeIndexID decodes indexID from the key. this method simply extract index id part, and no other checking. Caller should make sure the key is an index key.

(key kv.Key)

Source from the content-addressed store, hash-verified

296// this method simply extract index id part, and no other checking.
297// Caller should make sure the key is an index key.
298func DecodeIndexID(key kv.Key) (int64, error) {
299 key = key[len(tablePrefix)+8+len(indexPrefixSep):]
300
301 _, indexID, err := codec.DecodeInt(key)
302 if err != nil {
303 return 0, errors.Trace(err)
304 }
305 return indexID, nil
306}
307
308// DecodeTableID decodes the table ID of the key, if the key is not table key, returns 0.
309func DecodeTableID(key kv.Key) int64 {

Callers 3

addMethod · 0.92
TestTempIndexKeyFunction · 0.85

Calls 1

DecodeIntFunction · 0.92

Tested by 1

TestTempIndexKeyFunction · 0.68