mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-12 00:45:31 +00:00
* Replaced strutil.Md5 with crypto/md5 and encoding/hex to reduce dependency and potential allocations. * Move to improved logging library. * fixup! Move to improved logging library.
47 lines
966 B
Go
47 lines
966 B
Go
package gql
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
cache "github.com/lukaszraczylo/go-simple-graphql/cache"
|
|
logging "github.com/lukaszraczylo/go-simple-graphql/logging"
|
|
)
|
|
|
|
type BaseClient struct {
|
|
cache *cache.Cache
|
|
Logger *logging.Logger
|
|
client *http.Client
|
|
endpoint string
|
|
responseType string
|
|
retries_delay time.Duration
|
|
retries_number int
|
|
MaxGoRoutines int
|
|
cache_global bool
|
|
retries_enable bool
|
|
}
|
|
|
|
type Query struct {
|
|
Variables map[string]interface{} `json:"variables,omitempty"`
|
|
Query string `json:"query,omitempty"`
|
|
JsonQuery []byte `json:"jsonQuery,omitempty"`
|
|
}
|
|
|
|
type QueryExecutor struct {
|
|
Result any
|
|
Error error
|
|
*BaseClient
|
|
Headers map[string]interface{}
|
|
CacheKey string
|
|
Query []byte
|
|
CacheTTL time.Duration
|
|
Retries bool
|
|
}
|
|
|
|
type queryResults struct {
|
|
Data interface{} `json:"data"`
|
|
Errors []struct {
|
|
Message interface{} `json:"message"`
|
|
} `json:"errors"`
|
|
}
|