diesel

Module expression

Source
Expand description

AST types representing various typed SQL expressions.

Almost all types implement either Expression or AsExpression.

The most common expression to work with is a Column. There are various methods that you can call on these, found in expression_methods.

You can also use numeric operators such as + on expressions of the appropriate type.

Any primitive which implements ToSql will also implement AsExpression, allowing it to be used as an argument to any of the methods described here.

Modules§

array_comparisoni-implement-a-third-party-backend-and-opt-into-breaking-changes
This module contains the query dsl node definitions for array comparison operations like IN and NOT IN
existsi-implement-a-third-party-backend-and-opt-into-breaking-changes
This module contains the query dsl node definition for EXISTS expressions
expression_types
Possible types for []Expression::SqlType]
functions
Helper macros to define custom sql functions
is_aggregate
Possible values for ValidGrouping::IsAggregate

Structs§

CaseWhen
A SQL CASE WHEN ... END expression
Concati-implement-a-third-party-backend-and-opt-into-breaking-changes
This type represents a string concat operator
SqlLiteral
Returned by the sql() function.
UncheckedBind
Returned by the SqlLiteral::bind() method when binding a value to a fragment of SQL.

Traits§

AppearsOnTable
Indicates that all elements of an expression are valid given a from clause.
AsExpression
Converts a type to its representation for use in Diesel’s query builder.
BoxableExpression
Helper trait used when boxing expressions.
Expression
Represents a typed fragment of SQL.
IntoSql
Converts a type to its representation for use in Diesel’s query builder.
MixedAggregates
Can two IsAggregate types appear in the same expression?
NonAggregateNon-unstable
Trait alias to represent an expression that isn’t aggregate by default.
QueryMetadata
A helper to translate type level sql type information into runtime type information for specific queries
Selectable
Trait indicating that a record can be selected and queried from the database.
SelectableExpression
Indicates that an expression can be selected from a source.
SelectableHelper
This helper trait provides several methods for constructing a select or returning clause based on a Selectable implementation.
TypedExpressionType
Marker trait for possible types of Expression::SqlType
ValidGrouping
Is this expression valid for a given group by clause?

Derive Macros§

AsExpression
Implements all required variants of AsExpression
Selectable
Implements Selectable
ValidGrouping
Implements ValidGrouping