execution

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Code generated by graphql-go-tools gen, DO NOT EDIT.

Package execution is a complete GraphQL runtime. It contains a Handler to orchestrate the execution, a Query Planner to generate a Query Plan from an AST as well as the Executor to execute a Query Plan.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgsResolver

type ArgsResolver interface {
	ResolveArgs(args []datasource.Argument, data []byte) ResolvedArgs
}

type BooleanCondition

type BooleanCondition interface {
	Evaluate(ctx Context, data []byte) bool
}

type Context

type Context struct {
	context.Context
	Variables      Variables
	ExtraArguments []datasource.Argument
}

type DataResolvingConfig

type DataResolvingConfig struct {
	PathSelector   datasource.PathSelector
	Transformation Transformation
}

type DataSourceDefinition

type DataSourceDefinition struct {
	// the type name to which the data source is attached
	TypeName []byte
	// the field on the type to which the data source is attached
	FieldName []byte
	// a factory method to return a new planner
	DataSourcePlannerFactory func() datasource.Planner
}

type DataSourceInvocation

type DataSourceInvocation struct {
	Args       []datasource.Argument
	DataSource datasource.DataSource
}

type ErrJSONValueTypeValueIncompatible

type ErrJSONValueTypeValueIncompatible struct {
	// contains filtered or unexported fields
}

func (ErrJSONValueTypeValueIncompatible) Error

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(templateDirectives []byte_template.DirectiveDefinition) *Executor

func (*Executor) Execute

func (e *Executor) Execute(ctx Context, node RootNode, w io.Writer) error

func (*Executor) ResolveArgs

func (e *Executor) ResolveArgs(args []datasource.Argument, data []byte) ResolvedArgs

type Fetch

type Fetch interface {
	Fetch(ctx Context, data []byte, argsResolver ArgsResolver, suffix string, buffers *LockableBufferMap) (n int, err error)
}

type Field

type Field struct {
	Name            []byte
	Value           Node
	Skip            BooleanCondition
	HasResolvedData bool
}

func (*Field) HasResolversRecursively

func (f *Field) HasResolversRecursively() bool

func (*Field) Kind

func (*Field) Kind() NodeKind

type GraphQLDataSourceConfig

type GraphQLDataSourceConfig struct {
	Host   string
	Url    string
	Method HTTP_METHOD
	Params *[]*Parameter
}

func (*GraphQLDataSourceConfig) Unmarshal

func (g *GraphQLDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type GraphqlRequest

type GraphqlRequest struct {
	OperationName string          `json:"operationName"`
	Variables     json.RawMessage `json:"variables"`
	Query         string          `json:"query"`
}

type HTTP_METHOD

type HTTP_METHOD int
const (
	UNDEFINED_HTTP_METHOD HTTP_METHOD = iota
	HTTP_METHOD_GET
	HTTP_METHOD_POST
	HTTP_METHOD_UPDATE
	HTTP_METHOD_DELETE
)

func (*HTTP_METHOD) Unmarshal

func (h *HTTP_METHOD) Unmarshal(doc *ast.Document, ref int)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(base *datasource.BasePlanner, templateDirectives []byte_template.DirectiveDefinition) *Handler

func (*Handler) Handle

func (h *Handler) Handle(requestData, extraVariables []byte) (executor *Executor, node RootNode, ctx Context, err error)
type Header struct {
	Key   string
	Value string
}

func (*Header) Unmarshal

func (h *Header) Unmarshal(doc *ast.Document, ref int)

type HttpJsonDataSourceConfig

type HttpJsonDataSourceConfig struct {
	Host                       string
	Url                        string
	Method                     HTTP_METHOD
	Params                     *[]*Parameter
	Body                       *string
	Headers                    *[]*Header
	DefaultTypeName            *string
	StatusCodeTypeNameMappings *[]*StatusCodeTypeNameMapping
}

func (*HttpJsonDataSourceConfig) Unmarshal

func (h *HttpJsonDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type HttpPollingStreamDataSourceConfig

type HttpPollingStreamDataSourceConfig struct {
	Host         string
	Url          string
	Method       HTTP_METHOD
	DelaySeconds int64
	Params       *[]*Parameter
}

func (*HttpPollingStreamDataSourceConfig) Unmarshal

func (h *HttpPollingStreamDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type IfEqual

type IfEqual struct {
	Left, Right datasource.Argument
}

func (*IfEqual) Evaluate

func (i *IfEqual) Evaluate(ctx Context, data []byte) bool

type IfNotEqual

type IfNotEqual struct {
	Left, Right datasource.Argument
}

func (*IfNotEqual) Evaluate

func (i *IfNotEqual) Evaluate(ctx Context, data []byte) bool

type JSONValueType

type JSONValueType int
const (
	UnknownValueType JSONValueType = iota
	StringValueType
	IntegerValueType
	FloatValueType
	BooleanValueType
)

func (JSONValueType) String

func (i JSONValueType) String() string

type List

type List struct {
	DataResolvingConfig DataResolvingConfig
	Value               Node
	Filter              ListFilter
}

func (*List) HasResolversRecursively

func (l *List) HasResolversRecursively() bool

func (*List) Kind

func (*List) Kind() NodeKind

type ListFilter

type ListFilter interface {
	Kind() ListFilterKind
}

type ListFilterFirstN

type ListFilterFirstN struct {
	FirstN int
}

func (ListFilterFirstN) Kind

type ListFilterKind

type ListFilterKind int
const (
	ListFilterKindFirstN ListFilterKind = iota + 1
)

type LockableBufferMap

type LockableBufferMap struct {
	sync.Mutex
	Buffers map[uint64]*bytes.Buffer
}

type MAPPING_MODE

type MAPPING_MODE int
const (
	UNDEFINED_MAPPING_MODE MAPPING_MODE = iota
	MAPPING_MODE_NONE
	MAPPING_MODE_PATH_SELECTOR
)

func (*MAPPING_MODE) Unmarshal

func (m *MAPPING_MODE) Unmarshal(doc *ast.Document, ref int)

type MQTTDataSourceConfig

type MQTTDataSourceConfig struct {
	BrokerAddr string
	ClientID   string
	Topic      string
}

func (*MQTTDataSourceConfig) Unmarshal

func (m *MQTTDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type MappingConfig

type MappingConfig struct {
	Mode         MAPPING_MODE
	PathSelector *string
}

func (*MappingConfig) Unmarshal

func (m *MappingConfig) Unmarshal(doc *ast.Document, ref int)

type NatsDataSourceConfig

type NatsDataSourceConfig struct {
	Addr  string
	Topic string
}

func (*NatsDataSourceConfig) Unmarshal

func (n *NatsDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type Node

type Node interface {
	// Kind returns the NodeKind of each Node
	Kind() NodeKind
	// HasResolversRecursively returns true if this Node or any child Node has a resolver
	HasResolversRecursively() bool
}

type NodeKind

type NodeKind int
const (
	ObjectKind NodeKind = iota + 1
	FieldKind
	ListKind
	ValueKind
)

type Object

type Object struct {
	DataResolvingConfig DataResolvingConfig
	Fields              []Field
	Fetch               Fetch
	// contains filtered or unexported fields
}

func (*Object) HasResolversRecursively

func (o *Object) HasResolversRecursively() bool

func (*Object) Kind

func (*Object) Kind() NodeKind

func (*Object) OperationType

func (o *Object) OperationType() ast.OperationType

type PARAMETER_SOURCE

type PARAMETER_SOURCE int
const (
	UNDEFINED_PARAMETER_SOURCE PARAMETER_SOURCE = iota
	PARAMETER_SOURCE_CONTEXT_VARIABLE
	PARAMETER_SOURCE_OBJECT_VARIABLE_ARGUMENT
	PARAMETER_SOURCE_FIELD_ARGUMENTS
)

func (*PARAMETER_SOURCE) Unmarshal

func (p *PARAMETER_SOURCE) Unmarshal(doc *ast.Document, ref int)

type ParallelFetch

type ParallelFetch struct {
	Fetches []Fetch
	// contains filtered or unexported fields
}

func (*ParallelFetch) Fetch

func (p *ParallelFetch) Fetch(ctx Context, data []byte, argsResolver ArgsResolver, suffix string, buffers *LockableBufferMap) (n int, err error)

type Parameter

type Parameter struct {
	Name         string
	SourceKind   PARAMETER_SOURCE
	SourceName   string
	VariableType string
}

func (*Parameter) Unmarshal

func (p *Parameter) Unmarshal(doc *ast.Document, ref int)

type PipelineDataSourceConfig

type PipelineDataSourceConfig struct {
	ConfigFilePath *string
	ConfigString   *string
	InputJSON      string
}

func (*PipelineDataSourceConfig) Unmarshal

func (p *PipelineDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type PipelineTransformation

type PipelineTransformation struct {
	// contains filtered or unexported fields
}

func (*PipelineTransformation) Transform

func (p *PipelineTransformation) Transform(input []byte) ([]byte, error)

type Planner

type Planner struct {
	// contains filtered or unexported fields
}

func NewPlanner

func NewPlanner(base *datasource.BasePlanner) *Planner

func (*Planner) Plan

func (p *Planner) Plan(operation, definition *ast.Document, operationName string, report *operationreport.Report) RootNode

type ResolvedArgs

type ResolvedArgs []ResolvedArgument

func (ResolvedArgs) ByKey

func (r ResolvedArgs) ByKey(key []byte) []byte

func (ResolvedArgs) Dump

func (r ResolvedArgs) Dump() []string

func (*ResolvedArgs) Filter

func (r *ResolvedArgs) Filter(condition func(i int) (keep bool))

func (ResolvedArgs) Keys

func (r ResolvedArgs) Keys() [][]byte

type ResolvedArgument

type ResolvedArgument struct {
	Key   []byte
	Value []byte
}

type RootNode

type RootNode interface {
	Node
	OperationType() ast.OperationType
}

type SerialFetch

type SerialFetch struct {
	Fetches []Fetch
}

func (*SerialFetch) Fetch

func (s *SerialFetch) Fetch(ctx Context, data []byte, argsResolver ArgsResolver, suffix string, buffers *LockableBufferMap) (n int, err error)

type SingleFetch

type SingleFetch struct {
	Source     *DataSourceInvocation
	BufferName string
}

func (*SingleFetch) Fetch

func (s *SingleFetch) Fetch(ctx Context, data []byte, argsResolver ArgsResolver, path string, buffers *LockableBufferMap) (int, error)

type StaticDataSourceConfig

type StaticDataSourceConfig struct {
	Data *string
}

func (*StaticDataSourceConfig) Unmarshal

func (s *StaticDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type StatusCodeTypeNameMapping

type StatusCodeTypeNameMapping struct {
	StatusCode int64
	TypeName   string
}

func (*StatusCodeTypeNameMapping) Unmarshal

func (s *StatusCodeTypeNameMapping) Unmarshal(doc *ast.Document, ref int)

type TRANSFORMATION_MODE

type TRANSFORMATION_MODE int
const (
	UNDEFINED_TRANSFORMATION_MODE TRANSFORMATION_MODE = iota
	TRANSFORMATION_MODE_PIPELINE
)

func (*TRANSFORMATION_MODE) Unmarshal

func (t *TRANSFORMATION_MODE) Unmarshal(doc *ast.Document, ref int)

type Transformation

type Transformation interface {
	Transform(input []byte) ([]byte, error)
}

type TransformationConfig

type TransformationConfig struct {
	Mode                 TRANSFORMATION_MODE
	PipelineConfigFile   *string
	PipelineConfigString *string
}

func (*TransformationConfig) Unmarshal

func (t *TransformationConfig) Unmarshal(doc *ast.Document, ref int)

type Value

type Value struct {
	DataResolvingConfig DataResolvingConfig
	ValueType           JSONValueType
}

func (*Value) HasResolversRecursively

func (value *Value) HasResolversRecursively() bool

func (*Value) Kind

func (*Value) Kind() NodeKind

type Variables

type Variables map[uint64][]byte

func VariablesFromJson

func VariablesFromJson(requestVariables, extraVariables []byte) (variables Variables, extraArguments []datasource.Argument)

type WasmDataSourceConfig

type WasmDataSourceConfig struct {
	Input    string
	WasmFile string
}

func (*WasmDataSourceConfig) Unmarshal

func (w *WasmDataSourceConfig) Unmarshal(doc *ast.Document, ref int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL