jsonwriter

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 1 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBool

func AppendBool(dst []byte, v bool) []byte

AppendBool writes true or false.

func AppendKey

func AppendKey(dst []byte, k string) []byte

AppendKey writes a quoted JSON key followed by a colon. Used for pre-building per-column key prefixes during plan compilation.

func AppendNull

func AppendNull(dst []byte) []byte

AppendNull writes the JSON literal null.

func AppendString

func AppendString(dst []byte, s string) []byte

AppendString writes a JSON string. Quotes are added.

func AppendStringBody

func AppendStringBody(dst []byte, s string) []byte

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

func AppendStringBodyBytes(dst, s []byte) []byte

AppendStringBodyBytes is the []byte twin of AppendStringBody.

func AppendStringBytes

func AppendStringBytes(dst, s []byte) []byte

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).

func ValidUTF8

func ValidUTF8(p []byte) bool

ValidUTF8 reports whether p is valid UTF-8. We only call this in defensive paths; the hot loop trusts the server's encoding (typically UTF-8 since almost every Postgres database is initdb'd with UTF8).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL