-
Notifications
You must be signed in to change notification settings - Fork 54
Paginate query results
Igor Dianov edited this page May 29, 2024
·
2 revisions
GraphQL does not specify any language or idioms for performing Pagination. This library provides support for pageable queries with page argument on pluralized query wrapper. Tha page start is 1-based, i.e. provide 1 as value for start parameter to request the first page with the number of records in the limit argument value.
This allows you to query for the "Page" version of any Entity, and return page metadata i.e. pages and total records count with the select data.
{
Books(page: {start: 1, limit: 3}) {
pages
total
select {
id
title
}
}
}
{
"data": {
"Books": {
"pages": 2,
"total": 5,
"select": [
{
"id": 2,
"title": "War and Peace"
},
{
"id": 3,
"title": "Anna Karenina"
},
{
"id": 5,
"title": "The Cherry Orchard"
}
]
}
}
}