Documentation ¶
Index ¶
- Constants
- Variables
- func GetDurationNanoSinceTraceStart(ctx context.Context) int64
- func SetInputUndefinedVariables(preparedInput *bytes.Buffer, undefinedVariables []string) error
- func SetPlannerStats(ctx context.Context, stats PlannerStats)
- func SetTraceStart(ctx context.Context, predictableDebugTimings bool) context.Context
- func SingleFlightDisallowed(ctx context.Context) bool
- type Array
- type AuthorizationDeny
- type Authorizer
- type BatchEntityFetch
- type BatchInput
- type BigInt
- type Boolean
- type BufPair
- type CSVVariableRenderer
- type CloseableSubscriptionUpdater
- type ConnectDoneStats
- type ConnectStartStats
- type Context
- type ContextVariable
- type CustomNode
- type CustomResolve
- type DNSDoneStats
- type DNSStartStats
- type DataSource
- type DataSourceLoadTrace
- type DeferField
- type EmptyArray
- type EmptyObject
- type EntityFetch
- type EntityInput
- type Fetch
- type FetchConfiguration
- type FetchInfo
- type FetchKind
- type Field
- type FieldExport
- type FieldInfo
- type Float
- type GetConnStats
- type GotConnStats
- type GotFirstResponseByteStats
- type GraphCoordinate
- type GraphQLResponse
- type GraphQLResponseInfo
- type GraphQLSubscription
- type GraphQLSubscriptionTrigger
- type GraphQLVariableRenderer
- func NewGraphQLVariableRenderer(jsonSchema string) *GraphQLVariableRenderer
- func NewGraphQLVariableRendererFromJSONRootTypeWithoutValidation(rootType JsonRootType) (*GraphQLVariableRenderer, error)
- func NewGraphQLVariableRendererFromTypeRef(operation, definition *ast.Document, variableTypeRef int) (*GraphQLVariableRenderer, error)
- func NewGraphQLVariableRendererFromTypeRefWithOverrides(operation, definition *ast.Document, variableTypeRef int, ...) (*GraphQLVariableRenderer, error)
- func NewGraphQLVariableRendererFromTypeRefWithoutValidation(operation, definition *ast.Document, variableTypeRef int) (*GraphQLVariableRenderer, error)
- type GraphQLVariableResolveRenderer
- type HeaderVariable
- type InputTemplate
- type Integer
- type JSONVariableRenderer
- type JsonRootType
- type JsonRootTypeKind
- type LoadStats
- type Loader
- type MultiFetch
- type Node
- type NodeKind
- type Null
- type Object
- type ObjectVariable
- type ParallelFetch
- type ParallelListItemFetch
- type PlainVariableRenderer
- type PlannerStats
- type Position
- type PostProcessingConfiguration
- type RenameTypeName
- type Reporter
- type Request
- type RequestTraceOptions
- type Resolvable
- func (r *Resolvable) Init(ctx *Context, initialData []byte, operationType ast.OperationType) (err error)
- func (r *Resolvable) InitSubscription(ctx *Context, initialData []byte, postProcessing PostProcessingConfiguration) (err error)
- func (r *Resolvable) Reset()
- func (r *Resolvable) Resolve(ctx context.Context, root *Object, out io.Writer) error
- type ResolvableObjectVariable
- type Resolver
- func (r *Resolver) AsyncResolveGraphQLSubscription(ctx *Context, subscription *GraphQLSubscription, ...) (err error)
- func (r *Resolver) AsyncUnsubscribeClient(connectionID int64) error
- func (r *Resolver) AsyncUnsubscribeSubscription(id SubscriptionIdentifier) error
- func (r *Resolver) ResolveGraphQLResponse(ctx *Context, response *GraphQLResponse, data []byte, writer io.Writer) (err error)
- func (r *Resolver) ResolveGraphQLSubscription(ctx *Context, subscription *GraphQLSubscription, ...) error
- type ResolverOptions
- type ResponseWriter
- type Scalar
- type SegmentType
- type SerialFetch
- type SimpleResolver
- type SingleFetch
- type SingleFlightStats
- type StaticString
- type Stats
- type StreamField
- type String
- type SubscriptionDataSource
- type SubscriptionIdentifier
- type SubscriptionResponseWriter
- type SubscriptionUpdater
- type TLSHandshakeDoneStats
- type TLSHandshakeStartStats
- type TemplateSegment
- type TraceFetch
- type TraceFetchEvents
- type TraceFetchType
- type TraceField
- type TraceInfo
- type TraceNode
- type TraceNodeType
- type TypeFieldSource
- type Variable
- type VariableKind
- type VariableRenderer
- type Variables
- type WroteHeadersStats
- type WroteRequestStats
Constants ¶
const ( VariableRendererKindPlain = "plain" VariableRendererKindPlanWithValidation = "plainWithValidation" VariableRendererKindJson = "json" VariableRendererKindJsonWithValidation = "jsonWithValidation" VariableRendererKindGraphqlWithValidation = "graphqlWithValidation" VariableRendererKindGraphqlResolve = "graphqlResolve" VariableRendererKindCsv = "csv" )
Variables ¶
var ( ErrResolverClosed = errors.New("resolver closed") ErrSubscriptionUpdaterNotCloseable = errors.New("subscription updater is not closeable") )
var (
ErrUnableToResolve = errors.New("unable to resolve operation")
)
Functions ¶
func SetPlannerStats ¶
func SetPlannerStats(ctx context.Context, stats PlannerStats)
func SetTraceStart ¶
func SingleFlightDisallowed ¶
Types ¶
type AuthorizationDeny ¶
type AuthorizationDeny struct {
Reason string
}
type Authorizer ¶
type Authorizer interface { // AuthorizePreFetch is called prior to making a fetch in the loader // This allows to implement policies to prevent fetches to an origin // E.g. for Mutations, it might be undesired to just filter out the response // You'd want to prevent sending the Operation to the Origin completely // // The input argument is the final render of the datasource input AuthorizePreFetch(ctx *Context, dataSourceID string, input json.RawMessage, coordinate GraphCoordinate) (result *AuthorizationDeny, err error) // AuthorizeObjectField operates on the response and can solely be used to implement policies to filter out response fields // In contrast to AuthorizePreFetch, this cannot be used to prevent origin requests // This function only allows you to filter the response before rendering it to the client // // The object argument is the flat render of the field-enclosing response object // Flat render means, we're only rendering scalars, not arrays or objects AuthorizeObjectField(ctx *Context, dataSourceID string, object json.RawMessage, coordinate GraphCoordinate) (result *AuthorizationDeny, err error) }
type BatchEntityFetch ¶
type BatchEntityFetch struct { Input BatchInput DataSource DataSource PostProcessing PostProcessingConfiguration DataSourceIdentifier []byte Trace *DataSourceLoadTrace Info *FetchInfo }
BatchEntityFetch - TODO: document better allows to join nested fetches to the same subgraph into a single fetch
func (*BatchEntityFetch) FetchKind ¶
func (_ *BatchEntityFetch) FetchKind() FetchKind
type BatchInput ¶
type BatchInput struct { Header InputTemplate Items []InputTemplate // If SkipNullItems is set to true, items that render to null will not be included in the batch but skipped SkipNullItems bool // Same as SkipNullItems but for empty objects SkipEmptyObjectItems bool // If SkipErrItems is set to true, items that return an error during rendering will not be included in the batch but skipped // In this case, the error will be swallowed // E.g. if a field is not nullable and the value is null, the item will be skipped SkipErrItems bool Separator InputTemplate }
type BigInt ¶
type BigInt struct { Path []string Nullable bool Export *FieldExport `json:"export,omitempty"` }
func (*BigInt) NodeNullable ¶
type Boolean ¶
type Boolean struct { Path []string Nullable bool Export *FieldExport `json:"export,omitempty"` }
func (*Boolean) NodeNullable ¶
type BufPair ¶
type BufPair struct { Data *fastbuffer.FastBuffer Errors *fastbuffer.FastBuffer }
func NewBufPair ¶
func NewBufPair() *BufPair
type CSVVariableRenderer ¶
type CSVVariableRenderer struct { Kind string // contains filtered or unexported fields }
CSVVariableRenderer is an implementation of VariableRenderer It renders the provided list of Values as comma separated Values in plaintext (no JSON encoding of Values)
func NewCSVVariableRenderer ¶
func NewCSVVariableRenderer(arrayValueType JsonRootType) *CSVVariableRenderer
func NewCSVVariableRendererFromTypeRef ¶
func NewCSVVariableRendererFromTypeRef(operation, definition *ast.Document, variableTypeRef int) *CSVVariableRenderer
func (*CSVVariableRenderer) GetKind ¶
func (c *CSVVariableRenderer) GetKind() string
func (*CSVVariableRenderer) RenderVariable ¶
type CloseableSubscriptionUpdater ¶
type CloseableSubscriptionUpdater interface { SubscriptionUpdater Close() }
func AsCloseableSubscriptionUpdater ¶
func AsCloseableSubscriptionUpdater(updater SubscriptionUpdater) (CloseableSubscriptionUpdater, bool)
type ConnectDoneStats ¶
type ConnectStartStats ¶
type Context ¶
type Context struct { Variables []byte Request Request RenameTypeNames []RenameTypeName RequestTracingOptions RequestTraceOptions InitialPayload []byte Extensions []byte Stats Stats // contains filtered or unexported fields }
func NewContext ¶
func (*Context) SubgraphErrors ¶
func (*Context) WithAuthorizer ¶
func (c *Context) WithAuthorizer(authorizer Authorizer) *Context
type ContextVariable ¶
type ContextVariable struct { Path []string Renderer VariableRenderer }
func (*ContextVariable) Equals ¶
func (c *ContextVariable) Equals(another Variable) bool
func (*ContextVariable) GetVariableKind ¶
func (_ *ContextVariable) GetVariableKind() VariableKind
func (*ContextVariable) TemplateSegment ¶
func (c *ContextVariable) TemplateSegment() TemplateSegment
type CustomNode ¶
type CustomNode struct { CustomResolve Nullable bool Path []string }
func (*CustomNode) NodeKind ¶
func (_ *CustomNode) NodeKind() NodeKind
func (*CustomNode) NodeNullable ¶
func (c *CustomNode) NodeNullable() bool
func (*CustomNode) NodePath ¶
func (c *CustomNode) NodePath() []string
type CustomResolve ¶
type DNSDoneStats ¶
type DNSStartStats ¶
type DataSource ¶
type DataSourceLoadTrace ¶
type DataSourceLoadTrace struct { RawInputData json.RawMessage `json:"raw_input_data,omitempty"` Input json.RawMessage `json:"input,omitempty"` Output json.RawMessage `json:"output,omitempty"` LoadError string `json:"error,omitempty"` DurationSinceStartNano int64 `json:"duration_since_start_nanoseconds,omitempty"` DurationSinceStartPretty string `json:"duration_since_start_pretty,omitempty"` DurationLoadNano int64 `json:"duration_load_nanoseconds,omitempty"` DurationLoadPretty string `json:"duration_load_pretty,omitempty"` SingleFlightUsed bool `json:"single_flight_used"` LoadSkipped bool `json:"load_skipped"` LoadStats *LoadStats `json:"load_stats,omitempty"` Path string `json:"-"` }
type DeferField ¶
type DeferField struct{}
type EmptyArray ¶
type EmptyArray struct{}
func (*EmptyArray) NodeKind ¶
func (_ *EmptyArray) NodeKind() NodeKind
func (*EmptyArray) NodeNullable ¶
func (_ *EmptyArray) NodeNullable() bool
func (*EmptyArray) NodePath ¶
func (_ *EmptyArray) NodePath() []string
type EmptyObject ¶
type EmptyObject struct{}
func (*EmptyObject) NodeKind ¶
func (_ *EmptyObject) NodeKind() NodeKind
func (*EmptyObject) NodeNullable ¶
func (_ *EmptyObject) NodeNullable() bool
func (*EmptyObject) NodePath ¶
func (_ *EmptyObject) NodePath() []string
type EntityFetch ¶
type EntityFetch struct { Input EntityInput DataSource DataSource PostProcessing PostProcessingConfiguration DataSourceIdentifier []byte Trace *DataSourceLoadTrace Info *FetchInfo }
func (*EntityFetch) FetchKind ¶
func (_ *EntityFetch) FetchKind() FetchKind
type EntityInput ¶
type EntityInput struct { Header InputTemplate Item InputTemplate SkipErrItem bool }
type FetchConfiguration ¶
type FetchConfiguration struct { Input string Variables Variables DataSource DataSource // RequiresParallelListItemFetch is used to indicate that the single fetches should be executed without batching // When we have multiple fetches attached to the object - after post-processing of a plan we will get ParallelListItemFetch instead of ParallelFetch RequiresParallelListItemFetch bool // RequiresEntityFetch will be set to true if the fetch is an entity fetch on an object. After post-processing, we will get EntityFetch RequiresEntityFetch bool // RequiresEntityBatchFetch indicates that entity fetches on array items could be batched. After post-processing, we will get EntityBatchFetch RequiresEntityBatchFetch bool PostProcessing PostProcessingConfiguration // SetTemplateOutputToNullOnVariableNull will safely return "null" if one of the template variables renders to null // This is the case, e.g. when using batching and one sibling is null, resulting in a null value for one batch item // Returning null in this case tells the batch implementation to skip this item SetTemplateOutputToNullOnVariableNull bool }
type FetchInfo ¶
type FetchInfo struct { DataSourceID string RootFields []GraphCoordinate }
type FieldExport ¶
FieldExport takes the value of the field during evaluation (rendering of the field) and stores it in the variables using the Path as JSON pointer.
type FieldInfo ¶
type FieldInfo struct { // Name is the name of the field. Name string ExactParentTypeName string // ParentTypeNames is the list of possible parent types for this field. // E.g. for a root field, this will be Query, Mutation, Subscription. // For a field on an object type, this will be the name of that object type. // For a field on an interface type, this will be the name of that interface type and all of its possible implementations. ParentTypeNames []string // NamedType is the underlying node type of the field. // E.g. for a field of type Hobby! this will be Hobby. // For a field of type [Hobby] this will be Hobby. // For a field of type [Hobby!]! this will be Hobby. // For scalar fields, this will return string, int, float, boolean, ID. NamedType string Source TypeFieldSource FetchID int // HasAuthorizationRule needs to be set to true if the Authorizer should be called for this field HasAuthorizationRule bool }
type Float ¶
type Float struct { Path []string Nullable bool Export *FieldExport `json:"export,omitempty"` }
func (*Float) NodeNullable ¶
type GetConnStats ¶
type GotConnStats ¶
type GotConnStats struct { DurationSinceStartNano int64 `json:"duration_since_start_nanoseconds"` DurationSinceStartPretty string `json:"duration_since_start_pretty"` Reused bool `json:"reused"` WasIdle bool `json:"was_idle"` IdleTimeNano int64 `json:"idle_time_nanoseconds"` IdleTimePretty string `json:"idle_time_pretty"` }
type GraphCoordinate ¶
type GraphQLResponse ¶
type GraphQLResponse struct { Data *Object RenameTypeNames []RenameTypeName Info *GraphQLResponseInfo }
type GraphQLResponseInfo ¶
type GraphQLResponseInfo struct {
OperationType ast.OperationType
}
type GraphQLSubscription ¶
type GraphQLSubscription struct { Trigger GraphQLSubscriptionTrigger Response *GraphQLResponse }
type GraphQLSubscriptionTrigger ¶
type GraphQLSubscriptionTrigger struct { Input []byte InputTemplate InputTemplate Variables Variables Source SubscriptionDataSource PostProcessing PostProcessingConfiguration }
type GraphQLVariableRenderer ¶
type GraphQLVariableRenderer struct { JSONSchema string Kind string // contains filtered or unexported fields }
GraphQLVariableRenderer is an implementation of VariableRenderer It renders variables according to the GraphQL Specification
func NewGraphQLVariableRenderer ¶
func NewGraphQLVariableRenderer(jsonSchema string) *GraphQLVariableRenderer
NewGraphQLVariableRenderer - to be used in tests only
func NewGraphQLVariableRendererFromJSONRootTypeWithoutValidation ¶
func NewGraphQLVariableRendererFromJSONRootTypeWithoutValidation(rootType JsonRootType) (*GraphQLVariableRenderer, error)
NewGraphQLVariableRendererFromJSONRootTypeWithoutValidation - to be used in tests only
func NewGraphQLVariableRendererFromTypeRef ¶
func NewGraphQLVariableRendererFromTypeRef(operation, definition *ast.Document, variableTypeRef int) (*GraphQLVariableRenderer, error)
NewGraphQLVariableRendererFromTypeRef creates a new GraphQLVariableRenderer The argument typeRef must exist on the operation ast.Document, otherwise it will panic!
func NewGraphQLVariableRendererFromTypeRefWithOverrides ¶
func NewGraphQLVariableRendererFromTypeRefWithOverrides(operation, definition *ast.Document, variableTypeRef int, overrides map[string]graphqljsonschema.JsonSchema) (*GraphQLVariableRenderer, error)
func NewGraphQLVariableRendererFromTypeRefWithoutValidation ¶
func NewGraphQLVariableRendererFromTypeRefWithoutValidation(operation, definition *ast.Document, variableTypeRef int) (*GraphQLVariableRenderer, error)
func (*GraphQLVariableRenderer) GetKind ¶
func (g *GraphQLVariableRenderer) GetKind() string
func (*GraphQLVariableRenderer) RenderVariable ¶
type GraphQLVariableResolveRenderer ¶
func NewGraphQLVariableResolveRenderer ¶
func NewGraphQLVariableResolveRenderer(node Node) *GraphQLVariableResolveRenderer
func (*GraphQLVariableResolveRenderer) GetKind ¶
func (g *GraphQLVariableResolveRenderer) GetKind() string
func (*GraphQLVariableResolveRenderer) RenderVariable ¶
type HeaderVariable ¶
type HeaderVariable struct {
Path []string
}
func (*HeaderVariable) Equals ¶
func (h *HeaderVariable) Equals(another Variable) bool
func (*HeaderVariable) GetVariableKind ¶
func (h *HeaderVariable) GetVariableKind() VariableKind
func (*HeaderVariable) TemplateSegment ¶
func (h *HeaderVariable) TemplateSegment() TemplateSegment
type InputTemplate ¶
type InputTemplate struct { Segments []TemplateSegment // SetTemplateOutputToNullOnVariableNull will safely return "null" if one of the template variables renders to null // This is the case, e.g. when using batching and one sibling is null, resulting in a null value for one batch item // Returning null in this case tells the batch implementation to skip this item SetTemplateOutputToNullOnVariableNull bool }
func (*InputTemplate) RenderAndCollectUndefinedVariables ¶
type Integer ¶
type Integer struct { Path []string Nullable bool Export *FieldExport `json:"export,omitempty"` }
func (*Integer) NodeNullable ¶
type JSONVariableRenderer ¶
type JSONVariableRenderer struct { JSONSchema string Kind string // contains filtered or unexported fields }
JSONVariableRenderer is an implementation of VariableRenderer It renders the provided data as JSON If configured, it also does a JSON Validation Check before rendering
func NewJSONVariableRenderer ¶
func NewJSONVariableRenderer() *JSONVariableRenderer
func NewJSONVariableRendererWithValidation ¶
func NewJSONVariableRendererWithValidation(jsonSchema string) *JSONVariableRenderer
func NewJSONVariableRendererWithValidationFromTypeRef ¶
func NewJSONVariableRendererWithValidationFromTypeRef(operation, definition *ast.Document, variableTypeRef int) (*JSONVariableRenderer, error)
NewJSONVariableRendererWithValidationFromTypeRef creates a new JSONVariableRenderer The argument typeRef must exist on the operation ast.Document, otherwise it will panic!
func (*JSONVariableRenderer) GetKind ¶
func (r *JSONVariableRenderer) GetKind() string
func (*JSONVariableRenderer) RenderVariable ¶
type JsonRootType ¶
type JsonRootType struct { Value jsonparser.ValueType Values []jsonparser.ValueType Kind JsonRootTypeKind }
func (JsonRootType) Satisfies ¶
func (t JsonRootType) Satisfies(dataType jsonparser.ValueType) bool
type JsonRootTypeKind ¶
type JsonRootTypeKind int
const ( JsonRootTypeKindSingle JsonRootTypeKind = iota JsonRootTypeKindMultiple )
type LoadStats ¶
type LoadStats struct { GetConn GetConnStats `json:"get_conn"` GotConn GotConnStats `json:"got_conn"` GotFirstResponseByte GotFirstResponseByteStats `json:"got_first_response_byte"` DNSStart DNSStartStats `json:"dns_start"` DNSDone DNSDoneStats `json:"dns_done"` ConnectStart ConnectStartStats `json:"connect_start"` ConnectDone ConnectDoneStats `json:"connect_done"` TLSHandshakeStart TLSHandshakeStartStats `json:"tls_handshake_start"` TLSHandshakeDone TLSHandshakeDoneStats `json:"tls_handshake_done"` WroteHeaders WroteHeadersStats `json:"wrote_headers"` WroteRequest WroteRequestStats `json:"wrote_request"` }
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
func (*Loader) LoadGraphQLResponseData ¶
func (l *Loader) LoadGraphQLResponseData(ctx *Context, response *GraphQLResponse, resolvable *Resolvable) (err error)
type MultiFetch ¶
type MultiFetch struct {
Fetches []*SingleFetch
}
func (*MultiFetch) FetchKind ¶
func (_ *MultiFetch) FetchKind() FetchKind
type Object ¶
type Object struct { Nullable bool Path []string Fields []*Field Fetch Fetch UnescapeResponseJson bool `json:"unescape_response_json,omitempty"` }
func (*Object) HasChildFetches ¶
func (*Object) NodeNullable ¶
type ObjectVariable ¶
type ObjectVariable struct { Path []string Renderer VariableRenderer }
func (*ObjectVariable) Equals ¶
func (o *ObjectVariable) Equals(another Variable) bool
func (*ObjectVariable) GetVariableKind ¶
func (o *ObjectVariable) GetVariableKind() VariableKind
func (*ObjectVariable) TemplateSegment ¶
func (o *ObjectVariable) TemplateSegment() TemplateSegment
type ParallelFetch ¶
type ParallelFetch struct { Fetches []Fetch Trace *DataSourceLoadTrace }
ParallelFetch - TODO: document better should be used only for object fields which could be fetched parallel
func (*ParallelFetch) FetchKind ¶
func (_ *ParallelFetch) FetchKind() FetchKind
type ParallelListItemFetch ¶
type ParallelListItemFetch struct { Fetch *SingleFetch Traces []*SingleFetch Trace *DataSourceLoadTrace }
The ParallelListItemFetch can be used to make nested parallel fetches within a list Usually, you want to batch fetches within a list, which is the default behavior of SingleFetch However, if the data source does not support batching, you can use this fetch to make parallel fetches within a list
func (*ParallelListItemFetch) FetchKind ¶
func (_ *ParallelListItemFetch) FetchKind() FetchKind
type PlainVariableRenderer ¶
type PlainVariableRenderer struct { JSONSchema string Kind string // contains filtered or unexported fields }
PlainVariableRenderer is an implementation of VariableRenderer It renders the provided data as plain text E.g. a provided JSON string of "foo" will be rendered as foo, without quotes. If a nested JSON Object is provided, it will be rendered as is. This renderer can be used e.g. to render the provided scalar into a URL.
func NewPlainVariableRenderer ¶
func NewPlainVariableRenderer() *PlainVariableRenderer
func NewPlainVariableRendererWithValidation ¶
func NewPlainVariableRendererWithValidation(jsonSchema string) *PlainVariableRenderer
func NewPlainVariableRendererWithValidationFromTypeRef ¶
func NewPlainVariableRendererWithValidationFromTypeRef(operation, definition *ast.Document, variableTypeRef int, variablePath ...string) (*PlainVariableRenderer, error)
NewPlainVariableRendererWithValidationFromTypeRef creates a new PlainVariableRenderer The argument typeRef must exist on the operation ast.Document, otherwise it will panic!
func (*PlainVariableRenderer) GetKind ¶
func (p *PlainVariableRenderer) GetKind() string
func (*PlainVariableRenderer) RenderVariable ¶
type PlannerStats ¶
type PostProcessingConfiguration ¶
type PostProcessingConfiguration struct { // SelectResponseDataPath used to make a jsonparser.Get call on the response data SelectResponseDataPath []string // SelectResponseErrorsPath is similar to SelectResponseDataPath, but for errors // If this is set, the response will be considered an error if the jsonparser.Get call returns a non-empty value // The value will be expected to be a GraphQL error object SelectResponseErrorsPath []string // ResponseTemplate is processed after the SelectResponseDataPath is applied // It can be used to "render" the response data into a different format // E.g. when you're making a representations Request with two entities, you will get back an array of two objects // However, you might want to render this into a single object with two properties // This can be done with a ResponseTemplate ResponseTemplate *InputTemplate // MergePath can be defined to merge the result of the post-processing into the parent object at the given path // e.g. if the parent is {"a":1}, result is {"foo":"bar"} and the MergePath is ["b"], // the result will be {"a":1,"b":{"foo":"bar"}} // If the MergePath is empty, the result will be merged into the parent object // In this case, the result would be {"a":1,"foo":"bar"} // This is useful if you make multiple fetches, e.g. parallel fetches, that would otherwise overwrite each other MergePath []string }
type RenameTypeName ¶
type RenameTypeName struct {
From, To []byte
}
type RequestTraceOptions ¶
type RequestTraceOptions struct { // Enable switches tracing on or off Enable bool // ExcludePlannerStats excludes planner timing information from the trace output ExcludePlannerStats bool // ExcludeRawInputData excludes the raw input for a load operation from the trace output ExcludeRawInputData bool // ExcludeInput excludes the rendered input for a load operation from the trace output ExcludeInput bool // ExcludeOutput excludes the result of a load operation from the trace output ExcludeOutput bool // ExcludeLoadStats excludes the load timing information from the trace output ExcludeLoadStats bool // EnablePredictableDebugTimings makes the timings in the trace output predictable for debugging purposes EnablePredictableDebugTimings bool IncludeTraceOutputInResponseExtensions bool }
func (*RequestTraceOptions) DisableAll ¶
func (r *RequestTraceOptions) DisableAll()
func (*RequestTraceOptions) EnableAll ¶
func (r *RequestTraceOptions) EnableAll()
type Resolvable ¶
type Resolvable struct {
// contains filtered or unexported fields
}
func NewResolvable ¶
func NewResolvable() *Resolvable
func (*Resolvable) Init ¶
func (r *Resolvable) Init(ctx *Context, initialData []byte, operationType ast.OperationType) (err error)
func (*Resolvable) InitSubscription ¶
func (r *Resolvable) InitSubscription(ctx *Context, initialData []byte, postProcessing PostProcessingConfiguration) (err error)
func (*Resolvable) Reset ¶
func (r *Resolvable) Reset()
type ResolvableObjectVariable ¶
type ResolvableObjectVariable struct {
Renderer *GraphQLVariableResolveRenderer
}
func NewResolvableObjectVariable ¶
func NewResolvableObjectVariable(node *Object) *ResolvableObjectVariable
func (*ResolvableObjectVariable) Equals ¶
func (h *ResolvableObjectVariable) Equals(another Variable) bool
func (*ResolvableObjectVariable) GetVariableKind ¶
func (h *ResolvableObjectVariable) GetVariableKind() VariableKind
func (*ResolvableObjectVariable) TemplateSegment ¶
func (h *ResolvableObjectVariable) TemplateSegment() TemplateSegment
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, options ResolverOptions) *Resolver
New returns a new Resolver, ctx.Done() is used to cancel all active subscriptions & streams
func (*Resolver) AsyncResolveGraphQLSubscription ¶
func (r *Resolver) AsyncResolveGraphQLSubscription(ctx *Context, subscription *GraphQLSubscription, writer SubscriptionResponseWriter, id SubscriptionIdentifier) (err error)
func (*Resolver) AsyncUnsubscribeClient ¶
func (*Resolver) AsyncUnsubscribeSubscription ¶
func (r *Resolver) AsyncUnsubscribeSubscription(id SubscriptionIdentifier) error
func (*Resolver) ResolveGraphQLResponse ¶
func (*Resolver) ResolveGraphQLSubscription ¶
func (r *Resolver) ResolveGraphQLSubscription(ctx *Context, subscription *GraphQLSubscription, writer SubscriptionResponseWriter) error
type ResolverOptions ¶
type ResolverOptions struct { // MaxConcurrency limits the number of concurrent resolve operations // if set to 0, no limit is applied // It is advised to set this to a reasonable value to prevent excessive memory usage // Each concurrent resolve operation allocates ~50kb of memory // In addition, there's a limit of how many concurrent requests can be efficiently resolved // This depends on the number of CPU cores available, the complexity of the operations, and the origin services MaxConcurrency int MaxSubscriptionWorkers int Debug bool Reporter Reporter }
type ResponseWriter ¶
type Scalar ¶
type Scalar struct { Path []string Nullable bool Export *FieldExport `json:"export,omitempty"` }
func (*Scalar) NodeNullable ¶
type SegmentType ¶
type SegmentType int
const ( StaticSegmentType SegmentType = iota + 1 VariableSegmentType )
type SerialFetch ¶
type SerialFetch struct { Fetches []Fetch Trace *DataSourceLoadTrace }
SerialFetch - TODO: document better should be used only for object fields which should be fetched serial
func (*SerialFetch) FetchKind ¶
func (_ *SerialFetch) FetchKind() FetchKind
type SimpleResolver ¶
type SimpleResolver struct { }
func NewSimpleResolver ¶
func NewSimpleResolver() *SimpleResolver
type SingleFetch ¶
type SingleFetch struct { FetchConfiguration FetchID int DependsOnFetchIDs []int InputTemplate InputTemplate DataSourceIdentifier []byte Trace *DataSourceLoadTrace Info *FetchInfo }
func (*SingleFetch) FetchKind ¶
func (_ *SingleFetch) FetchKind() FetchKind
type SingleFlightStats ¶
type SingleFlightStats struct { SingleFlightUsed bool }
func GetSingleFlightStats ¶
func GetSingleFlightStats(ctx context.Context) *SingleFlightStats
type StaticString ¶
func (*StaticString) NodeKind ¶
func (_ *StaticString) NodeKind() NodeKind
func (*StaticString) NodeNullable ¶
func (s *StaticString) NodeNullable() bool
func (*StaticString) NodePath ¶
func (s *StaticString) NodePath() []string
type Stats ¶
type StreamField ¶
type StreamField struct {
InitialBatchSize int
}
type String ¶
type String struct { Path []string Nullable bool Export *FieldExport `json:"export,omitempty"` UnescapeResponseJson bool `json:"unescape_response_json,omitempty"` IsTypeName bool `json:"is_type_name,omitempty"` }
func (*String) NodeNullable ¶
type SubscriptionDataSource ¶
type SubscriptionIdentifier ¶
type SubscriptionResponseWriter ¶
type SubscriptionResponseWriter interface { ResponseWriter Flush() Complete() }
type SubscriptionUpdater ¶
type SubscriptionUpdater interface { Update(data []byte) Done() }
type TLSHandshakeDoneStats ¶
type TLSHandshakeStartStats ¶
type TemplateSegment ¶
type TemplateSegment struct { SegmentType SegmentType Data []byte VariableKind VariableKind VariableSourcePath []string Renderer VariableRenderer Segments []TemplateSegment }
type TraceFetch ¶
type TraceFetch struct { Id string `json:"id,omitempty"` Type TraceFetchType `json:"type,omitempty"` Path string `json:"path,omitempty"` DataSourceID string `json:"data_source_id,omitempty"` Fetches []*TraceFetch `json:"fetches,omitempty"` DataSourceLoadTrace *DataSourceLoadTrace `json:"datasource_load_trace,omitempty"` DataSourceLoadTraces []*DataSourceLoadTrace `json:"data_source_load_traces,omitempty"` }
type TraceFetchEvents ¶
type TraceFetchEvents struct {
InputBeforeSourceLoad json.RawMessage `json:"input_before_source_load,omitempty"`
}
type TraceFetchType ¶
type TraceFetchType string
const ( TraceFetchTypeSingle TraceFetchType = "single" TraceFetchTypeParallel TraceFetchType = "parallel" TraceFetchTypeSerial TraceFetchType = "serial" TraceFetchTypeParallelListItem TraceFetchType = "parallelListItem" TraceFetchTypeEntity TraceFetchType = "entity" TraceFetchTypeBatchEntity TraceFetchType = "batchEntity" )
type TraceField ¶
type TraceInfo ¶
type TraceInfo struct { TraceStart time.Time `json:"-"` TraceStartTime string `json:"trace_start_time"` TraceStartUnix int64 `json:"trace_start_unix"` PlannerStats PlannerStats `json:"planner_stats"` // contains filtered or unexported fields }
func GetTraceInfo ¶
type TraceNode ¶
type TraceNode struct { Info *TraceInfo `json:"info,omitempty"` Fetch *TraceFetch `json:"fetch,omitempty"` NodeType TraceNodeType `json:"node_type,omitempty"` Nullable bool `json:"nullable,omitempty"` Path []string `json:"path,omitempty"` Fields []*TraceField `json:"fields,omitempty"` Items []*TraceNode `json:"items,omitempty"` UnescapeResponseJson bool `json:"unescape_response_json,omitempty"` IsTypeName bool `json:"is_type_name,omitempty"` }
type TraceNodeType ¶
type TraceNodeType string
const ( TraceNodeTypeObject TraceNodeType = "object" TraceNodeTypeEmptyObject TraceNodeType = "emptyObject" TraceNodeTypeArray TraceNodeType = "array" TraceNodeTypeEmptyArray TraceNodeType = "emptyArray" TraceNodeTypeNull TraceNodeType = "null" TraceNodeTypeString TraceNodeType = "string" TraceNodeTypeBoolean TraceNodeType = "boolean" TraceNodeTypeInteger TraceNodeType = "integer" TraceNodeTypeFloat TraceNodeType = "float" TraceNodeTypeBigInt TraceNodeType = "bigint" TraceNodeTypeCustom TraceNodeType = "custom" TraceNodeTypeScalar TraceNodeType = "scalar" TraceNodeTypeUnknown TraceNodeType = "unknown" )
type TypeFieldSource ¶
type TypeFieldSource struct {
IDs []string
}
type Variable ¶
type Variable interface { GetVariableKind() VariableKind Equals(another Variable) bool TemplateSegment() TemplateSegment }
type VariableKind ¶
type VariableKind int
const ( ContextVariableKind VariableKind = iota + 1 ObjectVariableKind HeaderVariableKind ResolvableObjectVariableKind ListVariableKind )
type VariableRenderer ¶
type VariableRenderer interface { GetKind() string RenderVariable(ctx context.Context, data []byte, out io.Writer) error }
VariableRenderer is the interface to allow custom implementations of rendering Variables Depending on where a Variable is being used, a different method for rendering is required E.g. a Variable needs to be rendered conforming to the GraphQL specification, when used within a GraphQL Query If a Variable is used within a JSON Object, the contents need to be rendered as a JSON Object