Skip to main content

translate

Function translate 

Source
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>
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, "()-", "");