resolve

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeKindObject NodeKind = iota + 1
	NodeKindEmptyObject
	NodeKindArray
	NodeKindEmptyArray
	NodeKindNull
	NodeKindString
	NodeKindBoolean
	NodeKindInteger
	NodeKindFloat

	FetchKindSingle FetchKind = iota + 1
	FetchKindParallel
)
View Source
const (
	StaticSegmentType SegmentType = iota + 1
	VariableSegmentType

	VariableSourceObject VariableSource = iota + 1
	VariableSourceContext
	VariableSourceRequestHeader
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterFetchHook

type AfterFetchHook interface {
	OnData(ctx HookContext, output []byte, singleFlight bool)
	OnError(ctx HookContext, output []byte, singleFlight bool)
}

type Array

type Array struct {
	Path                []string
	Nullable            bool
	ResolveAsynchronous bool
	Item                Node
	Stream              Stream
}

func (*Array) NodeKind

func (_ *Array) NodeKind() NodeKind

type BeforeFetchHook

type BeforeFetchHook interface {
	OnBeforeFetch(ctx HookContext, input []byte)
}

type Boolean

type Boolean struct {
	Path     []string
	Nullable bool
}

func (*Boolean) NodeKind

func (_ *Boolean) NodeKind() NodeKind

type BufPair

type BufPair struct {
	Data   *fastbuffer.FastBuffer
	Errors *fastbuffer.FastBuffer
}

func NewBufPair

func NewBufPair() *BufPair

func (*BufPair) HasData

func (b *BufPair) HasData() bool

func (*BufPair) HasErrors

func (b *BufPair) HasErrors() bool

func (*BufPair) Reset

func (b *BufPair) Reset()

func (*BufPair) WriteErr

func (b *BufPair) WriteErr(message, locations, path []byte)

type Context

type Context struct {
	context.Context
	Variables []byte
	Request   Request
	// contains filtered or unexported fields
}

func NewContext

func NewContext(ctx context.Context) *Context

func (*Context) Free

func (c *Context) Free()

func (*Context) SetAfterFetchHook

func (c *Context) SetAfterFetchHook(hook AfterFetchHook)

func (*Context) SetBeforeFetchHook

func (c *Context) SetBeforeFetchHook(hook BeforeFetchHook)

type ContextVariable

type ContextVariable struct {
	Path []string
}

func (*ContextVariable) Equals

func (c *ContextVariable) Equals(another Variable) bool

func (*ContextVariable) TemplateSegment

func (c *ContextVariable) TemplateSegment() TemplateSegment

func (*ContextVariable) VariableKind

func (_ *ContextVariable) VariableKind() VariableKind

type DataSource

type DataSource interface {
	Load(ctx context.Context, input []byte, bufPair *BufPair) (err error)
	UniqueIdentifier() []byte
}

type Defer

type Defer struct {
	Enabled    bool
	PatchIndex int
}

type DeferField

type DeferField struct{}

type EmptyArray

type EmptyArray struct{}

func (*EmptyArray) NodeKind

func (_ *EmptyArray) NodeKind() NodeKind

type EmptyObject

type EmptyObject struct{}

func (*EmptyObject) NodeKind

func (_ *EmptyObject) NodeKind() NodeKind

type Fetch

type Fetch interface {
	FetchKind() FetchKind
}

type FetchKind

type FetchKind int

type Fetches

type Fetches []Fetch

type Field

type Field struct {
	Name       []byte
	Value      Node
	Defer      *DeferField
	Stream     *StreamField
	HasBuffer  bool
	BufferID   int
	OnTypeName []byte
}

type Float

type Float struct {
	Path     []string
	Nullable bool
}

func (*Float) NodeKind

func (_ *Float) NodeKind() NodeKind

type FlushWriter

type FlushWriter interface {
	io.Writer
	Flush()
}

type GraphQLResponse

type GraphQLResponse struct {
	Data Node
}

type GraphQLResponsePatch

type GraphQLResponsePatch struct {
	Value     Node
	Fetch     Fetch
	Operation []byte
}

type GraphQLStreamingResponse

type GraphQLStreamingResponse struct {
	InitialResponse *GraphQLResponse
	Patches         []*GraphQLResponsePatch
	FlushInterval   int64
}

type GraphQLSubscription

type GraphQLSubscription struct {
	Trigger  GraphQLSubscriptionTrigger
	Response *GraphQLResponse
}

type GraphQLSubscriptionTrigger

type GraphQLSubscriptionTrigger struct {
	ManagerID     []byte
	Input         string
	InputTemplate InputTemplate
	Variables     Variables
}

type HeaderVariable

type HeaderVariable struct {
	Path []string
}

func (*HeaderVariable) Equals

func (h *HeaderVariable) Equals(another Variable) bool

func (*HeaderVariable) TemplateSegment

func (h *HeaderVariable) TemplateSegment() TemplateSegment

func (*HeaderVariable) VariableKind

func (h *HeaderVariable) VariableKind() VariableKind

type HookContext

type HookContext struct {
	CurrentPath []byte
}

type InputTemplate

type InputTemplate struct {
	Segments []TemplateSegment
}

func (*InputTemplate) Render

func (i *InputTemplate) Render(ctx *Context, data []byte, preparedInput *fastbuffer.FastBuffer) (err error)

type Integer

type Integer struct {
	Path     []string
	Nullable bool
}

func (*Integer) NodeKind

func (_ *Integer) NodeKind() NodeKind

type Node

type Node interface {
	NodeKind() NodeKind
}

type NodeKind

type NodeKind int

type Null

type Null struct {
	Defer Defer
}

func (*Null) NodeKind

func (_ *Null) NodeKind() NodeKind

type Object

type Object struct {
	Nullable bool
	Path     []string
	Fields   []*Field
	Fetch    Fetch
}

func (*Object) NodeKind

func (_ *Object) NodeKind() NodeKind

type ObjectVariable

type ObjectVariable struct {
	Path []string
}

func (*ObjectVariable) Equals

func (o *ObjectVariable) Equals(another Variable) bool

func (*ObjectVariable) TemplateSegment

func (o *ObjectVariable) TemplateSegment() TemplateSegment

func (*ObjectVariable) VariableKind

func (o *ObjectVariable) VariableKind() VariableKind

type ParallelFetch

type ParallelFetch struct {
	Fetches []*SingleFetch
}

func (*ParallelFetch) FetchKind

func (_ *ParallelFetch) FetchKind() FetchKind

type Request

type Request struct {
	Header http.Header
}

type Resolver

type Resolver struct {
	EnableSingleFlightLoader bool
	// contains filtered or unexported fields
}

func New

func New() *Resolver

func (*Resolver) MergeBufPairData

func (r *Resolver) MergeBufPairData(from, to *BufPair, prefixDataWithComma bool)

func (*Resolver) MergeBufPairErrors

func (r *Resolver) MergeBufPairErrors(from, to *BufPair)

func (*Resolver) MergeBufPairs

func (r *Resolver) MergeBufPairs(from, to *BufPair, prefixDataWithComma bool)

func (*Resolver) RegisterTriggerManager

func (r *Resolver) RegisterTriggerManager(m *subscription.Manager)

func (*Resolver) ResolveGraphQLResponse

func (r *Resolver) ResolveGraphQLResponse(ctx *Context, response *GraphQLResponse, data []byte, writer io.Writer) (err error)

func (*Resolver) ResolveGraphQLResponsePatch

func (r *Resolver) ResolveGraphQLResponsePatch(ctx *Context, patch *GraphQLResponsePatch, data, path, extraPath []byte, writer io.Writer) (err error)

func (*Resolver) ResolveGraphQLStreamingResponse

func (r *Resolver) ResolveGraphQLStreamingResponse(ctx *Context, response *GraphQLStreamingResponse, data []byte, writer FlushWriter) (err error)

func (*Resolver) ResolveGraphQLSubscription

func (r *Resolver) ResolveGraphQLSubscription(ctx *Context, subscription *GraphQLSubscription, writer FlushWriter) (err error)

type SegmentType

type SegmentType int

type SingleFetch

type SingleFetch struct {
	BufferId   int
	Input      string
	DataSource DataSource
	Variables  Variables
	// DisallowSingleFlight is used for write operations like mutations, POST, DELETE etc. to disable singleFlight
	// By default SingleFlight for fetches is disabled and needs to be enabled on the Resolver first
	// If the resolver allows SingleFlight it's up the each individual DataSource Planner to decide whether an Operation
	// should be allowed to use SingleFlight
	DisallowSingleFlight bool
	InputTemplate        InputTemplate
}

func (*SingleFetch) FetchKind

func (_ *SingleFetch) FetchKind() FetchKind

type Stream

type Stream struct {
	Enabled          bool
	InitialBatchSize int
	PatchIndex       int
}

type StreamField

type StreamField struct {
	InitialBatchSize int
}

type String

type String struct {
	Path     []string
	Nullable bool
}

func (*String) NodeKind

func (_ *String) NodeKind() NodeKind

type TemplateSegment

type TemplateSegment struct {
	SegmentType        SegmentType
	Data               []byte
	VariableSource     VariableSource
	VariableSourcePath []string
}

type Variable

type Variable interface {
	VariableKind() VariableKind
	Equals(another Variable) bool
	TemplateSegment() TemplateSegment
}

type VariableKind

type VariableKind int
const (
	VariableKindContext VariableKind = iota + 1
	VariableKindObject
	VariableKindHeader
)

type VariableSource

type VariableSource int

type Variables

type Variables []Variable

func NewVariables

func NewVariables(variables ...Variable) Variables

func (*Variables) AddVariable

func (v *Variables) AddVariable(variable Variable, quoteValue bool) (name string, exists bool)

Jump to

Keyboard shortcuts

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