Skip to main content

count

Function count 

Source
pub async fn count<M>(
    cx: &Cx,
    query: impl IntoStatement<Returning = List<M>>,
) -> Result<u64, Error>
where M: Model,
Expand description

How many rows query holds, counted on the pooled [Db]: a model’s query, such as Post::filter(..), or a Query such as list_query’s.

Reads 0 where Toasty answers no value: a count over a filter Toasty can tell matches nothing, such as list_query narrowed to one status on a list whose tab shows another, which Query::count fails to read.

A record fn or a hook counts through the ex it received, with count_in.

§Errors

As db, and the database failing the count.