Documentation ¶
Index ¶
- func Exec(serveGraphQL ServeGraphQLFunc, ctx context.Context, result interface{}, ...) error
- func GetSchema(serveGraphQL ServeGraphQLFunc) (*schema.Schema, error)
- func GetSchemaIntrospectionJSON(serveGraphQL ServeGraphQLFunc) ([]byte, error)
- type Engine
- func (engine *Engine) Exec(ctx context.Context, result interface{}, query string, args ...interface{}) error
- func (engine *Engine) Execute(request *EngineRequest) (ResponseStream, error)deprecated
- func (engine *Engine) ExecuteOne(request *EngineRequest) *EngineResponsedeprecated
- func (engine *Engine) GetSchemaIntrospectionJSON() ([]byte, error)
- func (engine *Engine) ServeGraphQL(request *Request) *Response
- func (engine *Engine) ServeGraphQLStream(request *Request) ResponseStream
- type EngineRequestdeprecated
- type EngineResponsedeprecated
- type Error
- type ErrorList
- type Handler
- type Request
- type Response
- type ResponseStream
- type ServeGraphQLFunc
- type ServeGraphQLStreamFunc
- type StreamingHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
func Exec(serveGraphQL ServeGraphQLFunc, ctx context.Context, result interface{}, query string, args ...interface{}) error
func GetSchemaIntrospectionJSON ¶
func GetSchemaIntrospectionJSON(serveGraphQL ServeGraphQLFunc) ([]byte, error)
Types ¶
type Engine ¶
type Engine struct { Schema *schema.Schema MaxDepth int MaxParallelism int Tracer trace.Tracer Logger log.Logger Resolver resolvers.Resolver Root interface{} // Validate can be set to nil to disable validation. Validate func(doc *schema.QueryDocument, maxDepth int) error // OnRequest is called after the query is parsed but before the request is validated. OnRequestHook func(request *Request, doc *schema.QueryDocument, op *schema.Operation) error TryCast func(value reflect.Value, toType string) (v reflect.Value, ok bool) }
func CreateEngine ¶
func (*Engine) Execute
deprecated
func (engine *Engine) Execute(request *EngineRequest) (ResponseStream, error)
Deprecated: use ServeGraphQLStream instead.
func (*Engine) ExecuteOne
deprecated
func (engine *Engine) ExecuteOne(request *EngineRequest) *EngineResponse
Deprecated: use ServeGraphQL instead.
func (*Engine) GetSchemaIntrospectionJSON ¶
func (*Engine) ServeGraphQL ¶
func (*Engine) ServeGraphQLStream ¶
func (engine *Engine) ServeGraphQLStream(request *Request) ResponseStream
type EngineRequest
deprecated
type EngineRequest = Request
Deprecated: use Request instead
type EngineResponse
deprecated
type EngineResponse = Response
Deprecated: use Response instead
type Request ¶
type Request struct { // Optional Context to use on the request. Required if caller wants to cancel long-running \ // operations like subscriptions. Context context.Context `json:"-"` // Query is the graphql query document to execute Query string `json:"query,omitempty"` // OperationName is the name of the operation in the query document to execute OperationName string `json:"operationName,omitempty"` // Variables can be set to a json.RawMessage or a map[string]interface{} Variables interface{} `json:"variables,omitempty"` }
func (Request) GetContext ¶
func (*Request) VariablesAsJson ¶
func (r *Request) VariablesAsJson() (json.RawMessage, error)
func (*Request) VariablesAsMap ¶
type Response ¶
type Response struct { Data json.RawMessage `json:"data,omitempty"` Errors ErrorList `json:"errors,omitempty"` Extensions interface{} `json:"extensions,omitempty"` Details map[string]interface{} `json:"-"` }
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.
func NewResponse ¶
func NewResponse() *Response
type ResponseStream ¶
type ResponseStream = <-chan *Response
func NewErrStream ¶
func NewErrStream(err error) ResponseStream
type ServeGraphQLFunc ¶
func (ServeGraphQLFunc) ServeGraphQL ¶
func (f ServeGraphQLFunc) ServeGraphQL(request *Request) *Response
type ServeGraphQLStreamFunc ¶
type ServeGraphQLStreamFunc func(request *Request) ResponseStream
func (ServeGraphQLStreamFunc) ServeGraphQL ¶
func (f ServeGraphQLStreamFunc) ServeGraphQL(request *Request) *Response
func (ServeGraphQLStreamFunc) ServeGraphQLStream ¶
func (f ServeGraphQLStreamFunc) ServeGraphQLStream(request *Request) ResponseStream
type StreamingHandler ¶
type StreamingHandler interface {
ServeGraphQLStream(request *Request) ResponseStream
}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
example/starwars
Package starwars provides a example schema and resolver based on Star Wars characters.
|
Package starwars provides a example schema and resolver based on Star Wars characters. |
generator
This whole directory is used to generate the assets_vfsdata.go file.
|
This whole directory is used to generate the assets_vfsdata.go file. |
introspection
retrospection converts from an introspection result to a Schema
|
retrospection converts from an introspection result to a Schema |
scanner
Package scanner provides a scanner and tokenizer for UTF-8-encoded text.
|
Package scanner provides a scanner and tokenizer for UTF-8-encoded text. |
Most of this file was reused from the ecoding/json package, since we want to use the same json encoding.
|
Most of this file was reused from the ecoding/json package, since we want to use the same json encoding. |
Click to show internal directories.
Click to hide internal directories.