Skip to content

Commit

Permalink
Merge pull request #69 from SeaQL/cursor-pagination-new
Browse files Browse the repository at this point in the history
Add cursor pagination
  • Loading branch information
tyt2y3 authored Oct 16, 2022
2 parents 229e929 + 8bbc5fe commit 126a1e3
Show file tree
Hide file tree
Showing 8 changed files with 1,427 additions and 243 deletions.
35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Go to http://localhost:8000/ and try out the following queries:

```graphql
{
film(pagination: { limit: 10, page: 0 }, orderBy: { title: ASC }) {
data {
film(pagination: { pages: { limit: 10, page: 0 } }, orderBy: { title: ASC }) {
nodes {
title
description
releaseYear
Expand All @@ -79,7 +79,7 @@ Go to http://localhost:8000/ and try out the following queries:
```graphql
{
store(filters: { storeId: { eq: 1 } }) {
data {
nodes {
storeId
address {
address
Expand All @@ -98,8 +98,11 @@ Go to http://localhost:8000/ and try out the following queries:

```graphql
{
customer(filters: { active: { eq: 0 } }, pagination: { page: 2, limit: 3 }) {
data {
customer(
filters: { active: { eq: 0 } }
pagination: { pages: { page: 2, limit: 3 } }
) {
nodes {
customerId
lastName
email
Expand All @@ -110,6 +113,28 @@ Go to http://localhost:8000/ and try out the following queries:
}
```

### The query above using cursor pagination

```graphql
{
customer(
filters: { active: { eq: 0 } }
pagination: { cursor: { limit: 3, cursor: "Int[3]:271" } }
) {
nodes {
customerId
lastName
email
}
pageInfo {
hasPreviousPage
hasNextPage
endCursor
}
}
}
```

### Postgres

Setup the [sakila](https://github.com/SeaQL/seaography/blob/main/examples/postgres/sakila-schema.sql) sample database.
Expand Down
Loading

0 comments on commit 126a1e3

Please sign in to comment.