Help us shape the future of Go! Take the 2026 Go Developer Survey

tdtpjson

package
v1.26.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package tdtpjson converts TDTP packets to JSON arrays of objects.

One object per row, keys from the Schema field names (not positional pipe strings) — the consumer addresses columns by name, like an API. Values are honestly typed via schema.Converter: integers and floats as JSON numbers, booleans as bools, NULLs as null, dates as ISO strings, everything else as strings. Integers past the JS safe range (2^53-1) go out as strings so downstream jq/node does not silently round them; NaN/±Inf (no JSON representation) become null.

Rows stream through a single pass — no giant slice is ever built — so 100 MB pages convert in constant memory. Column order follows the schema (or --fields order); key order in JSON is therefore stable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(ctx context.Context, w io.Writer, pkt *packet.DataPacket, query *packet.Query, pretty bool) (int, error)

Write converts pkt to a JSON array on w, applying query (WHERE, ORDER BY, LIMIT, OFFSET, fields projection) exactly like the CSV converter does. It returns the number of data objects written. pretty indents one object per line for humans; compact is the default for pipelines.

The packet must hold plain row-major rows: callers decompress and expand compact/columnar layouts first (see WritePacket), or pass an already-plain packet. Encrypted content is refused.

func WritePacket

func WritePacket(ctx context.Context, w io.Writer, pkt *packet.DataPacket, query *packet.Query, pretty bool) (int, error)

WritePacket is Write for a stored packet: decompresses, verifies local xxh3 integrity when stamped, and expands compact/columnar layouts first. Encrypted packets are refused (hashes would cover ciphertext).

Types

This section is empty.

Jump to

Keyboard shortcuts

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