// DecodeKeyValue decodes the key and value from bytes. func DecodeKeyValue(fields []string, dec *tsdb.FieldCodec, k, v []byte) (key int64, value interface{}) { // Convert key to a timestamp. key = int64(btou64(k[0:8])) // Decode values. Optimize for single field. switch len(fields) { case 0: return case 1: decValue, err := dec.DecodeByName(fields[0], v) if err != nil { return } return key, decValue default: m, err := dec.DecodeFieldsWithNames(v) if err != nil { return } return key, m } }