Skip to main content

Module ast

Module ast 

Source
Expand description

The ZQL abstract syntax tree (packages/zero-protocol/src/ast.ts).

Modules§

strict
strictASTSchema (packages/zero-protocol/src/ast.ts), for ASTs a client sends: nested at most MAX_DEPTH deep, and parsed in valita’s strict mode even inside a lenient parse, so an AST with a key zero doesn’t know is rejected rather than run as a different query.

Structs§

Aggregate
An aggregate of a query or a relationship (Aggregate).
Ast
A query: a table, its filters, relationships, order, and bounds.
Bound
CorrelatedSubquery
Correlation
OrderPart

Enums§

AggregateFunction
An aggregate function (AggregateFunction).
Anchor
Condition
CorrelatedSubqueryOperator
Direction
JsonPathSegment
One step of a JSON path: an object key or an array index.
SimpleOperator
StaticField
System
ValuePosition
One side of a simple condition. A literal is a string, number, boolean, null, or an array of strings, numbers, and booleans.

Constants§

MAX_JSON_PATH_INDEX
MAX_JSON_PATH_INDEX: the largest array index a path may hold.

Functions§

ast_to_zql
The builder calls after the table that make ast, such as .where('id', '=', 123): astToZQL. The inspector prefixes the table name. With redact_literals, every literal and the start row read ?, so the code can be logged without row data or arguments.
format_json_path
formatJsonPathReference: metadata.tags[0].
json_value_at
jsonValueAtPath: the value at path in value, strictly: a key reads an object’s own key and an index an array’s element. Any other step, and a missing value, is null.
normalize_condition