pub trait SqliteExpressionMethods: Sized + Expression {
// Provided methods
fn is<T>(
self,
other: T,
) -> Grouped<Is<Self, <T as AsExpression<Self::SqlType>>::Expression>>
where Self::SqlType: SqlType,
T: AsExpression<Self::SqlType> { ... }
fn is_not<T>(
self,
other: T,
) -> Grouped<IsNot<Self, <T as AsExpression<Self::SqlType>>::Expression>>
where Self::SqlType: SqlType,
T: AsExpression<Self::SqlType> { ... }
}
Expand description
Sqlite specific methods which are present on all expressions.
Provided Methods§
sourcefn is<T>(
self,
other: T,
) -> Grouped<Is<Self, <T as AsExpression<Self::SqlType>>::Expression>>
fn is<T>( self, other: T, ) -> Grouped<Is<Self, <T as AsExpression<Self::SqlType>>::Expression>>
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);
sourcefn is_not<T>(
self,
other: T,
) -> Grouped<IsNot<Self, <T as AsExpression<Self::SqlType>>::Expression>>
fn is_not<T>( self, other: T, ) -> Grouped<IsNot<Self, <T as AsExpression<Self::SqlType>>::Expression>>
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);
Object Safety§
This trait is not object safe.