Documentation ¶
Index ¶
- Constants
- Variables
- type AfterFetchHook
- type Array
- type BeforeFetchHook
- type Boolean
- type BufPair
- type Context
- type ContextVariable
- type DataSource
- type Defer
- type DeferField
- type EmptyArray
- type EmptyObject
- type Fetch
- type FetchKind
- type Fetches
- type Field
- type Float
- type FlushWriter
- type GraphQLResponse
- type GraphQLResponsePatch
- type GraphQLStreamingResponse
- type GraphQLSubscription
- type GraphQLSubscriptionTrigger
- type HeaderVariable
- type HookContext
- type InputTemplate
- type Integer
- type Node
- type NodeKind
- type Null
- type Object
- type ObjectVariable
- type ParallelFetch
- type Position
- type ProcessResponseConfig
- type Request
- type Resolver
- func (r *Resolver) MergeBufPairData(from, to *BufPair, prefixDataWithComma bool)
- func (r *Resolver) MergeBufPairErrors(from, to *BufPair)
- func (r *Resolver) MergeBufPairs(from, to *BufPair, prefixDataWithComma bool)
- func (r *Resolver) ResolveGraphQLResponse(ctx *Context, response *GraphQLResponse, data []byte, writer io.Writer) (err error)
- func (r *Resolver) ResolveGraphQLResponsePatch(ctx *Context, patch *GraphQLResponsePatch, data, path, extraPath []byte, ...) (err error)
- func (r *Resolver) ResolveGraphQLStreamingResponse(ctx *Context, response *GraphQLStreamingResponse, data []byte, ...) (err error)
- func (r *Resolver) ResolveGraphQLSubscription(ctx *Context, subscription *GraphQLSubscription, writer FlushWriter) (err error)
- type SegmentType
- type SingleFetch
- type Stream
- type StreamField
- type String
- type SubscriptionDataSource
- type TemplateSegment
- type Variable
- type VariableKind
- type VariableSource
- type Variables
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 ¶
View Source
var (
ErrUnableToResolve = errors.New("unable to resolve operation")
)
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 BeforeFetchHook ¶
type BeforeFetchHook interface {
OnBeforeFetch(ctx HookContext, input []byte)
}
type BufPair ¶
type BufPair struct { Data *fastbuffer.FastBuffer Errors *fastbuffer.FastBuffer }
func NewBufPair ¶
func NewBufPair() *BufPair
type Context ¶
type Context struct { context.Context Variables []byte Request Request // contains filtered or unexported fields }
func NewContext ¶
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 JsonValueType jsonparser.ValueType ArrayJsonValueType jsonparser.ValueType RenderAsArrayCSV bool RenderAsPlainValue bool RenderAsGraphQLValue bool OmitObjectKeyQuotes bool EscapeQuotes bool }
func (*ContextVariable) Equals ¶
func (c *ContextVariable) Equals(another Variable) bool
func (*ContextVariable) SetJsonValueType ¶ added in v1.26.0
func (c *ContextVariable) SetJsonValueType(operation, definition *ast.Document, typeRef int)
func (*ContextVariable) TemplateSegment ¶
func (c *ContextVariable) TemplateSegment() TemplateSegment
func (*ContextVariable) VariableKind ¶
func (_ *ContextVariable) VariableKind() VariableKind
type DataSource ¶
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 Field ¶
type Field struct { Name []byte Value Node Position Position Defer *DeferField Stream *StreamField HasBuffer bool BufferID int OnTypeName []byte }
type FlushWriter ¶
type GraphQLResponse ¶
type GraphQLResponse struct {
Data Node
}
type GraphQLResponsePatch ¶
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 { Input []byte InputTemplate InputTemplate Variables Variables Source SubscriptionDataSource }
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 ObjectVariable ¶
type ObjectVariable struct { Path []string JsonValueType jsonparser.ValueType ArrayJsonValueType jsonparser.ValueType RenderAsGraphQLValue bool RenderAsPlainValue bool RenderAsArrayCSV bool OmitObjectKeyQuotes bool EscapeQuotes bool }
func (*ObjectVariable) Equals ¶
func (o *ObjectVariable) Equals(another Variable) bool
func (*ObjectVariable) SetJsonValueType ¶ added in v1.26.0
func (o *ObjectVariable) SetJsonValueType(definition *ast.Document, typeRef int)
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 ProcessResponseConfig ¶ added in v1.21.0
type Resolver ¶
type Resolver struct { EnableSingleFlightLoader bool // contains filtered or unexported fields }
func New ¶
New returns a new Resolver, ctx.Done() is used to cancel all active subscriptions & streams
func (*Resolver) MergeBufPairData ¶
func (*Resolver) MergeBufPairErrors ¶
func (*Resolver) MergeBufPairs ¶
func (*Resolver) ResolveGraphQLResponse ¶
func (*Resolver) ResolveGraphQLResponsePatch ¶
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 DataSourceIdentifier []byte ProcessResponseConfig ProcessResponseConfig }
func (*SingleFetch) FetchKind ¶
func (_ *SingleFetch) FetchKind() FetchKind
type StreamField ¶
type StreamField struct {
InitialBatchSize int
}
type SubscriptionDataSource ¶ added in v1.21.0
type TemplateSegment ¶
type TemplateSegment struct { SegmentType SegmentType Data []byte VariableSource VariableSource VariableSourcePath []string VariableValueType jsonparser.ValueType VariableValueArrayValueType jsonparser.ValueType RenderVariableAsArrayCSV bool RenderVariableAsPlainValue bool RenderVariableAsGraphQLValue bool OmitObjectKeyQuotes bool EscapeQuotes bool }
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
Click to show internal directories.
Click to hide internal directories.