Skip to main content

like

Function like 

Source
pub fn like<'a, V, L, R>(
    left: L,
    pattern: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <L::Aggregate as AggOr<<R as ComparisonOperand<'a, V, L>>::Aggregate>>::Output>
where V: SQLParam + 'a, L: Expr<'a, V>, R: ComparisonOperand<'a, V, L>, L::SQLType: Compatible<<R as ComparisonOperand<'a, V, L>>::SQLType> + Textual, <R as ComparisonOperand<'a, V, L>>::SQLType: Textual, L::Aggregate: AggOr<<R as ComparisonOperand<'a, V, L>>::Aggregate>,
Expand description

LIKE pattern matching.

Requires both operands to be textual types (TEXT, VARCHAR).

§Type Safety

// ✅ OK: Text column with text pattern
like(users.name, "%Alice%");

// ❌ Compile error: Int is not Textual
like(users.id, "%123%");