Query Shape
An Aelir query can define CTE-style subqueries, then evaluate a pipeline or set operation. A pipeline starts with an entity or CTE source and continues through pipe-separated stages:
with active = ( from User | filter deleted_at is null | select { id, email, role }) from User| filter deleted_at is null| join Invoice| group { role } aggregate { count, sum(total) }| having count > 1| sort { sum_total desc }| limit 10Syntax
Identifiers name VTI entities and fields. String literals use double quotes. limit takes an integer literal.
VTI Consumption
Aelir reads a .vti.json package emitted by Saeril through veylun types emit. It uses VTI modules, entities, entity row fields, field labels, field types, and reference metadata encoded in VTI field types. The from and join entities must resolve to VTI entities.
Type Checking
Type Checking in brief:
- from Entity must name a VTI entity.
- Field references in filter, select, join on, group, aggregate, and sort must exist in the current pipeline row.
- Qualified field references use Entity.field. Unqualified references are accepted when exactly one current field has that name.
- filter comparisons require compatible operand types. and and or require boolean operands. Ordered comparisons require compatible non-null operands. is null and is not null require a nullable field.
- join Entity resolves the single VTI reference between the current row's entities and Entity. It is an error when there are zero or multiple candidate references.
- join Entity on Left.field == Right.field validates both sides and requires compatible field types. Declared VTI references are used for shorthand resolution.
- After a join, the result row contains fields from both sides and renders entity-qualified names, such as User.id and Invoice.id, to avoid clashes.
- group { ... } aggregate { ... } replaces the current row with the group fields plus aggregate result fields.
SQL Emission
aelir sql FILE.aelir --schema FILE.vti.json checks the query and emits a deterministic Postgres SELECT. Entity and field names are quoted. Simple pipeline stages are flattened into one SELECT with WHERE, ORDER BY, and LIMIT clauses where possible; joins compile to SQL JOINs, CTEs compile to SQL WITH, and set operations compile to UNION or INTERSECT.
Parameters emit as stable Postgres placeholders in first-use order:
from User| filter created_at >= $since: DateTime| select { id, email }CLI
On successful check, the CLI prints the inferred result row:
On successful run, the CLI executes the query against JSON input and prints a JSON array of result objects. Runtime parameters can be supplied with --param name=value. Input data is an object keyed by VTI entity name:
Execution is deterministic: grouping, distinct rows, object keys, and sorted output use stable ordering.
aelir check examples/active_users.aelir --schema billing.vti.jsonaelir sql examples/active_users.aelir --schema billing.vti.jsonaelir run examples/active_users.aelir --schema billing.vti.json --data data.jsonDownload
Aelir is in active development and has no public downloads or releases yet.
No public download artifacts are available yet for this language.
Looking for everything in one place? See the downloads index.
