Skip to main content

instr

Function instr 

Source
pub fn instr<'a, V, E, S>(
    expr: E,
    search: S,
) -> SQLExpr<'a, V, Integer, E::Nullable, <E::Aggregate as AggOr<S::Aggregate>>::Output>
Expand description

INSTR - finds the position of a substring.

Returns the 1-indexed position of the first occurrence of search in the expression, or 0 if not found. Returns SQLite INTEGER. Preserves the nullability of the input expression.

ยงExample

use drizzle_core::expr::instr;

// SELECT INSTR(users.email, '@')
let at_pos = instr(users.email, "@");