Gadi
Gadi

Reputation: 1629

What is the recommended way to paginate using SPQR?

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.

Upvotes: 1

Views: 707

Answers (1)

Gadi
Gadi

Reputation: 1629

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.

Upvotes: 2

Related Questions