yii2-graphql
yii2-graphql copied to clipboard
How can we paginate data?
How can we paginate data?
Can you describe it in the documentation?
Generally that's up to you. In some cases I create 2 new parameters, one is called Offset
and the other is Limit
. These are controlled by the GraphQL query and if found they get mapped to your SQL (or what ever is providing data). So if you see either or both in the incoming GQL query, you deal with it as needed, but this is all up to you to handle as far as I know.
For SQL backed queries not too bad as mentioned, but in some cases I have data that is not and it's basically sift and limit the data based on the 2 new query params passed by the user IF they exist.
Sandy