mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-20 01:36:57 +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
|
## Features
|
||||||
|
|
||||||
* Executing GraphQL queries as they are, without types declaration
|
* Executing GraphQL queries as they are, without types declaration
|
||||||
* Compressing produced queries
|
* HTTP2 support!
|
||||||
* Support for additional headers
|
* Support for additional headers
|
||||||
* Support for gzip compression ( built into Hasura )
|
|
||||||
|
|
||||||
## Usage example
|
## Usage example
|
||||||
|
|
||||||
@@ -56,16 +55,15 @@ var query = `query searchFileKnown($fileHash: String) {
|
|||||||
violence
|
violence
|
||||||
virus
|
virus
|
||||||
}
|
}
|
||||||
}`
|
}
|
||||||
result, err := Query(query, variables, nil)
|
|
||||||
|
graphql := NewConnection()
|
||||||
|
result, err := graphql.Query(query, variables, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Query error", err)
|
fmt.Println("Query error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Println(result)
|
fmt.Println(result)
|
||||||
`
|
|
||||||
result := Query(query, variables, headers)
|
|
||||||
fmt.Println(result)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Result**
|
**Result**
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/lukaszraczylo/go-simple-graphql/pkg/logging"
|
"github.com/lukaszraczylo/go-simple-graphql/pkg/logging"
|
||||||
@@ -49,8 +50,9 @@ func NewConnection() *GraphQL {
|
|||||||
return &GraphQL{
|
return &GraphQL{
|
||||||
Endpoint: pickGraphqlEndpoint(),
|
Endpoint: pickGraphqlEndpoint(),
|
||||||
HttpClient: &http.Client{
|
HttpClient: &http.Client{
|
||||||
|
Timeout: time.Second * 10,
|
||||||
Transport: &http2.Transport{
|
Transport: &http2.Transport{
|
||||||
DisableCompression: true,
|
DisableCompression: false,
|
||||||
AllowHTTP: true,
|
AllowHTTP: true,
|
||||||
DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
|
DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
|
||||||
return net.Dial(network, addr)
|
return net.Dial(network, addr)
|
||||||
|
|||||||
Reference in New Issue
Block a user