Skip to main content

count_by

count_by_{filter} — same filter grammar as first_by, returning a row count:

async fn count_by_team_id(&self, team_id: i32) -> sqlx::Result<i64>;
// SELECT COUNT(*) FROM "user" WHERE team_id = $1

Fetched with query_scalar.

Not supported here: #[order_by(...)] (a compile error if present) — ordering a count is meaningless.