Skip to content

Commit feb34d4

Browse files
authored
Added support for setting an offset value as part of query options. (aws#102)
Added support for setting an offset value as part of query options which can be used in combination with the existing limit for pagination purposes. The offset is translated to open cypher's SKIP by the resolver. If offset and limit are specified for nested edge queries, the values are translated to open cypher's list slice lower and upper bounds.
1 parent cf01d15 commit feb34d4

17 files changed

+155
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ This release contains new support for Apollo Server integration.
3838

3939
* Support output of zip package of Apollo Server artifacts (([#70](https://github.com/aws/amazon-neptune-for-graphql/pull/70)), ([#72](https://github.com/aws/amazon-neptune-for-graphql/pull/72)), ([#73](https://github.com/aws/amazon-neptune-for-graphql/pull/73)), ([#75](https://github.com/aws/amazon-neptune-for-graphql/pull/75)), ([#76](https://github.com/aws/amazon-neptune-for-graphql/pull/76)))
4040
* Allow filtering using string comparison operators `eq`, `contains`, `startsWith`, `endsWith` (([#100](https://github.com/aws/amazon-neptune-for-graphql/pull/100))
41+
* Added pagination support through the addition of an `offset` argument in query options which can be used in combination with the existing `limit` (([#102](https://github.com/aws/amazon-neptune-for-graphql/pull/102))
42+
4143

4244
### Improvements
4345

src/graphdb.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ function graphDBInferenceSchema (graphbSchema, addMutations) {
290290
// input options
291291
r += `input Options {\n`;
292292
r += `\tlimit:Int\n`;
293+
r += `\toffset:Int\n`;
293294
r += '}\n\n';
294295

295296
r += 'input StringScalarFilters {\n' +

src/schemaModelValidator.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,10 @@ function inferGraphDatabaseDirectives(schemaModel) {
383383
}
384384
});
385385

386-
typesToAdd.push(`input Options {\n limit: Int\n}\n`);
386+
typesToAdd.push('input Options {\n' +
387+
'\tlimit: Int\n' +
388+
'\toffset: Int\n' +
389+
'}\n');
387390
typesToAdd.push('input StringScalarFilters {\n' +
388391
'\teq: String\n' +
389392
'\tcontains: String\n' +

src/test/airports-mutations.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ input RouteInput {
179179

180180
input Options {
181181
limit:Int
182+
offset: Int
182183
}
183184

184185
input StringScalarFilters {

src/test/airports.customized.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ dist: Int
102102

103103
input Options {
104104
limit:Int
105+
offset:Int
105106
}
106107

107108
input StringScalarFilters {

src/test/airports.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ input RouteInput {
101101

102102
input Options {
103103
limit: Int
104+
offset: Int
104105
}
105106

106107
input StringScalarFilters {

src/test/dining.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ type Friends @alias(property: "friends") {
120120

121121
input Options {
122122
limit: Int
123+
offset: Int
123124
}
124125

125126
input StringScalarFilters {

src/test/epl.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type Stadium_edge @alias(property: "STADIUM_EDGE") {
7474

7575
input Options {
7676
limit: Int
77+
offset: Int
7778
}
7879

7980
input StringScalarFilters {

src/test/fraud.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ type Merchant_edge @alias(property: "MERCHANT_EDGE") {
133133

134134
input Options {
135135
limit: Int
136+
offset: Int
136137
}
137138

138139
input StringScalarFilters {

src/test/knowledge.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ type Written_by @alias(property: "written_by") {
148148

149149
input Options {
150150
limit: Int
151+
offset: Int
151152
}
152153

153154
input StringScalarFilters {

0 commit comments

Comments
 (0)