pub fn substr<'a, V, E, S, L>(
expr: E,
start: S,
len: L,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, <<E::Nullable as NullOr<S::Nullable>>::Output as NullOr<L::Nullable>>::Output, <<E::Aggregate as AggOr<S::Aggregate>>::Output as AggOr<L::Aggregate>>::Output>where
V: SQLParam + 'a,
E: Expr<'a, V>,
E::SQLType: Textual,
S: Expr<'a, V>,
S::SQLType: Integral,
S::Nullable: Nullability,
S::Aggregate: AggregateKind,
L: Expr<'a, V>,
L::SQLType: Integral,
L::Nullable: Nullability,
L::Aggregate: AggregateKind,
E::Nullable: NullOr<S::Nullable>,
<E::Nullable as NullOr<S::Nullable>>::Output: NullOr<L::Nullable>,
E::Aggregate: AggOr<S::Aggregate>,
<E::Aggregate as AggOr<S::Aggregate>>::Output: AggOr<L::Aggregate>,Expand description
SUBSTR - extracts a substring from a string.
Extracts len characters starting at position start (1-indexed).
The result is nullable when any argument is nullable.
ยงExample
use drizzle_core::expr::substr;
// SELECT SUBSTR(users.name, 1, 3) -- first 3 characters
let prefix = substr(users.name, 1, 3);