8000 GitHub - broady/graphql: Simple low-level GraphQL client for Go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

broady/graphql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql GoDoc

Low-level GraphQL client for Go.

  • Simple, familiar API
  • Respects context.Context timeouts and cancallation
  • Build and execute any kind of GraphQL request
  • Use strong Go types for response data
  • Use variables and upload files
  • Simple error handling
// create a client (safe to share across requests)
ctx := context.Background()
client, err := graphql.NewClient(ctx, "https://machinebox.io/graphql")
if err != nil {
    log.Fatal(err)
}

// make a request
req := graphql.NewRequest(`
    query ($key: String!) {
        items (id:$key) {
            field1
            field2
            field3
        }
    }
`)

// set any variables
req.Var("key", "value")

// run it and capture the response
var respData ResponseStruct
if err := client.Run(ctx, req, &respData); err != nil {
    log.Fatal(err)
}

About

Simple low-level Graph 54B0 QL client for Go

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
0