Skip to content

I want to get both count and rows, can I clone a query? #368

Answered by billy1624
lz1998 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @lz1998, you could use paginator to do both without cloning the query.

  • Set the page size with .paginate() and offset it with .fetch_page()
  • Count number of rows by calling .num_items()

https://docs.rs/sea-orm/0.4.1/sea_orm/struct.Paginator.html

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tyt2y3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants