从Golang应用程序中使用GraphQL服务

I have a Go Application that needs to consume a GraphQL service, now the documentation of graphQL is more oriented to the GraphQL server and not as a client. How can I do that?

I checked this example but some things are not clear to me:

  • Should I have a Resolve function to each field that I am going to retrieve?
  • Should I have defined the variable 'fields' with the data structure that I am expecting?
  • Where can I find a very simple example of a GraphQL client in Golang?

You should check this project: https://github.com/machinebox/graphql .

If you don't want to use an external library inside in your project, you could look the code and see how can you implement a simple client.