Skip to main content

right

Function right 

Source
pub fn right<'a, V, E, N>(
    expr: E,
    n: N,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Text, <E as Expr<'a, V>>::Nullable, <<E as Expr<'a, V>>::Aggregate as AggOr<<N as Expr<'a, V>>::Aggregate>>::Output>
where V: SQLParam + 'a, <V as SQLParam>::DialectMarker: PostgresStringSupport, E: Expr<'a, V>, <E as Expr<'a, V>>::SQLType: Textual, N: Expr<'a, V>, <N as Expr<'a, V>>::SQLType: Integral, <N as Expr<'a, V>>::Aggregate: AggregateKind, <E as Expr<'a, V>>::Aggregate: AggOr<<N as Expr<'a, V>>::Aggregate>,
Expand description

RIGHT - returns the last n characters of a string (PostgreSQL).

Preserves the nullability of the input expression.

ยงExample

use drizzle_core::expr::right;

// SELECT RIGHT(users.phone, 4)
let last_four = right(users.phone, 4);