Module diesel::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.


pub use self::query_id::QueryId;
pub use self::update_statement::changeset::AsChangeset;


Types related to managing bind parameters during query construction.


The primary type used when walking a Diesel AST during query execution.
This is used to pass down additional settings to the AstPass when rendering the sql string.
This type represents a batch insert clause, which allows to insert multiple rows at once.
A boxed variant of LimitOffsetClause
This type represents a boxed select query
A struct that implements fmt::Display and fmt::Debug to show the SQL representation of a query.
Represents a SQL DELETE statement.
The structure returned by insert_into.
A fully constructed insert statement.
A query node representing a limit clause
A helper query node that contains both limit and offset clauses
This type represents a not existing from clause
A query node indicating the absence of a limit clause
A query node indicating the absence of an offset clause
A query node representing an offset clause
Represents a query with an ONLY clause.
This type represents a SQL Returning clause
This type represents a select query
The return value of sql_query.
Represents a complete UPDATE statement.
This type represents a values clause used as part of insert statements


Types which can be passed to update.set.
Types that can be converted into a complete, typed SQL query.
A type which manages serializing bind parameters during query construction.
Interface to add information to conflict targets. Designed to be open for further additions to conflict targets like constraints
A trait used to construct type erased boxed variant of the current query node
A type which can be passed to update or delete.
A complete SQL query with a return type.
Constructs a SQL query from a Diesel AST.
An untyped fragment of SQL.
Uniquely identifies queries by their type for the purpose of prepared statement caching.
Specialised variant of Expression for select clause types
Indicates that a type is a SELECT statement.
Marker trait to indicate that no additional operations have been added to a record for insert.


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

Type Definitions

A DELETE statement with a boxed WHERE clause
An UPDATE statement with a boxed WHERE clause.
A specialized Result type used with the query builder.
Represents a complete INSERT OR IGNORE statement.
Represents a complete INSERT OR REPLACE statement.

Derive Macros

Implements AsChangeset
Implements QueryId