Skip to main content

right

Function right 

Source
pub fn right<'a, V, E, N>(
    expr: E,
    n: N,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, <E::Nullable as Nullability>::Or<N::Nullable>, <E::Aggregate as AggregateKind>::Or<N::Aggregate>, (E::Sources, N::Sources)>
Expand description

The last n characters of a text value (RIGHT), on PostgreSQL and MySQL.

expr must be text and n an integer. The result is text, nullable if either argument is. SQLite has no RIGHT; use substr there.

ยงExamples

assert_eq!(right(users.name, 3).sql(), r#"RIGHT ("users"."name", $1)"#);