pub trait PgBinaryExpressionMethods: Sized + Expression {
    // Provided methods
    fn concat<T>(
        self,
        other: T,
    ) -> Grouped<Concat<Self, <T as AsExpression<Self::SqlType>>::Expression>>
       where Self::SqlType: SqlType,
             T: AsExpression<Self::SqlType> { ... }
    fn like<T>(
        self,
        other: T,
    ) -> Grouped<Like<Self, <T as AsExpression<Self::SqlType>>::Expression>>
       where Self::SqlType: SqlType,
             T: AsExpression<Self::SqlType> { ... }
    fn not_like<T>(
        self,
        other: T,
    ) -> Grouped<NotLike<Self, <T as AsExpression<Self::SqlType>>::Expression>>
       where Self::SqlType: SqlType,
             T: AsExpression<Self::SqlType> { ... }
}
Expand description

PostgreSQL specific methods present on Binary expressions.

Provided Methods§

source

fn concat<T>( self, other: T, ) -> Grouped<Concat<Self, <T as AsExpression<Self::SqlType>>::Expression>>
where Self::SqlType: SqlType, T: AsExpression<Self::SqlType>,

Concatenates two PostgreSQL byte arrays using the || operator.

§Example
let names = users.select(name.concat(" the Greatest".as_bytes())).load(connection);
let expected_names = vec![
    b"Sean the Greatest".to_vec(),
    b"Tess the Greatest".to_vec()
];
assert_eq!(Ok(expected_names), names);

// If the value is nullable, the output will be nullable
let names = users.select(hair_color.concat("ish".as_bytes())).load(connection);
let expected_names = vec![
    Some(b"Greenish".to_vec()),
    None,
];
assert_eq!(Ok(expected_names), names);
source

fn like<T>( self, other: T, ) -> Grouped<Like<Self, <T as AsExpression<Self::SqlType>>::Expression>>
where Self::SqlType: SqlType, T: AsExpression<Self::SqlType>,

Creates a PostgreSQL binary LIKE expression.

This method is case sensitive. There is no case-insensitive equivalent as of PostgreSQL 14.

§Examples
let starts_with_s = users
    .select(name)
    .filter(name.like(b"S%".to_vec()))
    .load(connection);
assert_eq!(Ok(vec![b"Sean".to_vec()]), starts_with_s);
source

fn not_like<T>( self, other: T, ) -> Grouped<NotLike<Self, <T as AsExpression<Self::SqlType>>::Expression>>
where Self::SqlType: SqlType, T: AsExpression<Self::SqlType>,

Creates a PostgreSQL binary LIKE expression.

This method is case sensitive. There is no case-insensitive equivalent as of PostgreSQL 14.

§Examples
let starts_with_s = users
    .select(name)
    .filter(name.not_like(b"S%".to_vec()))
    .load(connection);
assert_eq!(Ok(vec![b"Tess".to_vec()]), starts_with_s);

Object Safety§

This trait is not object safe.

Implementors§