How do I paginate results with gqlgen in Go?

This guide explains how to paginate results using gqlgen in Go, enabling you to efficiently handle large datasets by breaking them down into smaller, more manageable chunks.
gqlgen, Go, pagination, GraphQL, API

type Query {
    items(first: Int, after: String): ItemConnection!
}

type ItemConnection {
    edges: [ItemEdge!]!
    pageInfo: PageInfo!
}

type ItemEdge {
    cursor: String!
    node: Item!
}

type PageInfo {
    hasNextPage: Boolean!
    endCursor: String
}

type Item {
    id: ID!
    name: String!
}
    

gqlgen Go pagination GraphQL API