EncodeJSONKeyStringAscending encodes the JSON key string value with a JSON specific escaped terminator. This allows us to encode keys in the same number of bytes as a string, while at the same time giving us a sentinel to identify JSON keys. The end parameter is used to determine if this is the last
(b []byte, s string, end bool)
| 712 | // while at the same time giving us a sentinel to identify JSON keys. The end parameter is used |
| 713 | // to determine if this is the last key in a a JSON path. If it is we don't add a separator after it. |
| 714 | func EncodeJSONKeyStringAscending(b []byte, s string, end bool) []byte { |
| 715 | str := UnsafeConvertStringToBytes(s) |
| 716 | |
| 717 | if end { |
| 718 | return encodeBytesAscendingWithoutTerminatorOrPrefix(b, str) |
| 719 | } |
| 720 | return encodeBytesAscendingWithTerminator(b, str, escapedJSONObjectKeyTerm) |
| 721 | } |
| 722 | |
| 723 | // EncodeJSONEmptyArray returns a byte array b with a byte to signify an empty JSON array. |
| 724 | func EncodeJSONEmptyArray(b []byte) []byte { |
no test coverage detected
searching dependent graphs…