MCPcopy Create free account
hub / github.com/pingcap/tidb / encodeOldDatum

Method encodeOldDatum

pkg/util/rowcodec/decoder.go:491–508  ·  view source on GitHub ↗
(tp byte, val []byte)

Source from the content-addressed store, hash-verified

489}
490
491func (*BytesDecoder) encodeOldDatum(tp byte, val []byte) []byte {
492 buf := make([]byte, 0, 1+binary.MaxVarintLen64+len(val))
493 switch tp {
494 case BytesFlag:
495 buf = append(buf, CompactBytesFlag)
496 buf = codec.EncodeCompactBytes(buf, val)
497 case IntFlag:
498 buf = append(buf, VarintFlag)
499 buf = codec.EncodeVarint(buf, decodeInt(val))
500 case UintFlag:
501 buf = append(buf, VaruintFlag)
502 buf = codec.EncodeUvarint(buf, decodeUint(val))
503 default:
504 buf = append(buf, tp)
505 buf = append(buf, val...)
506 }
507 return buf
508}
509
510// fieldType2Flag transforms field type into kv type flag.
511func fieldType2Flag(tp byte, signed bool) (flag byte) {

Callers 1

decodeToBytesInternalMethod · 0.95

Calls 5

EncodeCompactBytesFunction · 0.92
EncodeVarintFunction · 0.92
EncodeUvarintFunction · 0.92
decodeUintFunction · 0.85
decodeIntFunction · 0.70

Tested by

no test coverage detected