Skip to main content

count

Function count 

Source
pub fn count<'a, V, A>(
    arg: A,
) -> SQLExpr<'a, V, <V::DialectMarker as CountPolicy>::Count, NonNull, Agg>
where V: SQLParam + 'a, V::DialectMarker: CountPolicy, A: CountArg<'a, V>,
Expand description

COUNT aggregate.

Pass () for COUNT(*), or a column/expression for COUNT(expr).

Returns a BigInt, NonNull (count is never NULL), Aggregate expression.

ยงExample

use drizzle_core::expr::count;

let all_rows = count(());
// Generates: COUNT(*)

let email_count = count(users.email);
// Generates: COUNT("users"."email")