exec
API reference for the exec package, generated from Go doc comments.
import "github.com/grx-gql/grx/exec"Package exec contains the GraphQL lexer, parser, AST, executor, and introspection fast-path. It is the hot per-request execution path and is deliberately transport-agnostic: callers communicate with the executor through [core.Request] and [core.Response].
Index
- Variables
- type Executor
- func New(schemaValue *schema.Schema, pluginList []plugins.Plugin) *Executor
- func (e *Executor) Execute(ctx context.Context, req core.Request) core.Response
- func (e *Executor) OperationKind(req core.Request) (core.OperationKind, error)
- func (e *Executor) Subscribe(ctx context.Context, req core.Request) (<-chan core.Response, error)
Variables
ErrSubscriptionOperation
ErrSubscriptionOperation is returned by Executor.Execute when the document defines a subscription operation. Subscriptions must be run through Executor.Subscribe so callers receive a streaming channel.
var ErrSubscriptionOperation = errors.New("subscription operations must use the streaming Subscribe entry point")type Executor
Executor runs GraphQL operations against a built [schema.Schema] and notifies the registered plugins at each lifecycle phase. It satisfies [core.Executor] and is safe for concurrent use.
type Executor struct {
Schema *schema.Schema
Plugins []plugins.Plugin
}func New
func New(schemaValue *schema.Schema, pluginList []plugins.Plugin) *ExecutorNew returns an Executor bound to schemaValue and pluginList. pluginList may be nil; an Executor with no plugins simply skips the lifecycle notifications.
func (*Executor) Execute
func (e *Executor) Execute(ctx context.Context, req core.Request) core.ResponseExecute runs a query or mutation operation and returns the completed response. Subscription operations are rejected with ErrSubscriptionOperation; use Executor.Subscribe instead. Errors produced during plugin notifications, parsing, or field resolution are surfaced via the returned response.
func (*Executor) OperationKind
func (e *Executor) OperationKind(req core.Request) (core.OperationKind, error)OperationKind parses req and reports the kind of the selected operation. It performs no plugin notifications and runs no resolvers, so transports can call it cheaply to decide whether to dispatch a request to Execute or Subscribe.
func (*Executor) Subscribe
func (e *Executor) Subscribe(ctx context.Context, req core.Request) (<-chan core.Response, error)Subscribe parses a subscription operation, invokes the source-stream resolver, and returns a channel of GraphQL responses that close when the source stream closes or the supplied context is cancelled.
Generated by gomarkdoc
Last updated on