在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):machinebox/graphql开源软件地址(OpenSource Url):https://github.com/machinebox/graphql开源编程语言(OpenSource Language):Go 100.0%开源软件介绍(OpenSource Introduction):graphqlLow-level GraphQL client for Go.
InstallationMake sure you have a working Go environment. To install graphql, simply run:
Usageimport "context"
// create a client (safe to share across requests)
client := graphql.NewClient("https://machinebox.io/graphql")
// make a request
req := graphql.NewRequest(`
query ($key: String!) {
items (id:$key) {
field1
field2
field3
}
}
`)
// set any variables
req.Var("key", "value")
// set header fields
req.Header.Set("Cache-Control", "no-cache")
// define a Context for the request
ctx := context.Background()
// run it and capture the response
var respData ResponseStruct
if err := client.Run(ctx, req, &respData); err != nil {
log.Fatal(err)
} File support via multipart form dataBy default, the package will send a JSON body. To enable the sending of files, you can opt to
use multipart form data instead using the
For more information, read the godoc package documentation or the blog post. ThanksThanks to Chris Broadfoot for design help. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论