how to encapsulate a general pagination function
I am looking to create a generalized pagination function to simplify the implementation of APIs with pagination capabilities. Here's the code I'm currently using:
However, I'm encountering an issue where the type of
res
is lost.
Is there a way to ensure that the result maintains the original table column types?1 Reply
Yes, you should make the
withPagination
function generic over the query. Like the example in the docs