Documentation ¶
Overview ¶
Package graphql provides a GraphQL client implementation.
For more information, see package github.com/shurcooL/githubv4, which is a specialized version targeting GitHub GraphQL API v4. That package is driving the feature development.
For now, see README for more details.
Index ¶
- type Boolean
- type Client
- func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) (*Result, error)
- func (c *Client) MutateString(ctx context.Context, m string, variables map[string]interface{}, v interface{}) (*Result, error)
- func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) (*Result, error)
- func (c *Client) QueryString(ctx context.Context, q string, variables map[string]interface{}, v interface{}) (*Result, error)
- type Float
- type GraphQL
- type ID
- type Int
- type OpErrors
- type Result
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Boolean ¶
type Boolean bool
Boolean represents true or false values.
func NewBoolean ¶
NewBoolean is a helper to make a new *Boolean.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a GraphQL client.
func NewClient ¶
NewClient creates a GraphQL client targeting the specified GraphQL server URL. If httpClient is nil, then http.DefaultClient is used.
func (*Client) Mutate ¶
func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) (*Result, error)
Mutate executes a single GraphQL mutation request, with a mutation derived from m, populating the response into it. m should be a pointer to struct that corresponds to the GraphQL schema.
func (*Client) MutateString ¶
func (c *Client) MutateString(ctx context.Context, m string, variables map[string]interface{}, v interface{}) (*Result, error)
MutateString executes a single GraphQL mutation request, using the given raw query `m` and populating the response into it. `m` should be a correct GraphQL mutation request string that corresponds to the GraphQL schema.
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) (*Result, error)
Query executes a single GraphQL query request, with a query derived from q, populating the response into it. q should be a pointer to struct that corresponds to the GraphQL schema.
func (*Client) QueryString ¶
func (c *Client) QueryString(ctx context.Context, q string, variables map[string]interface{}, v interface{}) (*Result, error)
QueryString executes a single GraphQL query request, using the given raw query `q` and populating the response into the `v`. `q` should be a correct GraphQL query request string that corresponds to the GraphQL schema.
type Float ¶
type Float float64
Float represents signed double-precision fractional values as specified by IEEE 754.
type GraphQL ¶
type GraphQL interface { QueryString(ctx context.Context, q string, variables map[string]interface{}, v interface{}) (*Result, error) Query(ctx context.Context, q interface{}, variables map[string]interface{}) (*Result, error) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) (*Result, error) MutateString(ctx context.Context, m string, variables map[string]interface{}, v interface{}) (*Result, error) }
type ID ¶
type ID interface{}
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 Int ¶
type Int int32
Int represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
type OpErrors ¶
OpErrors 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://facebook.github.io/graphql/#sec-Errors.
Directories ¶
Path | Synopsis |
---|---|
example
|
|
graphqldev
graphqldev is a test program currently being used for developing graphql package.
|
graphqldev is a test program currently being used for developing graphql package. |
Package ident provides functions for parsing and converting identifier names between various naming convention.
|
Package ident provides functions for parsing and converting identifier names between various naming convention. |
internal
|
|
jsonutil
Package jsonutil provides a function for decoding JSON into a GraphQL query data structure.
|
Package jsonutil provides a function for decoding JSON into a GraphQL query data structure. |
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |