getInvertedIndexKeyLength finds the length of an inverted index key encoded as a byte array.
(b []byte)
| 2541 | // getInvertedIndexKeyLength finds the length of an inverted index key |
| 2542 | // encoded as a byte array. |
| 2543 | func getInvertedIndexKeyLength(b []byte) (int, error) { |
| 2544 | skipped := 0 |
| 2545 | for { |
| 2546 | i := bytes.IndexByte(b[skipped:], escape) |
| 2547 | if i == -1 { |
| 2548 | return 0, errors.Errorf("malformed inverted index key in buffer %#x", b) |
| 2549 | } |
| 2550 | skipped += i + escapeLength |
| 2551 | switch b[skipped-1] { |
| 2552 | case escapedTerm, jsonEmptyObject, jsonEmptyArray: |
| 2553 | return skipped, nil |
| 2554 | } |
| 2555 | } |
| 2556 | } |
| 2557 | |
| 2558 | // getJSONInvertedIndexKeyLength returns the length of encoded JSON inverted index |
| 2559 | // key at the start of b. |
no outgoing calls
no test coverage detected
searching dependent graphs…