Skip to content

Question: Example of doing pagination (especially on nested resources that are paginated) #69

@rocktavious

Description

@rocktavious

I'm working with a graphQL API that has a top level resource that has several fields in it that are paginated themselves - something like

{
  account {
    services(after: "", first: 10) {
      nodes {
        tools(after: "", first: 2) {
          nodes {
            category
          }
          pageInfo {
            endCursor
            hasNextPage
          }
        }
        tags(after: "", first: 2) {
          nodes {
            key
            value
          }
          pageInfo {
            endCursor
            hasNextPage
          }
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

and its unclear to me how to properly handle pagination of these nested tools and tags resources. I understand how the pageInfo object's endCursor and hasNextPage fields work and how to use them with the argument to after to query the next page of data but its unclear to me the proper pattern to use in go code when using this graphql framework.

I would love if anyone has links to example code query-ing nested pagination or blog posts talking about how to do pagination with this framework.

Thanks! Love the framework so far!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions