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/Laisky/graphql
Creates a GraphQL client, sends a query with variables, and decodes the response.
package main
import (
"context"
"fmt"
"github.com/Laisky/graphql"
)
func main() {
client := graphql.NewClient("https://example.com/graphql")
var resp struct {
User struct {
Name string
}
}
req := graphql.NewRequest(`
query ($id: ID!) {
user(id: $id) {
name
}
}
`)
req.Var("id", "123")
if err := client.Run(context.Background(), req, &resp); err != nil {
fmt.Println(err)
return
}
fmt.Println(resp.User.Name)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.0.6latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.