// EncodeRecordKey encodes the string value to a byte slice. func EncodeRecordKey(tablePrefix string, h int64, columnID int64) []byte { var ( buf []byte err error ) if columnID == 0 { // Ignore columnID. buf, err = kv.EncodeValue(tablePrefix, h) } else { buf, err = kv.EncodeValue(tablePrefix, h, columnID) } if err != nil { log.Fatal("should never happend") } return buf }
// EncodeValue implements table.Table EncodeValue interface. func (t *Table) EncodeValue(raw interface{}) ([]byte, error) { v, err := t.flatten(raw) if err != nil { return nil, err } return kv.EncodeValue(v) }
func isIndexValsEqual(vals1, vals2 []interface{}) bool { byteVals1, _ := kv.EncodeValue(vals1...) byteVals2, _ := kv.EncodeValue(vals2...) return bytes.Equal(byteVals1, byteVals2) }