(tp byte, val []byte)
| 489 | } |
| 490 | |
| 491 | func (*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. |
| 511 | func fieldType2Flag(tp byte, signed bool) (flag byte) { |
no test coverage detected