Documentation
¶
Index ¶
Constants ¶
const ( ContentTypeJSON = "application/json" ContentTypeGraphQL = "application/graphql" ContentTypeFormURLEncoded = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Schema *graphql.Schema
Pretty bool
GraphiQL bool
Playground bool
PlaygroundConfig *PlaygroundConfig
RootObjectFn RootObjectFn
ResultCallbackFn ResultCallbackFn
FormatErrorFn func(err error) gqlerrors.FormattedError
}
type Handler ¶
func (*Handler) ContextHandler ¶
ContextHandler provides an entrypoint into executing graphQL queries with a user-provided context.
type PlaygroundConfig ¶ added in v0.3.0
type RequestOptions ¶
type RequestOptions struct {
Query string `json:"query" url:"query" schema:"query"`
Variables map[string]interface{} `json:"variables" url:"variables" schema:"variables"`
OperationName string `json:"operationName" url:"operationName" schema:"operationName"`
}
func NewRequestOptions ¶
func NewRequestOptions(r *http.Request) *RequestOptions
RequestOptions Parses a http.Request into GraphQL request options struct
type ResultCallbackFn ¶ added in v0.2.2
type ResultCallbackFn func(ctx context.Context, params *graphql.Params, result *graphql.Result, responseBody []byte)
ResultCallbackFn is called after a JSON response is written, with the request's params, the result and the encoded body passed to Write. It is not called when GraphiQL or Playground is served instead. For a mutation rejected because of the request's method or content type, nothing is executed and params.RootObject is nil, since RootObjectFn does not run.