Documentation
¶
Overview ¶
Package driver is an interface that must be implemented by concrete driver implementations of runners.
Index ¶
- func Register(c Config, d Driver)
- type AuthorizeInput
- type AuthorizeOutput
- type Config
- type Driver
- type Error
- type FieldResolveInfo
- type FieldResolveInput
- type FieldResolveOutput
- type InterfaceResolveTypeInfo
- type InterfaceResolveTypeInput
- type InterfaceResolveTypeOutput
- type ScalarParseInput
- type ScalarParseOutput
- type ScalarSerializeInput
- type ScalarSerializeOutput
- type Secrets
- type SetSecretsInput
- type SetSecretsOutput
- type StreamInfo
- type StreamInput
- type StreamMessage
- type StreamOutput
- type StreamReader
- type SubscriptionConnectionInput
- type SubscriptionConnectionOutput
- type SubscriptionListenInput
- type SubscriptionListenOutput
- type SubscriptionListenReader
- type UnionResolveTypeInfo
- type UnionResolveTypeInput
- type UnionResolveTypeOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthorizeInput ¶
type AuthorizeInput struct { Function types.Function `json:"function,omitempty"` Query string `json:"query,omitempty"` OperationName string `json:"operationName,omitempty"` VariableValues map[string]interface{} `json:"variableValues,omitempty"` Protocol interface{} `json:"protocol,omitempty"` }
AuthorizeInput represents data passed to authorize function
type AuthorizeOutput ¶
type AuthorizeOutput struct { Response bool `json:"response,omitempty"` Error *Error `json:"error,omitempty"` }
AuthorizeOutput is an authorize response
type Config ¶
type Config struct { Provider string `json:"provider,omitempty"` Runtime string `json:"runtime,omitempty"` }
Config defines a config that a driver satisfies. Only on driver per config can be definied in registry
type Driver ¶
type Driver interface { // Authorize runs a custom auth code on function Authorize(AuthorizeInput) AuthorizeOutput // SetSecrets defined by user, it's runner's responsibility to pass them // to runtime. SetSecrets(SetSecretsInput) SetSecretsOutput // FieldResolve requests an execution of defined resolver for a field FieldResolve(FieldResolveInput) FieldResolveOutput // InterfaceResolveType requests an execution of defined interface function for a type InterfaceResolveType(InterfaceResolveTypeInput) InterfaceResolveTypeOutput // ScalarParse requests an execution of defined parse function for a scalar ScalarParse(ScalarParseInput) ScalarParseOutput // ScalarSerialize requests an execution of defined serialize function for a scalar ScalarSerialize(ScalarSerializeInput) ScalarSerializeOutput // UnionResolveType requests an execution of defined union function for a type UnionResolveType(UnionResolveTypeInput) UnionResolveTypeOutput // Stream begins streaming data between router and runner. Stream(StreamInput) StreamOutput // SubscriptionConnection creates connection payload for subscription SubscriptionConnection(SubscriptionConnectionInput) SubscriptionConnectionOutput // SubscriptionListen creates connection payload for subscription SubscriptionListen(SubscriptionListenInput) SubscriptionListenOutput }
Driver is an interface that must be defined by an implementation for of specific runner.
type Error ¶
type Error struct {
Message string `json:"message,omitempty"`
}
Error passed between runner and router
type FieldResolveInfo ¶
type FieldResolveInfo struct { FieldName string `json:"fieldName"` Path *types.ResponsePath `json:"path,omitempty"` ReturnType *types.TypeRef `json:"returnType,omitempty"` ParentType *types.TypeRef `json:"parentType,omitempty"` Operation *types.OperationDefinition `json:"operation,omitempty"` VariableValues map[string]interface{} `json:"variableValues,omitempty"` RootValue interface{} `json:"rootValue,omitempty"` }
FieldResolveInfo defines information about current field resolution
type FieldResolveInput ¶
type FieldResolveInput struct { Function types.Function Source interface{} `json:"source,omitempty"` Arguments types.Arguments `json:"arguments,omitempty"` Info FieldResolveInfo `json:"info"` Protocol interface{} `json:"protocol,omitempty"` SubscriptionPayload interface{} `json:"subscriptionPayload,omitempty"` }
FieldResolveInput represents data passed to field resolution
type FieldResolveOutput ¶
type FieldResolveOutput struct { Response interface{} `json:"response,omitempty"` Error *Error `json:"error,omitempty"` }
FieldResolveOutput is a result of a field resolution
type InterfaceResolveTypeInfo ¶
type InterfaceResolveTypeInfo struct { FieldName string `json:"fieldName"` Path *types.ResponsePath `json:"path,omitempty"` ReturnType *types.TypeRef `json:"returnType,omitempty"` ParentType *types.TypeRef `json:"parentType,omitempty"` Operation *types.OperationDefinition `json:"operation,omitempty"` VariableValues map[string]interface{} `json:"variableValues,omitempty"` }
InterfaceResolveTypeInfo contains information about current state of query for interface type resolution
type InterfaceResolveTypeInput ¶
type InterfaceResolveTypeInput struct { Function types.Function Value interface{} Info InterfaceResolveTypeInfo }
InterfaceResolveTypeInput represents a request of interface type resolution for GraphQL query
type InterfaceResolveTypeOutput ¶
InterfaceResolveTypeOutput represents an output returned by runner for request of interface type resolution
type ScalarParseInput ¶
type ScalarParseOutput ¶
type ScalarParseOutput struct { Response interface{} `json:"response,omitempty"` Error *Error `json:"error,omitempty"` }
type ScalarSerializeInput ¶
type ScalarSerializeOutput ¶
type ScalarSerializeOutput struct { Response interface{} `json:"response,omitempty"` Error *Error `json:"error,omitempty"` }
type SetSecretsInput ¶
type SetSecretsInput struct { // Secrets is a map of references which driver uses to populate secrets map Secrets Secrets }
type SetSecretsOutput ¶
type SetSecretsOutput struct {
Error *Error `json:"error,omitempty"`
}
type StreamInfo ¶
type StreamInfo struct { FieldName string `json:"fieldName"` Path *types.ResponsePath `json:"path,omitempty"` ReturnType *types.TypeRef `json:"returnType,omitempty"` ParentType *types.TypeRef `json:"parentType,omitempty"` Operation *types.OperationDefinition `json:"operation,omitempty"` VariableValues map[string]interface{} `json:"variableValues,omitempty"` }
type StreamInput ¶
type StreamMessage ¶
type StreamMessage struct { Response interface{} `json:"response,omitempty"` Error *Error `json:"error,"` }
type StreamOutput ¶
type StreamOutput struct { Error *Error Reader StreamReader }
type StreamReader ¶
type StreamReader interface { // Error returns the status of stream that is no longer available for reading, if there was no error and stream was properly closed, it returns nil. Error() error // Next is blocking operation that waits until next message is available or until stream is no longer available for reading. When next message is available function returns true, otherwise it returns false. Next() bool // Read returns next message in stream. Read can only by called after Next that returned true. Read() StreamMessage // Close stream Close() }
type SubscriptionConnectionInput ¶
type SubscriptionConnectionInput struct { Function types.Function Query string `json:"query,omitempty"` VariableValues map[string]interface{} `json:"variableValues,omitempty"` OperationName string `json:"operationName,omitempty"` Protocol interface{} `json:"protocol,omitempty"` Operation *types.OperationDefinition `json:"operation,omitempty"` }
SubscriptionConnectionInput represents input to a function which creates subscription connection data
type SubscriptionConnectionOutput ¶
type SubscriptionConnectionOutput struct { Response interface{} `json:"response,omitempty"` Error *Error `json:"error,omitempty"` }
SubscriptionConnectionOutput represents response from a function which creates subscription connection data
type SubscriptionListenInput ¶
type SubscriptionListenInput struct { Function types.Function Query string `json:"query,omitempty"` VariableValues map[string]interface{} `json:"variableValues,omitempty"` OperationName string `json:"operationName,omitempty"` Protocol interface{} `json:"protocol,omitempty"` Operation *types.OperationDefinition `json:"operation,omitempty"` }
SubscriptionListenInput represents input to a function which listen on events that trigger subscription
type SubscriptionListenOutput ¶
type SubscriptionListenOutput struct { Error *Error `json:"error,omitempty"` Reader SubscriptionListenReader }
SubscriptionListenOutput represents response from a function which listen on events that trigger subscription
type SubscriptionListenReader ¶
type SubscriptionListenReader interface { // Error returns the status of subscription listener that is no longer available for reading, if there was no error and stream was properly closed, it returns nil. Error() error // Next is blocking call that returns true when a new subscription should be started or false when listener is finished. Next() bool // Read returns a value emited by listen reader or nil if none. Each call must be preceded by a Next call that returns true. // It is considered an error to call Next and Read asynchronously. Read() (interface{}, error) // Close closes the reader Close() error }
SubscriptionListenReader is a simple interface that listens for pings from backing function
type UnionResolveTypeInfo ¶
type UnionResolveTypeInfo struct { FieldName string `json:"fieldName"` Path *types.ResponsePath `json:"path,omitempty"` ReturnType *types.TypeRef `json:"returnType,omitempty"` ParentType *types.TypeRef `json:"parentType,omitempty"` Operation *types.OperationDefinition `json:"operation,omitempty"` VariableValues map[string]interface{} `json:"variableValues,omitempty"` }
type UnionResolveTypeInput ¶
type UnionResolveTypeInput struct { Function types.Function Value interface{} Info UnionResolveTypeInfo }