yii2-graphql icon indicating copy to clipboard operation
yii2-graphql copied to clipboard

How can we paginate data?

Open imanilchaudhari opened this issue 5 years ago • 1 comments

How can we paginate data?

Can you describe it in the documentation?

imanilchaudhari avatar May 17 '19 12:05 imanilchaudhari

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

sganz avatar May 17 '19 17:05 sganz