Module utility

Source
Expand description

Shortcuts to construct intermediate AST nodes.

Functions§

add
Construct a new boxed Expression A + B
aliased_expr
An expression with an alias i.e. EXPR AS ALIAS
and
Construct a new boxed Expression P AND Q
col
Get column from name
col_res
Select one column from a table and give it an alias i.e. SELECT COL AS ALIAS
col_res_all
Select all columns from a table i.e. SELECT *
cols_res
Select multiple columns from a table i.e. SELECT COL1, COL2, …
count
Count the amount of non-null entries of expression
count_all
Count the rows
count_all_res
Count rows and give the result an alias i.e. SELECT COUNT(*) AS ALIAS
count_res
Count the amount of non-null entries of expression and give it an alias i.e. SELECT COUNT(EXPR) AS ALIAS
div
Construct a new boxed Expression A / B
equal
Construct a new boxed Expression A == B
ge
Construct a new boxed Expression A >= B
group_by
Group by clause with multiple columns i.e. GROUP BY ID0, ID1, …
gt
Construct a new boxed Expression A > B
ident
Panics
le
Construct a new boxed Expression A <= B
lit
Get literal from value
lt
Construct a new boxed Expression A < B
max
Compute the maximum of an expression
max_res
Compute the maximum of an expression and give it an alias i.e. SELECT MAX(EXPR) AS ALIAS
min
Compute the minimum of an expression
min_res
Compute the minimum of an expression and give it an alias i.e. SELECT MIN(EXPR) AS ALIAS
mul
Construct a new boxed Expression A * B
not
Construct a new boxed Expression NOT P
or
Construct a new boxed Expression P OR Q
order
Order by one column i.e. ORDER BY ID [ASC|DESC]
orders
Order by multiple columns i.e. ORDER BY ID0 [ASC|DESC], ID1 [ASC|DESC], …
query
Generate a SetExpression of the kind SELECT COL1, COL2, … FROM TAB WHERE EXPR GROUP BY …
query_all
Generate a SetExpression of the kind SELECT COL1, COL2, … FROM TAB GROUP BY …
select
Generate a query of the kind SELECT … ORDER BY … [LIMIT … OFFSET …]
slice
Slice a query result using LIMIT and OFFSET clauses i.e. LIMIT N OFFSET M
sub
Construct a new boxed Expression A - B
sum
Compute the sum of an expression
sum_res
Compute the sum of an expression and give it an alias i.e. SELECT SUM(EXPR) AS ALIAS
tab
Get table from schema and name.