Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID string
ID represents GraphQL's "ID" type. A custom type may be used instead.
func (ID) ImplementsGraphQLType ¶
func (ID) MarshalJSON ¶
func (*ID) UnmarshalGraphQL ¶
type Response ¶
type Response struct { Data json.RawMessage `json:"data,omitempty"` Errors []*errors.QueryError `json:"errors,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` }
Response represents a typical response of a GraphQL server. It may be encoded to JSON directly or it may be further processed to a custom response type, for example to include custom error data.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema represents a GraphQL schema with an optional resolver.
func MustParseSchema ¶
MustParseSchema calls ParseSchema and panics on error.
func ParseSchema ¶
ParseSchema parses a GraphQL schema and attaches the given root resolver. It returns an error if the Go type signature of the resolvers does not match the schema. If nil is passed as the resolver, then the schema can not be executed, but it may be inspected (e.g. with ToJSON).
func (*Schema) Exec ¶
func (s *Schema) Exec(ctx context.Context, queryString string, operationName string, variables map[string]interface{}) *Response
Exec executes the given query with the schema's resolver. It panics if the schema was created without a resolver. If the context get cancelled, no further resolvers will be called and a the context error will be returned as soon as possible (not immediately).
func (*Schema) Inspect ¶
func (s *Schema) Inspect() *introspection.Schema
Inspect allows inspection of the given schema.
type SchemaOpt ¶
type SchemaOpt func(*Schema)
SchemaOpt is an option to pass to ParseSchema or MustParseSchema.
func Logger ¶
Logger is used to log panics durring query execution. It defaults to exec.DefaultLogger.
func MaxParallelism ¶
MaxParallelism specifies the maximum number of resolvers per request allowed to run in parallel. The default is 10.
type Time ¶
Time is a custom GraphQL type to represent an instant in time. It has to be added to a schema via "scalar Time" since it is not a predeclared GraphQL type like "ID".