DecomposeKeyTokens breaks apart a key into its individual key-encoded values and returns a slice of byte slices, one for each key-encoded value. It also returns whether the key contains a NULL value.
(b []byte)
| 2519 | // and returns a slice of byte slices, one for each key-encoded value. |
| 2520 | // It also returns whether the key contains a NULL value. |
| 2521 | func DecomposeKeyTokens(b []byte) (tokens [][]byte, containsNull bool, err error) { |
| 2522 | var out [][]byte |
| 2523 | |
| 2524 | for len(b) > 0 { |
| 2525 | tokenLen, err := PeekLength(b) |
| 2526 | if err != nil { |
| 2527 | return nil, false, err |
| 2528 | } |
| 2529 | |
| 2530 | if PeekType(b) == Null { |
| 2531 | containsNull = true |
| 2532 | } |
| 2533 | |
| 2534 | out = append(out, b[:tokenLen]) |
| 2535 | b = b[tokenLen:] |
| 2536 | } |
| 2537 | |
| 2538 | return out, containsNull, nil |
| 2539 | } |
| 2540 | |
| 2541 | // getInvertedIndexKeyLength finds the length of an inverted index key |
| 2542 | // encoded as a byte array. |
nothing calls this directly
no test coverage detected
searching dependent graphs…