Module grafbase_sql_ast::ast
source · Expand description
An abstract syntax tree for SQL queries.
The ast module handles everything related building abstract SQL queries without going into database-level specifics.
Structs
- An aggregate function that concatenates strings from a group into a single string with various options.
- A representation of the
AVG
function in the database. - Returns the first non-null expression
- A column definition.
- A representation of the
Concat
function in the database. - Returns the number of rows that matches a specified criteria.
- A builder for a
DELETE
statement. - A representation of the
encode
function in PostgreSQL. - An expression that can be positioned in a query. Can be a single value or a statement that is evaluated into a value.
- A database function definition
- A list of definitions for the
GROUP BY
statement - A builder for an
INSERT
statement. - The
JOIN
table and conditions. - A representation of the
json_agg
function in PostgreSQL. - A represention of the
LOWER
function in the database. - Represents a JSON key/value type.
- A represention of the
MAX
function in the database. - A represention of the
MIN
function in the database. - A builder for an
INSERT
statement for multiple rows. - A list of definitions for the
ORDER BY
statement. - Determines the partitioning and ordering of a rowset before the associated window function is applied.
- A collection of values surrounded by parentheses.
- A window function that assigns a sequential integer number to each row in the query’s result set.
- A representation of the
ROW_TO_JSON
function in the database. Only forPostgresql
- A builder for a
SELECT
statement. - A builder for an
INSERT
statement for a single row. - A represention of the
SUM
function in the database. - A table definition
- A representation of the
to_jsonb
function in PostgreSQL. - A builder for an
UPDATE
statement. - A represention of the
UPPER
function in the database. - An in-memory temporary table. Can be used in some of the databases in a place of an actual table. Doesn’t work in MySQL 5.7.
Enums
- For modeling comparison expressions.
- Tree structures and leaves for condition building.
- The encode format.
- An expression we can compare and use in database queries.
- A representation of a
JOIN
statement. INSERT
conflict resolution strategies.- The ordering direction
- A database query
- Calculation operations in SQL queries.
- Either an identifier or a nested query.
- Represents any valid JSON value.
Traits
- An object that can be aliased.
- An item that can be compared against other values in the database.
AND
,OR
andNOT
conjunctive implementations.- An item that can be used in the
GROUP BY
statement - Convert the value into a group by definition.
- Convert the value into an order definition with order item and direction
- An item that can be joined.
- An item that can be used in the
ORDER BY
statement
Functions
- Aggregates the given field into a string.
- A quick alias to create an asterisk to a table.
- Calculates the average value of a numeric column.
- Returns the first non-null argument
- Concat several expressions.
- Count of the underlying table where the given expression is not null.
- A quick alias to create a default value expression.
- Return the given table as JSONB collection.
- Return the given table as JSONB collection.
- Extracts a subset of a JSON blob given a path. Two types of paths can be used:
- Converts a JSON expression into string and unquotes it.
- Converts the result of the expression into lowercase string.
- Calculates the maximum value of a numeric column.
- Calculates the minimum value of a numeric column.
- A quick alias to create a raw value expression.
- A number from 1 to n in specified order
- Return the given table in
JSON
format. - Calculates the sum value of a numeric column.
- Return the given table in JSONB.
- Converts the result of the expression into uppercase string.
Type Aliases
- Defines a grouping for the
GROUP BY
statement. - Defines ordering for an
ORDER BY
statement.