Pagination using limit & offset
Using offset
and limit
parameters to paginate data is one of the most widely used techniques for pagination.
Clients provide the limit
parameter indicating the number of results they want per page, and the offset
parameter to specify the results to skip.
GraphQLize supports these parameters to paginate via table or view queries. It also supports pagination of nested objects.
Using Limit alone
By using the limit alone, we can restrict the number of results that we want.
The above query returns two actor's details as output.
Using Offset with Limit
Let's assume in the above example we want to view the next two actors. We can achieve it by using offset
along with the limit
.
It returns
note
MySQL doesn't support using the offset
paramater alone.
Paginate Nested Objects
GraphQLize supports using limit
& offset
in the nested objects as well.