Module query_builder

Source
Expand description

Contains traits responsible for the actual construction of SQL statements

The types in this module are part of Diesel’s public API, but are generally only useful for implementing Diesel plugins. Applications should generally not need to care about the types inside of this module.

Re-exports§

pub use crate::pg::query_builder::tablesample::TablesampleMethod;

Modules§

bind_collector
Types related to managing bind parameters during query construction.

Structs§

AstPass
The primary type used when walking a Diesel AST during query execution.
AstPassToSqlOptions
This is used to pass down additional settings to the AstPass when rendering the sql string.
BatchInsert
This type represents a batch insert clause, which allows to insert multiple rows at once.
BoxedLimitOffsetClause
A boxed variant of LimitOffsetClause
BoxedSelectStatement
This type represents a boxed select query
BoxedSqlQuery
See SqlQuery::into_boxed.
CollectedQuery
A SQL query variant with already collected bind data which can be moved
DebugQuery
A struct that implements fmt::Display and fmt::Debug to show the SQL representation of a query.
DefaultValues
DeleteStatement
Represents a SQL DELETE statement.
FromClause
IncompleteInsertStatement
The structure returned by insert_into.
InsertStatement
A fully constructed insert statement.
LimitClause
A query node representing a limit clause
LimitOffsetClause
A helper query node that contains both limit and offset clauses
NoFromClause
This type represents a not existing from clause
NoLimitClause
A query node indicating the absence of a limit clause
NoOffsetClause
A query node indicating the absence of an offset clause
OffsetClause
A query node representing an offset clause
Only
Represents a query with an ONLY clause.
ReturningClause
This type represents a SQL Returning clause
SelectStatement
This type represents a select query
SqlQuery
The return value of sql_query.
Tablesample
Represents a query with a TABLESAMPLE clause.
UpdateStatement
Represents a complete UPDATE statement.
UpdateTarget
ValuesClause
This type represents a values clause used as part of insert statements

Traits§

AsChangeset
Types which can be passed to update.set.
AsQuery
Types that can be converted into a complete, typed SQL query.
BindCollector
A type which manages serializing bind parameters during query construction.
DecoratableTarget
Interface to add information to conflict targets. Designed to be open for further additions to conflict targets like constraints
IntoBoxedClause
A trait used to construct type erased boxed variant of the current query node
IntoUpdateTarget
A type which can be passed to update or delete.
MoveableBindCollector
A movable version of the bind collector which allows it to be extracted, moved and refilled.
Query
A complete SQL query with a return type.
QueryBuilder
Constructs a SQL query from a Diesel AST.
QueryFragment
An untyped fragment of SQL.
QueryId
Uniquely identifies queries by their type for the purpose of prepared statement caching.
SelectClauseExpression
Specialised variant of Expression for select clause types
SelectQuery
Indicates that a type is a SELECT statement.
UndecoratedInsertRecord
Marker trait to indicate that no additional operations have been added to a record for insert.

Functions§

debug_query
Takes a query QueryFragment expression as an argument and returns a type that implements fmt::Display and fmt::Debug to show the query.

Type Aliases§

BoxedDeleteStatement
A DELETE statement with a boxed WHERE clause
BoxedUpdateStatement
An UPDATE statement with a boxed WHERE clause.
BuildQueryResult
A specialized Result type used with the query builder.
IncompleteInsertOrIgnoreStatement
Represents the return type of diesel::insert_or_ignore_into
IncompleteReplaceStatement
Represents the return type of diesel::replace_into
InsertOrIgnoreStatement
Represents a complete INSERT OR IGNORE statement.
ReplaceStatement
Represents a complete INSERT OR REPLACE statement.

Derive Macros§

AsChangeset
Implements AsChangeset
QueryId
Implements QueryId