pub fn collate<'a, V, E>(
expr: E,
name: &'static str,
) -> SQLExpr<'a, V, E::SQLType, E::Nullable, E::Aggregate>Expand description
COLLATE - apply a named collation to a text expression.
Preserves the input expression’s SQL type, nullability, and aggregate
kind. The collation name is emitted as a quoted identifier
(expr COLLATE "name") which works in both SQLite (which also accepts
unquoted built-ins like NOCASE) and PostgreSQL (which requires
quoting).
§Example
use drizzle_core::expr::collate;
// Case-insensitive comparison on SQLite:
// SELECT * FROM users WHERE name COLLATE "NOCASE" = ?
db.select(()).from(users)
.r#where(eq(collate(users.name, "NOCASE"), "alice"))
.all()?;
// PostgreSQL with the built-in `"C"` collation:
// SELECT * FROM products ORDER BY label COLLATE "C"
db.select(()).from(products)
.order_by(asc(collate(products.label, "C")))
.all()?;