Having an issue when executing a paginated query with Hasura graphql Go client github.com/hasura/go-graphql-client
but haven’t found the answer in the docs. The graphql query is as follows (simplified it for this question):
query ($after: String) {
entity (first: 10, after: $after) {
pageInfo {
hasNextPage
endCursor
}
nodes {
name
}
}
}
The Go code
type Query struct {
Entity struct {
PageInfo struct {
HasNextPage bool `graphql:"hasNextPage"`
EndCursor string `graphql:"endCursor"`
} `graphql:"pageInfo"`
Nodes []struct {
Name string `graphql:"name"`
} `graphql:"nodes`
} `graphql:"entity(first: 10, after: $after)"`
}
var q Query
var after string = ""
var hasNextPage bool = true
variables := map[string]interface{}{
"after": after,
}
err := client.Query(context.Background(), &q, variables)
The thing is that I don’t know how to declare the $after variable and when executed it throws an error
"Failed to parse "String": EOF while parsing a value at line 1 column 0"
Anyone can help with the issue? Thanks in advance.