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

PostgreSQL specific methods present on text expressions.

Provided Methods§

source

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

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>( self, other: T, ) -> Grouped<NotILike<Self, <T as AsExpression<Text>>::Expression>>
where T: AsExpression<Text>,

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);
source

fn similar_to<T>( self, other: T, ) -> Grouped<SimilarTo<Self, <T as AsExpression<Text>>::Expression>>
where T: AsExpression<Text>,

Creates a PostgreSQL SIMILAR TO expression

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

fn not_similar_to<T>( self, other: T, ) -> Grouped<NotSimilarTo<Self, <T as AsExpression<Text>>::Expression>>
where T: AsExpression<Text>,

Creates a PostgreSQL NOT SIMILAR TO expression

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> PgTextExpressionMethods for T
where T: Expression, <T as Expression>::SqlType: TextOrNullableText,