diesel::expression_methods

Trait PgTextExpressionMethods

Source
pub trait PgTextExpressionMethods: Expression + Sized {
    // Provided methods
    fn ilike<T: AsExpression<Text>>(
        self,
        other: T,
    ) -> ILike<Self, T::Expression> { ... }
    fn not_ilike<T: AsExpression<Text>>(
        self,
        other: T,
    ) -> NotILike<Self, T::Expression> { ... }
}
Expand description

PostgreSQL specific methods present on text expressions.

Provided Methods§

Source

fn ilike<T: AsExpression<Text>>(self, other: T) -> ILike<Self, T::Expression>

Creates a PostgreSQL ILIKE expression

§Example
let starts_with_s = animals
    .select(species)
    .filter(name.ilike("s%").or(species.ilike("s%")))
    .get_results::<String>(&connection)?;
assert_eq!(vec!["spider"], starts_with_s);
Source

fn not_ilike<T: AsExpression<Text>>( self, other: T, ) -> NotILike<Self, T::Expression>

Creates a PostgreSQL NOT ILIKE expression

§Example
let doesnt_start_with_s = animals
    .select(species)
    .filter(name.not_ilike("s%").and(species.not_ilike("s%")))
    .get_results::<String>(&connection)?;
assert_eq!(vec!["dog"], doesnt_start_with_s);

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§