Expand description
NQL (NEDB Query Language) parser and executor for v2 DAG storage.
Grammar:
FROM coll
[AS OF seq]
[VALID AS OF “date”]
[WHERE
where
Until 3.3.0 the predicate surface was six operators wide (= != > < >= <=)
joined by an implicit AND, with no grouping, no negation and no set/range/
pattern tests. Every one of those is table stakes in SQL, and their absence
is the single most visible gap against a SQL engine: the queries people
actually type (status IN ('open','pending'), height BETWEEN 100 AND 200,
name LIKE 'ac%') had to be decomposed by hand or filtered client-side.
NOTE ON STRICTNESS. The old parser ended its clause loop with
_ => { self.advance(); } — “skip unrecognised”. That is the same defect
class as a swallowed write error: a query containing a clause the engine
does not implement did not fail, it silently returned the results of a
DIFFERENT query. FROM x WHERE a = 1 OFFSET 5 dropped both tokens and
answered without the offset; a misspelled ORDRE BY height answered
unsorted. Unknown tokens are now a parse error. This is deliberately
breaking for queries that were already being silently misread — there was
no correct behaviour to preserve.
Structs§
- Aggregate
- An aggregate, grouped or ungrouped.
- Order
Key - One
ORDER BYkey. A list of these replaces the old singleOption<String>+boolpair, becauseORDER BY status, fee DESC— sort by one column then break ties with another — has no encoding as a single field plus a single direction. - Query
Enums§
Functions§
- execute
- node_
to_ json - A node as a flat query row: data fields at the top level plus the
_-prefixed metadata. Public so the HTTP single-row GET returns the SAME shape a query row has — one definition, so the two surfaces cannot drift apart. - parse
- Execute a NQL query against the DAG database.
Parse NQL into a
QueryWITHOUT touching the database. - query
- Parse and execute NQL, returning (rows, count).