pub fn substr<'a, V, E, S, L>(
expr: E,
start: S,
len: L,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, E::Nullable, <<E::Aggregate as AggOr<S::Aggregate>>::Output as AggOr<L::Aggregate>>::Output>Expand description
SUBSTR - extracts a substring from a string.
Extracts len characters starting at position start (1-indexed).
Preserves the nullability of the input expression.
ยงExample
use drizzle_core::expr::substr;
// SELECT SUBSTR(users.name, 1, 3) -- first 3 characters
let prefix = substr(users.name, 1, 3);