Closed davidoram closed 5 years ago
@davidoram Thanks for asking. Aliases are supported, but I haven't documented them yet (see #22). I hope to fix that soon.
The answer is as follows. A GraphQL query like this:
query {
aliasGoesHere: repository(owner: "golang", name: "go") {
nameWithOwner
description
}
}
Would be implemented with the following Go query struct:
var query struct {
AliasGoesHere struct {
NameWithOwner string
Description string
} `graphql:"aliasGoesHere: repository(owner: \"golang\", name: \"go\")"`
}
Basically, you just put the alias prefix at the beginning of the graphql
tag. Let me know if that makes sense.
Hi, I'm trying to figure out how to encode GraphQL aliases (https://graphql.github.io/learn/queries/#aliases) using this library.
I'm trying to encode something like this query:
.. in particular I haven't figured out how to encode the
tags: refs
alias as a go struct with the appropriategraphql
struct tag?