barrel_bql_ast (barrel_docdb v1.0.0)
View SourceBQL AST shapes shared by the parser, the lowering pass and their consumers. Locations are {Line, Column} and sit on every node that can fail validation.
Summary
Types
-type ast() :: #{type := select, select := star | [projection()], from := from(), where := expr() | undefined, order_by := [order_item()], limit := undefined | {integer, loc(), non_neg_integer()}, offset := undefined | {integer, loc(), non_neg_integer()}, subscribe := boolean()}.
-type expr() :: {'and', loc(), expr(), expr()} | {'or', loc(), expr(), expr()} | {'not', loc(), expr()} | {cmp, loc(), '=' | '!=' | '<' | '<=' | '>' | '>=', operand(), operand()} | {is_null, loc(), operand(), Negated :: boolean()} | {is_missing, loc(), operand(), Negated :: boolean()} | {in, loc(), operand(), [literal()], Negated :: boolean()} | {like, loc(), operand(), binary(), Negated :: boolean()} | {between, loc(), operand(), operand(), operand(), Negated :: boolean()} | {contains, loc(), path(), literal()}.
-type loc() :: {pos_integer(), pos_integer()}.
-type order_item() :: {path(), asc | desc}.
-type path() :: {path, loc(), [path_component()]}.
-type path_component() :: {key, binary()} | {index, non_neg_integer()} | wildcard.