pub fn log2<'a, V, E>(
expr: E,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Double, <V::DialectMarker as Log2Policy>::Nullable, E::Aggregate>where
V: SQLParam + 'a,
V::DialectMarker: MathExt + Log2Policy,
E: Expr<'a, V>,
E::SQLType: Numeric,Expand description
LOG2 - returns the base-2 logarithm of a number.
Available in SQLite when compiled with SQLITE_ENABLE_MATH_FUNCTIONS,
and natively in MySQL.
Returns a nullable dialect-aware double because invalid domains produce
NULL in both dialects.
ยงExample
use drizzle_core::expr::log2;
// SELECT LOG2(users.value)
let log_base_2 = log2(users.value);