Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cursor pagination #69

Merged
merged 11 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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