Skip to content

Commit e9d0535

Browse files
authored
chore: rename to operations.graphql to be consistent (#48)
1 parent c561bc2 commit e9d0535

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

dbquery/pagination/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,27 @@ To retrieve the first page of a result, the operation is called with `after` omi
4040
Subsequent pages can then be retrieved by setting `after` to the value of `endCursor` from `pageInfo` from the previous request. `first` should be set to the value used in the first request.
4141

4242
This is continued until `hasNextPage` is `false`.
43+
44+
## Try it out!
45+
46+
Deploy the schema from `dbquery/pagination` relative to the repository's root directory:
47+
48+
```
49+
stepzen deploy
50+
```
51+
52+
Run the [sample operations](operations.graphql):
53+
54+
Fetch the first five records:
55+
56+
```
57+
stepzen request -f operations.graphql --operation-name=Customers --var first=5
58+
```
59+
60+
Fetch the next five, the value of `after` is taken from the `endCursor` field of the previous request:
61+
62+
```
63+
stepzen request -f operations.graphql --operation-name=Customers --var first=5 --var after="eyJjIjoiTDpRdWVyeTpjdXN0b21lcnMiLCJvIjo0fQ=="
64+
```
65+
66+

dbquery/pagination/requests.graphql renamed to dbquery/pagination/operations.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Page through customers from a database connection based pagination
2-
query CustomersConnectionBased($first: Int!, $after: String = "") {
2+
query Customers($first: Int!, $after: String = "") {
33
customers(first: $first, after: $after) {
44
edges {
55
node {

dbquery/pagination/tests/Test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const {
88

99
testDescription = getTestDescription("snippets", __dirname);
1010

11-
const requestsFile = path.join(path.dirname(__dirname), "requests.graphql");
11+
const requestsFile = path.join(path.dirname(__dirname), "operations.graphql");
1212
const requests = fs.readFileSync(requestsFile, "utf8").toString();
1313

1414
describe(testDescription, function () {
@@ -18,7 +18,7 @@ describe(testDescription, function () {
1818
{
1919
label: "first set of results",
2020
query: requests,
21-
operationName: "CustomersConnectionBased",
21+
operationName: "Customers",
2222
variables: {
2323
first: 2
2424
},
@@ -49,7 +49,7 @@ describe(testDescription, function () {
4949
{
5050
label: "next set of results",
5151
query: requests,
52-
operationName: "CustomersConnectionBased",
52+
operationName: "Customers",
5353
variables: {
5454
first: 2,
5555
after: CURSOR

0 commit comments

Comments
 (0)