pub async fn count_in<M>(
ex: &mut dyn Executor,
query: impl IntoStatement<Returning = List<M>>,
) -> Result<u64, Error>where
M: Model,Expand description
How many rows query holds, counted through ex: inside the transaction a record fn or a
hook received, so the count sees the rows the write has made so far and a limit check holds
against concurrent writes the isolation level orders. Reads 0 where Toasty answers no value, as
count does.
let projects = db::count_in(ex, Project::filter(Project::fields().team_id().eq(team))).await?;
Ok(projects < 10)ยงErrors
The database failing the count, and a declaration failure for a statement that writes, such as an insert, which has no rows to count.