DecodeIndexID decodes indexID from the key. this method simply extract index id part, and no other checking. Caller should make sure the key is an index key.
(key kv.Key)
| 296 | // this method simply extract index id part, and no other checking. |
| 297 | // Caller should make sure the key is an index key. |
| 298 | func DecodeIndexID(key kv.Key) (int64, error) { |
| 299 | key = key[len(tablePrefix)+8+len(indexPrefixSep):] |
| 300 | |
| 301 | _, indexID, err := codec.DecodeInt(key) |
| 302 | if err != nil { |
| 303 | return 0, errors.Trace(err) |
| 304 | } |
| 305 | return indexID, nil |
| 306 | } |
| 307 | |
| 308 | // DecodeTableID decodes the table ID of the key, if the key is not table key, returns 0. |
| 309 | func DecodeTableID(key kv.Key) int64 { |