Expand description
Declarative schema & query compiler — one YAML as the source of truth.
Structs§
- Catalog
- The symbol table: relations and enum types, each looked up by name. Ordered maps keep iteration (and therefore emitted output) deterministic.
- Catalog
Column - A resolved column in the catalog: its name, type, nullability, and the per-column query policy resolved from view select-item flags (or the defaults applied to table columns).
- Catalog
Relation - A named relation (table or view) and its resolved columns.
- Checked
Query - A query that has passed type-checking against the catalog. The only way to
build one is through
check_query; an unchecked query is unrepresentable at this type (HOLO-PARSE-DONT-VALIDATE). - Column
- One column definition: a type, plus nullability and an optional default.
- Compiled
- The result of compiling a YAML schema: the validated catalog (the symbol table queries are checked against) and the rendered PostgreSQL DDL.
- Enum
Type - A
CREATE TYPE … AS ENUM: a named, fixed set of allowed string values. - From
Clause - A view’s
from:— the source relation and the alias the rest of the view uses. - Index
- A
CREATE INDEX: a lookup shortcut; affects performance, never results. - Join
- A
JOIN … ON: combine rows from another relation by a matching rule. - Primary
Key - The column(s) that uniquely identify a row.
- Query
- A query against a relation: a filter expression to apply.
- Schema
Document - A whole parsed schema file: the top-level
types/tables/viewslists. - Select
Column - A plain column pulled from a
from:/join:alias. - Select
Expression - A raw SQL expression with a declared output name (escape hatch).
- Span
- A half-open byte range
[start, end)into the original YAML source. - Spanned
- A value paired with the source span it was parsed from.
- Table
- A
CREATE TABLE: physical storage. Columns are an ordered map so emitted DDL is deterministic (insertion order is preserved). - View
- A
CREATE VIEW … AS: a saved query exposed like a table. Clause fields afterselect/from/joinare raw SQL, passed through verbatim.
Enums§
- Catalog
Type - A resolved column type. Built from the YAML type string; an unresolved type can never exist here (illegal states unrepresentable).
- Compare
Op - Column-to-value comparison operators.
- Comparison
- A single comparison against a column. The shape of the value is fixed by
the variant — illegal states (e.g.
Inwith one value) are unrepresentable. - Filter
- A filter expression tree: logical AND/OR combinators around comparison leaves.
- Holocron
Error - The crate’s single root error type. Each variant carries the source span of the offending token (zero-default when the span is unknown), so the renderer can underline the right place in the YAML.
- Join
Kind - Which kind of join.
INNERkeeps only matches;LEFTkeeps all left rows. - Relation
Kind - Whether a relation is a physical table or a derived view.
- Select
Item - One item in a view’s
select:list. The variant is chosen during lowering by which keys are present (columnvssql). - SetOp
- Set-membership operators.
Functions§
- build_
catalog - Lower the parsed document into a resolved catalog (tables + enums).
- check_
query - Validate a query against the catalog: every referenced column must exist on the target relation, be filterable, and use an operator the column’s type supports.
- compile
- Compile a YAML schema end-to-end: parse → build catalog → resolve views → emit DDL.
- emit_
schema - Render a schema document as PostgreSQL DDL.
- parse_
schema - Parse YAML into the schema AST.
- resolve_
views - Resolve every view in the document into a catalog relation, extending the table-and-enum catalog produced by the previous phase.