Documentation
¶
Overview ¶
Package jsonwriter provides Append* helpers that write JSON directly into a caller-supplied []byte. There is no writer struct on purpose: passing the buffer back and forth as a []byte keeps the slice header in registers and matches strconv.Append* idioms.
Index ¶
- func AppendBool(dst []byte, v bool) []byte
- func AppendKey(dst []byte, k string) []byte
- func AppendNull(dst []byte) []byte
- func AppendString(dst []byte, s string) []byte
- func AppendStringBody(dst []byte, s string) []byte
- func AppendStringBodyBytes(dst, s []byte) []byte
- func AppendStringBytes(dst, s []byte) []byte
- func ValidUTF8(p []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendKey ¶
AppendKey writes a quoted JSON key followed by a colon. Used for pre-building per-column key prefixes during plan compilation.
func AppendString ¶
AppendString writes a JSON string. Quotes are added.
func AppendStringBody ¶
AppendStringBody escapes s and appends it without surrounding quotes. This is the default scalar implementation. An alternative SWAR-based implementation is available under the pgz_simd build tag (experimental; see escape_swar.go).
func AppendStringBodyBytes ¶
AppendStringBodyBytes is the []byte twin of AppendStringBody.
func AppendStringBytes ¶
AppendStringBytes is the []byte twin of AppendString. Avoids the string header allocation when the source is already a byte slice (e.g. straight from the wire).
Types ¶
This section is empty.