Is there a way to get count of all items + the results of a query with Prisma without an extra query?
a
Adam
11/18/2020, 10:28 PM
if you have the results don't you know the count?
a
Aaron Fulkerson
11/18/2020, 10:56 PM
Sorry I should have been more specific. If you use take/skip you don't get the full results.
r
Ryan
11/19/2020, 5:31 AM
It wouldn't be possible currently. You would need 2 queries, one for the count and the other for data.
a
Adam
11/19/2020, 4:53 PM
but you can return the cursor that points to the data correct? So could you issue one query, return the cursor and work with that object?
a
Aaron Fulkerson
11/20/2020, 8:41 PM
I noticed that Prisma supports backwards paging but how would I know if I have the first set of results so that I can disable the back button? There's no way of knowing that the first cursor is included in the results, is there?
Aaron Fulkerson
11/20/2020, 8:42 PM
The way I solved it originally was to build an array of cursors so I know where I am when I hit back but with backward paging I can't think of a way to determine if I have the first result in the set.