mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-13 00:48:37 +00:00
Update documentation.
This commit is contained in:
@@ -21,9 +21,8 @@ Therefore, I present you the simple client to which you can copy & paste your gr
|
||||
## Features
|
||||
|
||||
* Executing GraphQL queries as they are, without types declaration
|
||||
* Compressing produced queries
|
||||
* HTTP2 support!
|
||||
* Support for additional headers
|
||||
* Support for gzip compression ( built into Hasura )
|
||||
|
||||
## Usage example
|
||||
|
||||
@@ -56,16 +55,15 @@ var query = `query searchFileKnown($fileHash: String) {
|
||||
violence
|
||||
virus
|
||||
}
|
||||
}`
|
||||
result, err := Query(query, variables, nil)
|
||||
}
|
||||
|
||||
graphql := NewConnection()
|
||||
result, err := graphql.Query(query, variables, nil)
|
||||
if err != nil {
|
||||
fmt.Println("Query error", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(result)
|
||||
`
|
||||
result := Query(query, variables, headers)
|
||||
fmt.Println(result)
|
||||
```
|
||||
|
||||
**Result**
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/lukaszraczylo/go-simple-graphql/pkg/logging"
|
||||
@@ -49,8 +50,9 @@ func NewConnection() *GraphQL {
|
||||
return &GraphQL{
|
||||
Endpoint: pickGraphqlEndpoint(),
|
||||
HttpClient: &http.Client{
|
||||
Timeout: time.Second * 10,
|
||||
Transport: &http2.Transport{
|
||||
DisableCompression: true,
|
||||
DisableCompression: false,
|
||||
AllowHTTP: true,
|
||||
DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
|
||||
return net.Dial(network, addr)
|
||||
|
||||
Reference in New Issue
Block a user