Documentation ¶
Index ¶
- func AppendBackticks(dst, src by, ac AppendBytesClosure) by
- func AppendBinary(dst, src by) (b by)
- func AppendBinaryFromHex(dst, src by, unquote bo) (b by, err er)
- func AppendBrace(dst, src by, ac AppendBytesClosure) by
- func AppendBracket(dst, src by, ac AppendBytesClosure) by
- func AppendHexFromBinary(dst, src by, quote bo) (b by)
- func AppendList(dst by, src []by, separator byte, ac AppendBytesClosure) by
- func AppendParenthesis(dst, src by, ac AppendBytesClosure) by
- func AppendQuote(dst, src by, ac AppendBytesClosure) by
- func AppendSingleQuote(dst, src by, ac AppendBytesClosure) by
- func Comma(b by) (rem by, err er)
- func ExtractBinary(b by) (str, rem by, err er)
- func False() by
- func JSONKey(dst, k by) (b by)
- func MarshalBool(src by, truth bo) by
- func MarshalHexArray(dst by, ha []by) (b by)
- func MarshalKindsArray(dst by, ka *kinds.T) (b by)
- func Noop(dst, src by) by
- func NostrEscape(dst, src by) by
- func NostrUnescape(dst by) (b by)
- func Quote(dst, src by) by
- func True() by
- func UnmarshalBool(src by) (rem by, truth bo, err er)
- func UnmarshalHex(b by) (h by, rem by, err er)
- func UnmarshalHexArray(b by, size no) (t []by, rem by, err er)
- func UnmarshalKindsArray(b by) (k *kinds.T, rem by, err er)
- func UnmarshalQuoted(b by) (content, rem by, err er)
- func UnmarshalStringArray(b by) (t []by, rem by, err er)
- func Unquote(b by) by
- type AppendBytesClosure
- type AppendClosure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBackticks ¶
func AppendBackticks(dst, src by, ac AppendBytesClosure) by
func AppendBinary ¶
func AppendBinary(dst, src by) (b by)
AppendBinary is a straight append with length prefix.
func AppendBinaryFromHex ¶
func AppendBinaryFromHex(dst, src by, unquote bo) (b by, err er)
func AppendBrace ¶
func AppendBrace(dst, src by, ac AppendBytesClosure) by
func AppendBracket ¶
func AppendBracket(dst, src by, ac AppendBytesClosure) by
func AppendHexFromBinary ¶
func AppendHexFromBinary(dst, src by, quote bo) (b by)
func AppendList ¶
func AppendList(dst by, src []by, separator byte, ac AppendBytesClosure) by
func AppendParenthesis ¶
func AppendParenthesis(dst, src by, ac AppendBytesClosure) by
func AppendQuote ¶
func AppendQuote(dst, src by, ac AppendBytesClosure) by
func AppendSingleQuote ¶
func AppendSingleQuote(dst, src by, ac AppendBytesClosure) by
func ExtractBinary ¶
func ExtractBinary(b by) (str, rem by, err er)
ExtractBinary decodes the data based on the length prefix and returns a the the remaining data from the provided slice.
func JSONKey ¶
func JSONKey(dst, k by) (b by)
JSONKey generates the JSON format for an object key and terminates with the semicolon.
func MarshalBool ¶
func MarshalBool(src by, truth bo) by
func MarshalHexArray ¶
func MarshalHexArray(dst by, ha []by) (b by)
func MarshalKindsArray ¶
func NostrEscape ¶
func NostrEscape(dst, src by) by
NostrEscape for JSON encoding according to RFC8259.
This is the efficient implementation based on the NIP-01 specification:
To prevent implementation differences from creating a different event ID for the same event, the following rules MUST be followed while serializing:
No whitespace, line breaks or other unnecessary formatting should be included in the output JSON. No characters except the following should be escaped, and instead should be included verbatim: - A line break, 0x0A, as \n - A double quote, 0x22, as \" - A backslash, 0x5C, as \\ - A carriage return, 0x0D, as \r - A tab character, 0x09, as \t - A backspace, 0x08, as \b - A form feed, 0x0C, as \f UTF-8 should be used for encoding.
func NostrUnescape ¶
func NostrUnescape(dst by) (b by)
NostrUnescape reverses the operation of NostrEscape except instead of appending it to the provided slice, it rewrites it, eliminating a memory copy. Keep in mind that the original JSON will be mangled by this operation, but the resultant slices will cost zero allocations.
func UnmarshalBool ¶
func UnmarshalBool(src by) (rem by, truth bo, err er)
func UnmarshalHex ¶
func UnmarshalHex(b by) (h by, rem by, err er)
UnmarshalHex takes a byte string that should contain a quoted hexadecimal encoded value, decodes it in-place using a SIMD hex codec and returns the decoded truncated bytes (the other half will be as it was but no allocation is required).
func UnmarshalHexArray ¶
func UnmarshalHexArray(b by, size no) (t []by, rem by, err er)
UnmarshalHexArray unpacks a JSON array containing strings with hexadecimal, and checks all values have the specified byte size..
func UnmarshalKindsArray ¶
func UnmarshalQuoted ¶
func UnmarshalQuoted(b by) (content, rem by, err er)
UnmarshalQuoted performs an in-place unquoting of NIP-01 quoted byte string.
func UnmarshalStringArray ¶
func UnmarshalStringArray(b by) (t []by, rem by, err er)
UnmarshalStringArray unpacks a JSON array containing strings.
Types ¶
type AppendBytesClosure ¶
type AppendBytesClosure func(dst, src by) by
type AppendClosure ¶
type AppendClosure func(dst by) by