diesel::expression_methods

Trait SqliteExpressionMethods

Source
pub trait SqliteExpressionMethods: Expression + Sized {
    // Provided methods
    fn is<T>(self, other: T) -> Is<Self, T>
       where Self::SqlType: SqlType,
             T: AsExpression<Self::SqlType> { ... }
    fn is_not<T>(self, other: T) -> IsNot<Self, T>
       where Self::SqlType: SqlType,
             T: AsExpression<Self::SqlType> { ... }
}
Available on crate feature sqlite only.
Expand description

Sqlite specific methods which are present on all expressions.

Provided Methods§

Source

fn is<T>(self, other: T) -> Is<Self, T>
where Self::SqlType: SqlType, T: AsExpression<Self::SqlType>,

Creates a Sqlite IS expression.

The IS operator work like = except when one or both of the operands are NULL. In this case, if both operands are NULL, then the IS operator evaluates to true. If one operand is NULL and the other is not, then the IS operator evaluates to false. It is not possible for an IS expression to evaluate to NULL.

§Example
let jack_is_a_dog = animals
    .select(name)
    .filter(species.is("dog"))
    .get_results::<Option<String>>(connection)?;
assert_eq!(vec![Some("Jack".to_string())], jack_is_a_dog);
Source

fn is_not<T>(self, other: T) -> IsNot<Self, T>
where Self::SqlType: SqlType, T: AsExpression<Self::SqlType>,

Creates a Sqlite IS NOT expression.

The IS NOT operator work like != except when one or both of the operands are NULL. In this case, if both operands are NULL, then the IS NOT operator evaluates to false. If one operand is NULL and the other is not, then the IS NOT operator is true. It is not possible for an IS NOT expression to evaluate to NULL.

§Example
let jack_is_not_a_spider = animals
    .select(name)
    .filter(species.is_not("spider"))
    .get_results::<Option<String>>(connection)?;
assert_eq!(vec![Some("Jack".to_string())], jack_is_not_a_spider);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§