Documentation ¶
Index ¶
- Constants
- func CreateTypeFieldArgumentsLookupMap(typeFieldArgs []graphql.TypeFieldArguments) map[TypeFieldLookupKey]graphql.TypeFieldArguments
- func LoadStringVariable(variable *nodev1.ConfigurationVariable) string
- func LookupStringVariable(variable *nodev1.ConfigurationVariable) (string, bool)
- type Configuration
- func (e *Configuration) AddDataSource(dataSource plan.DataSource)
- func (e *Configuration) AddFieldConfiguration(fieldConfig plan.FieldConfiguration)
- func (e *Configuration) DataSources() []plan.DataSource
- func (e *Configuration) FieldConfigurations() plan.FieldConfigurations
- func (e *Configuration) Schema() *graphql.Schema
- func (e *Configuration) SetCustomResolveMap(customResolveMap map[string]resolve.CustomResolve)
- func (e *Configuration) SetDataSources(dataSources []plan.DataSource)
- func (e *Configuration) SetFieldConfigurations(fieldConfigs plan.FieldConfigurations)
- func (e *Configuration) SetWebsocketBeforeStartHook(hook WebsocketBeforeStartHook)
- type DataSourceGeneratorOption
- type ExecutionEngine
- type ExecutionOptions
- type FederationEngineConfigFactory
- type FederationEngineConfigFactoryOption
- func WithCustomResolveMap(customResolveMap map[string]resolve.CustomResolve) FederationEngineConfigFactoryOption
- func WithFederationHttpClient(client *http.Client) FederationEngineConfigFactoryOption
- func WithFederationStreamingClient(client *http.Client) FederationEngineConfigFactoryOption
- func WithFederationSubscriptionClientFactory(factory graphql_datasource.GraphQLSubscriptionClientFactory) FederationEngineConfigFactoryOption
- func WithFederationSubscriptionType(subscriptionType SubscriptionType) FederationEngineConfigFactoryOption
- type LocalTypeFieldExtractor
- type ProxyEngineConfigFactory
- type ProxyEngineConfigFactoryOption
- func WithDataSourceID(id string) ProxyEngineConfigFactoryOption
- func WithProxyHttpClient(client *http.Client) ProxyEngineConfigFactoryOption
- func WithProxyStreamingClient(client *http.Client) ProxyEngineConfigFactoryOption
- func WithProxySubscriptionClientFactory(factory graphqlDataSource.GraphQLSubscriptionClientFactory) ProxyEngineConfigFactoryOption
- type ProxyUpstreamConfig
- type SubgraphConfiguration
- type SubscriptionProtocol
- type SubscriptionType
- type TypeFieldLookupKey
- type WebsocketBeforeStartHook
Constants ¶
const ( // SubscriptionTypeUnknown is for unknown or undefined subscriptions. SubscriptionTypeUnknown = iota // SubscriptionTypeSSE is for Server-Sent Events (SSE) subscriptions. SubscriptionTypeSSE // SubscriptionTypeGraphQLWS is for subscriptions using a WebSocket connection with // 'graphql-ws' as protocol. SubscriptionTypeGraphQLWS // SubscriptionTypeGraphQLTransportWS is for subscriptions using a WebSocket connection with // 'graphql-transport-ws' as protocol. SubscriptionTypeGraphQLTransportWS )
const (
DefaultFlushIntervalInMilliseconds = 1000
)
Variables ¶
This section is empty.
Functions ¶
func CreateTypeFieldArgumentsLookupMap ¶
func CreateTypeFieldArgumentsLookupMap(typeFieldArgs []graphql.TypeFieldArguments) map[TypeFieldLookupKey]graphql.TypeFieldArguments
func LoadStringVariable ¶
func LoadStringVariable(variable *nodev1.ConfigurationVariable) string
LoadStringVariable is a shorthand for LookupStringVariable when you do not care about the value being explicitly set
func LookupStringVariable ¶
func LookupStringVariable(variable *nodev1.ConfigurationVariable) (string, bool)
LookupStringVariable returns the value for the given configuration variable as well as whether it was explicitly set. If the variable is nil or the environment variable it references is not set, it returns false as its second value. Otherwise, (e.g. environment variable set but empty, static string), the second return value is true. If you don't need to know if the variable was explicitly set, use LoadStringVariable.
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
func NewConfiguration ¶
func NewConfiguration(schema *graphql.Schema) Configuration
func (*Configuration) AddDataSource ¶
func (e *Configuration) AddDataSource(dataSource plan.DataSource)
func (*Configuration) AddFieldConfiguration ¶
func (e *Configuration) AddFieldConfiguration(fieldConfig plan.FieldConfiguration)
func (*Configuration) DataSources ¶
func (e *Configuration) DataSources() []plan.DataSource
func (*Configuration) FieldConfigurations ¶
func (e *Configuration) FieldConfigurations() plan.FieldConfigurations
func (*Configuration) Schema ¶
func (e *Configuration) Schema() *graphql.Schema
func (*Configuration) SetCustomResolveMap ¶
func (e *Configuration) SetCustomResolveMap(customResolveMap map[string]resolve.CustomResolve)
func (*Configuration) SetDataSources ¶
func (e *Configuration) SetDataSources(dataSources []plan.DataSource)
func (*Configuration) SetFieldConfigurations ¶
func (e *Configuration) SetFieldConfigurations(fieldConfigs plan.FieldConfigurations)
func (*Configuration) SetWebsocketBeforeStartHook ¶
func (e *Configuration) SetWebsocketBeforeStartHook(hook WebsocketBeforeStartHook)
SetWebsocketBeforeStartHook - sets before start hook which will be called before processing any operation sent over websockets
type DataSourceGeneratorOption ¶
type DataSourceGeneratorOption func(options *dataSourceGeneratorOptions)
func WithDataSourceGeneratorSubscriptionClientFactory ¶
func WithDataSourceGeneratorSubscriptionClientFactory(factory graphql_datasource.GraphQLSubscriptionClientFactory) DataSourceGeneratorOption
func WithDataSourceGeneratorSubscriptionConfiguration ¶
func WithDataSourceGeneratorSubscriptionConfiguration(streamingClient *http.Client, subscriptionType SubscriptionType) DataSourceGeneratorOption
type ExecutionEngine ¶
type ExecutionEngine struct {
// contains filtered or unexported fields
}
func NewExecutionEngine ¶
func NewExecutionEngine(ctx context.Context, logger abstractlogger.Logger, engineConfig Configuration, resolverOptions resolve.ResolverOptions) (*ExecutionEngine, error)
func (*ExecutionEngine) Execute ¶
func (e *ExecutionEngine) Execute(ctx context.Context, operation *graphql.Request, writer resolve.SubscriptionResponseWriter, options ...ExecutionOptions) error
func (*ExecutionEngine) GetWebsocketBeforeStartHook ¶
func (e *ExecutionEngine) GetWebsocketBeforeStartHook() WebsocketBeforeStartHook
type ExecutionOptions ¶
type ExecutionOptions func(ctx *internalExecutionContext)
func WithAdditionalHttpHeaders ¶
func WithAdditionalHttpHeaders(headers http.Header, excludeByKeys ...string) ExecutionOptions
func WithRequestTraceOptions ¶
func WithRequestTraceOptions(options resolve.TraceOptions) ExecutionOptions
type FederationEngineConfigFactory ¶
type FederationEngineConfigFactory struct {
// contains filtered or unexported fields
}
FederationEngineConfigFactory is used to create an engine config for a supergraph with multiple data sources for subgraphs.
func NewFederationEngineConfigFactory ¶
func NewFederationEngineConfigFactory(engineCtx context.Context, subgraphsConfigs []SubgraphConfiguration, opts ...FederationEngineConfigFactoryOption) *FederationEngineConfigFactory
func (*FederationEngineConfigFactory) BuildEngineConfiguration ¶
func (f *FederationEngineConfigFactory) BuildEngineConfiguration() (conf Configuration, err error)
func (*FederationEngineConfigFactory) LoadInternedString ¶
func (f *FederationEngineConfigFactory) LoadInternedString(engineConfig *nodev1.EngineConfiguration, str *nodev1.InternedString) (string, error)
type FederationEngineConfigFactoryOption ¶
type FederationEngineConfigFactoryOption func(options *federationEngineConfigFactoryOptions)
func WithCustomResolveMap ¶
func WithCustomResolveMap(customResolveMap map[string]resolve.CustomResolve) FederationEngineConfigFactoryOption
func WithFederationHttpClient ¶
func WithFederationHttpClient(client *http.Client) FederationEngineConfigFactoryOption
func WithFederationStreamingClient ¶
func WithFederationStreamingClient(client *http.Client) FederationEngineConfigFactoryOption
func WithFederationSubscriptionClientFactory ¶
func WithFederationSubscriptionClientFactory(factory graphql_datasource.GraphQLSubscriptionClientFactory) FederationEngineConfigFactoryOption
func WithFederationSubscriptionType ¶
func WithFederationSubscriptionType(subscriptionType SubscriptionType) FederationEngineConfigFactoryOption
type LocalTypeFieldExtractor ¶
type LocalTypeFieldExtractor struct {
// contains filtered or unexported fields
}
LocalTypeFieldExtractor takes an ast.Document as input and generates the TypeField configuration for both root and child nodes. Root nodes are the root operation types (usually Query, Mutation and Schema--though these types can be configured via the schema keyword) plus "entities" as defined by the Apollo federation specification. In short, entities are types with a @key directive. Child nodes are field types recursively accessible via a root node. Nodes are either object or interface definitions or extensions. Root nodes only include "local" fields; they don't include fields that have the @external directive.
func NewLocalTypeFieldExtractor ¶
func NewLocalTypeFieldExtractor(document *ast.Document) *LocalTypeFieldExtractor
func (*LocalTypeFieldExtractor) GetAllNodes ¶
func (e *LocalTypeFieldExtractor) GetAllNodes() (rootNodes []plan.TypeField, childNodes []plan.TypeField)
GetAllNodes returns all root and child nodes in the document associated with the LocalTypeFieldExtractor. See LocalTypeFieldExtractor for a detailed explanation of what root and child nodes are.
type ProxyEngineConfigFactory ¶
type ProxyEngineConfigFactory struct {
// contains filtered or unexported fields
}
ProxyEngineConfigFactory is used to create an engine config with a single upstream and a single data source for this upstream.
func NewProxyEngineConfigFactory ¶
func NewProxyEngineConfigFactory(engineCtx context.Context, schema *graphql.Schema, proxyUpstreamConfig ProxyUpstreamConfig, opts ...ProxyEngineConfigFactoryOption) *ProxyEngineConfigFactory
func (*ProxyEngineConfigFactory) EngineConfiguration ¶
func (p *ProxyEngineConfigFactory) EngineConfiguration() (Configuration, error)
type ProxyEngineConfigFactoryOption ¶
type ProxyEngineConfigFactoryOption func(options *proxyEngineConfigFactoryOptions)
func WithDataSourceID ¶
func WithDataSourceID(id string) ProxyEngineConfigFactoryOption
func WithProxyHttpClient ¶
func WithProxyHttpClient(client *http.Client) ProxyEngineConfigFactoryOption
func WithProxyStreamingClient ¶
func WithProxyStreamingClient(client *http.Client) ProxyEngineConfigFactoryOption
func WithProxySubscriptionClientFactory ¶
func WithProxySubscriptionClientFactory(factory graphqlDataSource.GraphQLSubscriptionClientFactory) ProxyEngineConfigFactoryOption
type ProxyUpstreamConfig ¶
type ProxyUpstreamConfig struct { URL string Method string StaticHeaders http.Header SubscriptionType SubscriptionType }
ProxyUpstreamConfig holds configuration to configure a single data source to a single upstream.
type SubgraphConfiguration ¶
type SubgraphConfiguration struct { Name string URL string SDL string SubscriptionUrl string SubscriptionProtocol SubscriptionProtocol }
type SubscriptionProtocol ¶
type SubscriptionProtocol string
const ( SubscriptionProtocolWS SubscriptionProtocol = "ws" SubscriptionProtocolSSE SubscriptionProtocol = "sse" SubscriptionProtocolSSEPost SubscriptionProtocol = "sse_post" )
type SubscriptionType ¶
type SubscriptionType int
type TypeFieldLookupKey ¶
type TypeFieldLookupKey string
func CreateTypeFieldLookupKey ¶
func CreateTypeFieldLookupKey(typeName string, fieldName string) TypeFieldLookupKey