emit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package emit renders parse trees as JSON with byte-parity to libpg_query's hand-rolled C emitter (pg_query_outfuncs_json.c + pg_query_json_helper.c at the pinned 18.0.0).

The C emitter is generated from the same struct metadata the pinned pg_query.proto was generated from, so the proto descriptor carries everything the output format needs: message fields are declared in C struct order, each field's json_name is the C field name, and the field type selects the WRITE_*_FIELD macro. The walker below is therefore driven by protobuf reflection rather than by generated per-node code; byte-parity is enforced corpus-wide by the golden round-trip test in this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Node

func Node(msg proto.Message) string

Node renders one node with its type wrapper: _outNode.

func ParseResult

func ParseResult(tree *ast.ParseResult) string

ParseResult renders the full document: pg_query_nodes_to_json.

func Token

func Token(b *strings.Builder, s string)

Token exposes emitToken to the other internal packages that emit the same JSON string encoding (the PL/pgSQL dump shares _outToken with this emitter via pg_query_json_helper.c).

Types

This section is empty.

Jump to

Keyboard shortcuts

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