Skip to main content

Module builder

Module builder 

Source
Expand description

Query builders for PostgreSQL statements.

QueryBuilder builds SELECT, INSERT, UPDATE, DELETE, WITH and REFRESH MATERIALIZED VIEW statements as SQL text plus bound parameters, without a connection. The driver integrations in the drizzle crate wrap it to run the statements. Each statement kind has a submodule with its builder states.

Re-exports§

pub use cte::CTEDefinition;
pub use cte::CTEView;
pub use insert::OnConflictBuilder;
pub use refresh::RefreshConcurrently;
pub use refresh::RefreshInitial;
pub use refresh::RefreshMaterializedView;
pub use refresh::RefreshWithNoData;
pub use refresh::refresh_materialized_view;
pub use select::SelectForSet;
pub use update::UpdateFromSet;

Modules§

cte
Common table expression (WITH) types for PostgreSQL queries.
delete
DELETE builder states and clause methods.
insert
INSERT builder states and clause methods.
prepared
Prepared PostgreSQL statements: SQL split around its parameter slots.
refresh
REFRESH MATERIALIZED VIEW statements for PostgreSQL.
select
SELECT builder states and clause methods.
update
UPDATE builder states and clause methods.

Structs§

BuilderInit
The state of a query builder before any statement has been started.
CTEInit
Builder state after .with(cte): the next call starts the main statement.
DeleteInitial
Marker for the initial state of DeleteBuilder.
DeleteReturningSet
Marker for the state after RETURNING clause.
DeleteWhereSet
Marker for the state after WHERE clause.
InsertColumnsSet
INSERT builder state after .columns(...), waiting for its SELECT source. Columns is the type-level list of target columns.
InsertDoUpdateSet
Marker for the state after DO UPDATE SET (before optional WHERE).
InsertInitial
Marker for the initial state of InsertBuilder.
InsertOnConflictSet
Marker for the state after ON CONFLICT is set.
InsertReturningSet
Marker for the state after RETURNING clause is added.
InsertValuesSet
Marker for the state after VALUES are set.
QueryBuilder
Builds PostgreSQL statements as SQL plus bound parameters, without a connection.
SQL
A SQL fragment: tokens, identifiers, raw text, and bound parameters.
SelectFromSet
Marker for the state after FROM clause.
SelectGroupSet
Marker for the state after GROUP BY clause.
SelectInitial
Marker for the initial state of SelectBuilder.
SelectJoinSet
Marker for the state after JOIN clause.
SelectLimitSet
Marker for the state after LIMIT clause.
SelectOffsetSet
Marker for the state after OFFSET clause.
SelectOrderSet
Marker for the state after ORDER BY clause.
SelectSetOpSet
Marker for the state after set operations (UNION/INTERSECT/EXCEPT).
SelectWhereSet
Marker for the state after WHERE clause.
UpdateInitial
Marker for the initial state of UpdateBuilder.
UpdateReturningSet
Marker for the state after RETURNING clause.
UpdateSetClauseSet
Marker for the state after SET clause.
UpdateWhereSet
Marker for the state after WHERE clause.

Enums§

OrderBy
Sort direction of an ORDER BY term.

Traits§

ExecutableState
Builder states whose query is complete and can be executed.
SQLSchema
A schema item (table, column, index, view, enum) with a name and its CREATE SQL.
SQLTable
A table for the dialect whose value type is Value.
SQLViewInfo
Runtime metadata of a view, usable as a trait object.
ToSQL
Something that renders as a SQL fragment for the value type V.