pub trait AsExpression<T>where
    T: SqlType + TypedExpressionType,
{ type Expression: Expression<SqlType = T>; fn as_expression(self) -> Self::Expression; }
Expand description

Converts a type to its representation for use in Diesel’s query builder.

This trait is used directly. Apps should typically use IntoSql instead.

Implementations of this trait will generally do one of 3 things:

  • Return self for types which are already parts of Diesel’s query builder

  • Perform some implicit coercion (for example, allowing now to be used as both Timestamp and Timestamptz.

  • Indicate that the type has data which will be sent separately from the query. This is generally referred as a “bind parameter”. Types which implement ToSql will generally implement AsExpression this way.

This trait could be derived

Required Associated Types§

The expression being returned

Required Methods§

Perform the conversion

Implementations on Foreign Types§

Implementors§