shurcooL / githubv4

Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql).
MIT License
1.11k stars 89 forks source link

null cursor support, not "null" #33

Closed baishuai closed 6 years ago

baishuai commented 6 years ago

Thanks for this work.

I want to get the first connection page with the after cursor is null, and then get rest of connection pages by the cursor in previous page info.

I don't know how to set the argument after as null. The type of cursor in graphql is string. I can set string with value "null", but not null.

type query struct {
    Repository struct {
        Name        githubql.String
        Description githubql.String
        CreatedAt   githubql.DateTime
        Issues struct {
            TotalCount githubql.Int
            Nodes    []Issue
            PageInfo PageInfo
        } `graphql:"issues(first: 100, after: $after)"`
    } `graphql:"repository(owner: $owner, name: $name)"`
}
variables := map[string]interface{}{
    "owner":  githubql.String("someone"),
    "name":   githubql.String("myreponame"),
    "labels": []githubql.String{"alabel"},
    "after":  githubql.String("null"),
}

help wanted.

baishuai commented 6 years ago

sorry, i find the solution in readme