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 NullOr<F::Nullable>>::Output as NullOr<T::Nullable>>::Output, <<E::Aggregate as AggOr<F::Aggregate>>::Output as AggOr<T::Aggregate>>::Output>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,
E::Nullable: NullOr<F::Nullable>,
<E::Nullable as NullOr<F::Nullable>>::Output: NullOr<T::Nullable>,
E::Aggregate: AggOr<F::Aggregate>,
<E::Aggregate as AggOr<F::Aggregate>>::Output: AggOr<T::Aggregate>,Expand description
REPLACE - replaces occurrences of a substring.
Replaces all occurrences of from with to in the expression.
The result is nullable when any argument is nullable.
ยงExample
use drizzle_core::expr::replace;
// SELECT REPLACE(users.email, '@old.com', '@new.com')
let new_email = replace(users.email, "@old.com", "@new.com");