pub fn translate<'a, V, E, F, T>(
expr: E,
from: F,
to: T,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, E::Nullable, <<E::Aggregate as AggOr<F::Aggregate>>::Output as AggOr<T::Aggregate>>::Output>where
V: SQLParam + 'a,
V::DialectMarker: PostgresStringSupport,
E: Expr<'a, V>,
E::SQLType: Textual,
F: Expr<'a, V>,
F::SQLType: Textual,
F::Aggregate: AggregateKind,
T: Expr<'a, V>,
T::SQLType: Textual,
T::Aggregate: AggregateKind,
E::Aggregate: AggOr<F::Aggregate>,
<E::Aggregate as AggOr<F::Aggregate>>::Output: AggOr<T::Aggregate>,Expand description
TRANSLATE - replaces each character in from with the corresponding
character in to (PostgreSQL).
Characters in from that have no match in to are removed.
ยงExample
use drizzle_core::expr::translate;
// SELECT TRANSLATE(users.phone, '()-', '')
let clean_phone = translate(users.phone, "()-", "");