(b []byte)
| 811 | } |
| 812 | |
| 813 | func (j jsonObject) encodeInvertedIndexKeys(b []byte) ([][]byte, error) { |
| 814 | // Checking for an empty object. |
| 815 | if len(j) == 0 { |
| 816 | return [][]byte{encoding.EncodeJSONEmptyObject(b)}, nil |
| 817 | } |
| 818 | |
| 819 | var outKeys [][]byte |
| 820 | for i := range j { |
| 821 | children, err := j[i].v.encodeInvertedIndexKeys(nil) |
| 822 | if err != nil { |
| 823 | return nil, err |
| 824 | } |
| 825 | |
| 826 | // We're trying to see if this is the end of the JSON path. If it is, then we don't want to |
| 827 | // add an extra separator. |
| 828 | end := true |
| 829 | switch j[i].v.(type) { |
| 830 | case jsonArray, jsonObject: |
| 831 | if j[i].v.Len() != 0 { |
| 832 | end = false |
| 833 | } |
| 834 | } |
| 835 | |
| 836 | for _, childBytes := range children { |
| 837 | encodedKey := bytes.Join([][]byte{b, |
| 838 | encoding.EncodeJSONKeyStringAscending(nil, string(j[i].k), end), |
| 839 | childBytes}, nil) |
| 840 | |
| 841 | outKeys = append(outKeys, encodedKey) |
| 842 | } |
| 843 | } |
| 844 | return outKeys, nil |
| 845 | } |
| 846 | |
| 847 | // NumInvertedIndexEntries returns the number of inverted index entries that |
| 848 | // would be created for the given JSON value. Since identical elements of an |
nothing calls this directly
no test coverage detected