1

Building a graphQL API with SQPR. I have a large data collections and would like to load data page by page. What is the recommended way to do this with SQPR and how would it look from the client side (query)?

Also, keeping in mind Apollo client for angular as a potential client library. Now testing with graphiql.

Gadi
  • 1,539
  • 22
  • 37

1 Answers1

2

ended up using this

@GraphQLQuery(name = "projects", description = "Return a paginated Projects results")
public List<Project> getAll(
        @GraphQLArgument(name = "offset",defaultValue = "0", description = "Offset item from beginning of data") int offset,
        @GraphQLArgument(name = "limit", defaultValue = "10", description = "Limit the size of fetched results") int limit
) { ... }

if anyone can comment or add a different solution...

G.

Gadi
  • 1,539
  • 22
  • 37
  • Your approach is perfectly fine. See my answer [here](https://stackoverflow.com/a/44589353/294657) for some more general ideas on pagination and SPQR helpers. Especially if you're interested in supporting the Connection spec. – kaqqao Jan 02 '19 at 10:33