Boolean represents true or false values.
type Boolean bool
func NewBoolean(v Boolean) *Boolean
NewBoolean is a helper to make a new *Boolean.
Client is a GraphQL client.
type Client struct {
// contains filtered or unexported fields
}
func NewClient(url string, httpClient *http.Client) *Client
NewClient creates a GraphQL client targeting the specified GraphQL server URL. If httpClient is nil, then http.DefaultClient is used.
func (c *Client) Mutate(ctx context.Context, m any, variables map[string]any) error
Mutate executes a single GraphQL mutation request, with a mutation derived from m, populating the response into it. Argument m should be a pointer to struct that corresponds to the GraphQL schema.
func (c *Client) MutateNamed(ctx context.Context, queryName string, m any, variables map[string]any) error
MutateNamed is the same as Mutate but allows a name to be specified for the mutation.
func (c *Client) Query(ctx context.Context, q any, variables map[string]any) error
Query executes a single GraphQL query request, with a query derived from q, populating the response into it. Argument q should be a pointer to struct that corresponds to the GraphQL schema.
func (c *Client) QueryNamed(ctx context.Context, queryName string, q any, variables map[string]any) error
QueryNamed is the same as Query but allows a name to be specified for the query.
Errors represents the "errors" array in a response from a GraphQL server. If returned via error interface, the slice is expected to contain at least 1 element.
Specification: https://spec.graphql.org/October2021/#sec-Errors.
type Errors []struct { Message string Locations []struct { Line int Column int } Path []any Extensions map[string]any Type string }
func (e Errors) Error() string
Error implements error interface.
Float represents signed double-precision fractional values as specified by IEEE 754.
type Float float64
func NewFloat(v Float) *Float
NewFloat is a helper to make a new *Float.
ID represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.
type ID any
func NewID(v ID) *ID
NewID is a helper to make a new *ID.
Int represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
type Int int32
func NewInt(v Int) *Int
NewInt is a helper to make a new *Int.
String represents textual data as UTF-8 character sequences. This type is most often used by GraphQL to represent free-form human-readable text.
type String string
func NewString(v String) *String
NewString is a helper to make a new *String.