Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
graphql
✓ github.com/machinebox/graphql
Execute a GraphQL query
package main
import (
"context"
"fmt"
"github.com/machinebox/graphql"
)
func main() {
client := graphql.NewClient("https://example.com/graphql")
req := graphql.NewRequest(`
query {
user(id: "1") {
name
}
}
`)
var resp struct {
User struct {
Name string
} `json:"user"`
}
if err := client.Run(context.Background(), req, &resp); err != nil {
panic(err)
}
fmt.Println(resp.User.Name)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.2.2latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.