Skip to main content

Module query

Module query 

Source
Expand description

The untyped query builder (QueryImpl in packages/zql/src/query/query-impl.ts) and the builder of where conditions (ExpressionBuilder in packages/zql/src/query/expression.ts).

The AST is always normalized: each step builds its part of the AST in normalized form. Misuse that JS reports by throwing from the builder, such as a negative limit or a limit inside a junction relationship, leaves that step out and makes the query invalid: AnyQuery::invalid holds JS’s message. An unknown relationship is a programming error and panics.

Structs§

AnyGroupedQuery
A query grouped by columns, waiting for the aggregate that reduces each group (GroupedQuery).
AnyQuery
A query over a table, named by strings.
CustomQueryId
The name and arguments of the named query a query was built by.
ExistsOptions
The options of exists and whereExists.
ExpressionBuilder
Builds the conditions of a where (ExpressionBuilder in packages/zql/src/query/expression.ts).
JsonPathReference
A value inside a json column, made by ExpressionBuilder::json (ColumnRef in packages/zql/src/query/expression.ts).
StaticParameter
A value taken from the context a query runs in, such as the auth data (staticParam in packages/zql/src/query/static-param.ts).

Constants§

FALSE_CONDITION
FALSE: an empty OR.
SUBQUERY_ALIAS_PREFIX
The prefix of the aliases the builder gives exists subqueries (SUBQ_PREFIX in packages/zero-protocol/src/ast.ts).
TRUE_CONDITION
TRUE: an empty AND.

Functions§

simplify_condition
simplifyCondition (packages/zql/src/query/expression.ts).