Documentation
¶
Overview ¶
Package parser contains the internal PostgreSQL parsing boundary.
Index ¶
- type Error
- type FailureCategory
- type Field
- type Kind
- type Node
- type Result
- type Value
- func (v Value) Bool() (bool, bool)
- func (v Value) Bytes() ([]byte, bool)
- func (v Value) Enum() (string, bool)
- func (v Value) Float() (float64, bool)
- func (v Value) Int() (int64, bool)
- func (v Value) Kind() ValueKind
- func (v Value) List() ([]Value, bool)
- func (v Value) Node() (*Node, bool)
- func (v Value) String() (string, bool)
- func (v Value) Uint() (uint64, bool)
- type ValueKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a privacy-safe failure from the internal parser boundary. It never stores or unwraps the backend error because that diagnostic can quote SQL.
func (*Error) Category ¶
func (e *Error) Category() FailureCategory
Category returns the bounded parser failure category.
type FailureCategory ¶
type FailureCategory string
FailureCategory identifies a bounded parser failure class.
const FailureSyntax FailureCategory = "syntax"
FailureSyntax indicates that PostgreSQL rejected the input syntax.
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field is an immutable named value on a Node. Its state stays private so a parsed tree cannot be changed through values returned to another package.
type Kind ¶
type Kind string
Kind identifies a parser-neutral PostgreSQL AST node type. It deliberately avoids backend-generated enums so callers do not depend on pg_query types.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is an immutable parser-neutral PostgreSQL AST node. Accessors return snapshots for slice-backed data; child nodes are safe to share because all their state is private and has no mutating API.
func StatementSequence ¶
StatementSequence returns top-level statements and their statement-bearing CTEs in deterministic root-first, depth-first declaration order. A new slice is built for every call, so consumers cannot mutate Result state.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is an immutable parser-neutral PostgreSQL parse result. It owns the top-level statement order produced by PostgreSQL.
func Parse ¶
Parse parses complete SQL input with the PostgreSQL grammar and immediately converts the backend tree into package-owned immutable values. Raw backend errors are reduced to a bounded, privacy-safe category before returning.
func (*Result) Statements ¶
Statements returns a snapshot of the top-level statements in input order.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an immutable parser-neutral scalar, node, or list. The tagged union keeps protobuf reflection values from crossing the parser boundary.
func (Value) Bytes ¶
Bytes returns a snapshot of the stored bytes so callers cannot mutate the parsed tree through a shared backing array.