Skip to main content

log2

Function log2 

Source
pub fn log2<'a, V, E>(
    expr: E,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Double, E::Nullable, E::Aggregate>
where V: SQLParam + 'a, V::DialectMarker: SQLiteMathSupport, 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. Returns a dialect-aware double type, preserves nullability.

ยงExample

use drizzle_core::expr::log2;

// SELECT LOG2(users.value)
let log_base_2 = log2(users.value);