barrel_bql (barrel_docdb v1.1.1)
View SourceBQL, barrel's PartiQL dialect: the public compile surface.
Pipeline: lex -> parse -> canonicalize -> validate -> lower. The resulting plan carries a barrel_query spec for the document scan, an optional table-function source (executed by the barrel module, never here), an optional unnest, and per-row post stages.
{ok, Plan} = barrel_bql:compile(
<<"SELECT title FROM db WHERE type = 'post' LIMIT 10">>),
{ok, Plan2} = barrel_bql:compile(
<<"SELECT * FROM db WHERE org = $org">>,
#{params => #{<<"org">> => <<"acme">>}}).
Summary
Functions
Compile BQL source (or a parsed AST) to an executable plan.
One-line human rendering of a compile error, for logs and the REST 400 body.
Parse BQL source to its AST. Locations are {Line, Column}.
Types
Functions
-spec compile(binary() | string() | barrel_bql_ast:ast()) -> {ok, plan()} | {error, bql_error()}.
Compile BQL source (or a parsed AST) to an executable plan.
One-line human rendering of a compile error, for logs and the REST 400 body.
-spec parse(binary() | string()) -> {ok, barrel_bql_ast:ast()} | {error, bql_error()}.
Parse BQL source to its AST. Locations are {Line, Column}.