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 forPostgreSQLqueries. - delete
DELETEbuilder states and clause methods.- insert
INSERTbuilder states and clause methods.- prepared
- Prepared
PostgreSQLstatements: SQL split around its parameter slots. - refresh
REFRESH MATERIALIZED VIEWstatements forPostgreSQL.- select
SELECTbuilder states and clause methods.- update
UPDATEbuilder states and clause methods.
Structs§
- Builder
Init - 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. - Delete
Initial - Marker for the initial state of
DeleteBuilder. - Delete
Returning Set - Marker for the state after RETURNING clause.
- Delete
Where Set - Marker for the state after WHERE clause.
- Insert
Columns Set - INSERT builder state after
.columns(...), waiting for its SELECT source.Columnsis the type-level list of target columns. - Insert
DoUpdate Set - Marker for the state after DO UPDATE SET (before optional WHERE).
- Insert
Initial - Marker for the initial state of
InsertBuilder. - Insert
OnConflict Set - Marker for the state after ON CONFLICT is set.
- Insert
Returning Set - Marker for the state after RETURNING clause is added.
- Insert
Values Set - Marker for the state after VALUES are set.
- Query
Builder - Builds
PostgreSQLstatements as SQL plus bound parameters, without a connection. - SQL
- A SQL fragment: tokens, identifiers, raw text, and bound parameters.
- Select
From Set - Marker for the state after FROM clause.
- Select
Group Set - Marker for the state after GROUP BY clause.
- Select
Initial - Marker for the initial state of
SelectBuilder. - Select
Join Set - Marker for the state after JOIN clause.
- Select
Limit Set - Marker for the state after LIMIT clause.
- Select
Offset Set - Marker for the state after OFFSET clause.
- Select
Order Set - Marker for the state after ORDER BY clause.
- Select
SetOp Set - Marker for the state after set operations (UNION/INTERSECT/EXCEPT).
- Select
Where Set - Marker for the state after WHERE clause.
- Update
Initial - Marker for the initial state of
UpdateBuilder. - Update
Returning Set - Marker for the state after RETURNING clause.
- Update
SetClause Set - Marker for the state after SET clause.
- Update
Where Set - Marker for the state after WHERE clause.
Enums§
- OrderBy
- Sort direction of an
ORDER BYterm.
Traits§
- Executable
State - Builder states whose query is complete and can be executed.
- SQLSchema
- A schema item (table, column, index, view, enum) with a name and its
CREATESQL. - SQLTable
- A table for the dialect whose value type is
Value. - SQLView
Info - Runtime metadata of a view, usable as a trait object.
- ToSQL
- Something that renders as a
SQLfragment for the value typeV.