Skip to main content

replace

Function replace 

Source
pub fn replace<'a, V, E, F, T>(
    expr: E,
    from: F,
    to: T,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, <<E::Nullable as Nullability>::Or<F::Nullable> as Nullability>::Or<T::Nullable>, <<E::Aggregate as AggregateKind>::Or<F::Aggregate> as AggregateKind>::Or<T::Aggregate>, (E::Sources, (F::Sources, T::Sources))>
where V: SQLParam + 'a, E: Expr<'a, V>, E::SQLType: Textual, F: Expr<'a, V>, F::SQLType: Textual, F::Nullable: Nullability, F::Aggregate: AggregateKind, T: Expr<'a, V>, T::SQLType: Textual, T::Nullable: Nullability, T::Aggregate: AggregateKind,
Expand description

Replaces every occurrence of from with to (REPLACE).

All three arguments must be text. The result is text, nullable if any argument is.

ยงExamples

let email = replace(users.email, "@old.example", "@new.example");
assert_eq!(email.sql(), r#"REPLACE ("users"."email", ?, ?)"#);