Documentation
¶
Index ¶
- Variables
- type Body
- type Error
- func (err Error) Error() string
- func (err Error) ExtensionBool(key string) (bool, bool)
- func (err Error) ExtensionEqualBool(key string, value bool) bool
- func (err Error) ExtensionEqualInt(key string, value int) bool
- func (err Error) ExtensionEqualString(key, value string) bool
- func (err Error) ExtensionFloat64(key string) (float64, bool)
- func (err Error) ExtensionInt(key string) (int, bool)
- func (err Error) ExtensionString(key string) (string, bool)
- func (err Error) ExtensionUnmarshal(key string, in any) error
- func (err Error) Unwrap() []error
- type ErrorEntry
- func (entry ErrorEntry) Error() string
- func (entry ErrorEntry) ExtensionBool(key string) (bool, bool)
- func (entry ErrorEntry) ExtensionFloat64(key string) (float64, bool)
- func (entry ErrorEntry) ExtensionInt(key string) (int, bool)
- func (entry ErrorEntry) ExtensionString(key string) (string, bool)
- func (entry ErrorEntry) ExtensionUnmarshal(key string, in any) error
- type HttpClient
- type HttpClientOpts
- type Location
- type ProtoClient
- type Response
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrExtensionNotFound = errors.New("extension not found")
)
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error []ErrorEntry
https://spec.graphql.org/draft/#sec-Errors
Example ¶
err := Error{
{
Message: "entry with incorrect type",
Extensions: map[string]json.RawMessage{
"featureA": json.RawMessage(`"true"`),
},
},
{
Message: "entry with correct type",
Extensions: map[string]json.RawMessage{
"featureA": json.RawMessage("true"),
},
},
}
fmt.Println(err.Error())
Output: entry with incorrect type entry with correct type
func (Error) ExtensionEqualString ¶
type ErrorEntry ¶
type ErrorEntry struct {
Message string `json:"message"`
Path []string `json:"path"`
Locations []Location `json:"locations"`
Extensions map[string]json.RawMessage `json:"extensions"`
}
func (ErrorEntry) Error ¶
func (entry ErrorEntry) Error() string
func (ErrorEntry) ExtensionBool ¶
func (entry ErrorEntry) ExtensionBool(key string) (bool, bool)
func (ErrorEntry) ExtensionFloat64 ¶
func (entry ErrorEntry) ExtensionFloat64(key string) (float64, bool)
func (ErrorEntry) ExtensionInt ¶
func (entry ErrorEntry) ExtensionInt(key string) (int, bool)
func (ErrorEntry) ExtensionString ¶
func (entry ErrorEntry) ExtensionString(key string) (string, bool)
func (ErrorEntry) ExtensionUnmarshal ¶
func (entry ErrorEntry) ExtensionUnmarshal(key string, in any) error
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(url string, opts ...HttpClientOpts) HttpClient
NewHttpClient creates a new HttpClient for graphqlclientgen clients
type HttpClientOpts ¶
type HttpClientOpts func(*HttpClient)
func WithHttpClient ¶
func WithHttpClient(c *http.Client) HttpClientOpts
WithHttpClient sets a custom http.Client for HttpClient
type Response ¶
type Response struct {
Data json.RawMessage `json:"data"`
Errors *Error `json:"errors"`
}
Click to show internal directories.
Click to hide internal directories.