pub trait AsInExpression<T: SqlType + TypedExpressionType> {
    type InExpression: MaybeEmpty + Expression<SqlType = T>;

    fn as_in_expression(self) -> Self::InExpression;
Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Expand description

This trait describes how a type is transformed to the IN (values) value expression

Diesel provided several implemenations here:

  • An implementation for any Iterator over values that implement AsExpression<ST> for the corresponding sql type ST. The corresponding values clause will contain bind statements for each individual value.
  • An implementation for select statements, that return a single field. The corresponding values clause will contain the sub query.

This trait is exposed for custom third party backends so that they can restrict the QueryFragment implementations for In and NotIn.

Required Associated Types

Type of the expression returned by AsInExpression::as_in_expression

Required Methods

Construct the diesel query dsl representation of the IN (values) clause for the given type