Skip to main content

log2

Function log2 

Source
pub fn log2<'a, V, E>(
    expr: E,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Double, <E as Expr<'a, V>>::Nullable, <E as Expr<'a, V>>::Aggregate>
where V: SQLParam + 'a, <V as SQLParam>::DialectMarker: SQLiteMathSupport, E: Expr<'a, V>, <E as Expr<'a, V>>::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);