I'm looking for a way to count all the records found by a query. I can see there is a count function but I'm not entirely sure how to deal with the output to get a number type out.
I have something similar to
entity::table_name::Entity::find().count(&db);
which returns a Pin<Box<dyn Future + Send<Output = Result<usize, DbErr>>>>
I'm just looking to get a number out. Am I on the right track here? What would be the simplest way to get the count?
Getting the count as a usize is as simple as
entity::entity_name::Entity::find().count(&db).await.unwrap();
Where entity_name is the name of your table/entity.