Skip to content

Commit 6fce96e

Browse files
committed
updated docs
1 parent 09bed07 commit 6fce96e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

doc.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Package graphql provides a low level GraphQL client.
2-
//
3-
// ctx := context.Background()
4-
// ctx = graphql.NewContext(ctx, "https://machinebox.io/graphql")
5-
// r := graphql.NewRequest(`
2+
// // make a request
3+
// req := graphql.NewRequest(`
64
// query ($key: String!) {
75
// items (id:$key) {
86
// field1
@@ -11,9 +9,17 @@
119
// }
1210
// }
1311
// `)
14-
// r.Var("key", "value")
12+
//
13+
// // set any variables
14+
// req.Var("key", "value")
15+
//
16+
// // get a context
17+
// ctx := context.Background()
18+
// ctx := graphql.NewContext(ctx, "https://machinebox.io/graphql")
19+
//
20+
// // run it and capture the response
1521
// var respData ResponseStruct
16-
// if err := r.Run(ctx, &respData); err != nil {
22+
// if err := req.Run(ctx, &respData); err != nil {
1723
// log.Fatalln(err)
1824
// }
1925
package graphql

0 commit comments

Comments
 (0)