Skip to main content

char_length

Function char_length 

Source
pub fn char_length<'a, V, E>(
    expr: E,
) -> SQLExpr<'a, V, <E::SQLType as LengthPolicy<V::DialectMarker>>::Output, E::Nullable, E::Aggregate>
Expand description

CHAR_LENGTH - returns the number of characters in a string.

Standard SQL function. Emits CHAR_LENGTH on PostgreSQL, LENGTH on SQLite.

ยงExample

use drizzle_core::expr::char_length;

// SELECT CHAR_LENGTH(users.name)  -- PG
// SELECT LENGTH(users.name)       -- SQLite
let name_len = char_length(users.name);