DecodeIndexKey decodes the key and gets the tableID, indexID, indexValues.
(key kv.Key)
| 178 | |
| 179 | // DecodeIndexKey decodes the key and gets the tableID, indexID, indexValues. |
| 180 | func DecodeIndexKey(key kv.Key) (tableID int64, indexID int64, indexValues []string, err error) { |
| 181 | k := key |
| 182 | |
| 183 | tableID, indexID, isRecord, err := DecodeKeyHead(key) |
| 184 | if err != nil { |
| 185 | return 0, 0, nil, errors.Trace(err) |
| 186 | } |
| 187 | if isRecord { |
| 188 | err = errInvalidIndexKey.GenWithStack("invalid index key - %q", k) |
| 189 | return 0, 0, nil, err |
| 190 | } |
| 191 | indexKey := key[prefixLen+idLen:] |
| 192 | indexValues, err = DecodeValuesBytesToStrings(indexKey) |
| 193 | if err != nil { |
| 194 | err = errInvalidIndexKey.GenWithStack("invalid index key - %q %v", k, err) |
| 195 | return 0, 0, nil, err |
| 196 | } |
| 197 | return tableID, indexID, indexValues, nil |
| 198 | } |
| 199 | |
| 200 | // DecodeValuesBytesToStrings decode the raw bytes to strings for each columns. |
| 201 | // FIXME: Without the schema information, we can only decode the raw kind of |