graphql_datasource

package
v1.38.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigJson

func ConfigJson(config Configuration) json.RawMessage

Types

type Batch added in v1.28.0

type Batch struct {
	// contains filtered or unexported fields
}

func (*Batch) Demultiplex added in v1.28.0

func (b *Batch) Demultiplex(responseBufPair *resolve.BufPair, bufPairs []*resolve.BufPair) (err error)

func (*Batch) Input added in v1.28.0

func (b *Batch) Input() *fastbuffer.FastBuffer

type BatchFactory added in v1.28.0

type BatchFactory struct{}

func NewBatchFactory added in v1.28.0

func NewBatchFactory() *BatchFactory

func (*BatchFactory) CreateBatch added in v1.28.0

func (b *BatchFactory) CreateBatch(inputs [][]byte) (resolve.DataSourceBatch, error)

type Configuration

type Configuration struct {
	Fetch          FetchConfiguration
	Subscription   SubscriptionConfiguration
	Federation     FederationConfiguration
	UpstreamSchema string
}

func (*Configuration) ApplyDefaults

func (c *Configuration) ApplyDefaults()

type Factory

type Factory struct {
	BatchFactory resolve.DataSourceBatchFactory
	HTTPClient   *http.Client
	// contains filtered or unexported fields
}

func (*Factory) Planner

func (f *Factory) Planner(ctx context.Context) plan.DataSourcePlanner

type FederationConfiguration

type FederationConfiguration struct {
	Enabled    bool
	ServiceSDL string
}

type FetchConfiguration

type FetchConfiguration struct {
	URL    string
	Method string
	Header http.Header
}

type GraphQLBody added in v1.21.0

type GraphQLBody struct {
	Query         string          `json:"query,omitempty"`
	OperationName string          `json:"operationName,omitempty"`
	Variables     json.RawMessage `json:"variables,omitempty"`
}

type GraphQLSubscriptionClient added in v1.21.0

type GraphQLSubscriptionClient interface {
	Subscribe(ctx context.Context, options GraphQLSubscriptionOptions, next chan<- []byte) error
}

type GraphQLSubscriptionOptions added in v1.21.0

type GraphQLSubscriptionOptions struct {
	URL    string      `json:"url"`
	Body   GraphQLBody `json:"body"`
	Header http.Header `json:"header"`
}

type Options added in v1.22.0

type Options func(options *opts)

func WithLogger added in v1.22.0

func WithLogger(log abstractlogger.Logger) Options

func WithReadTimeout added in v1.22.0

func WithReadTimeout(timeout time.Duration) Options

type Planner

type Planner struct {
	// contains filtered or unexported fields
}

func (*Planner) ConfigureFetch

func (p *Planner) ConfigureFetch() plan.FetchConfiguration

func (*Planner) ConfigureSubscription

func (p *Planner) ConfigureSubscription() plan.SubscriptionConfiguration

func (*Planner) DataSourcePlanningBehavior

func (p *Planner) DataSourcePlanningBehavior() plan.DataSourcePlanningBehavior

func (*Planner) DownstreamResponseFieldAlias

func (p *Planner) DownstreamResponseFieldAlias(downstreamFieldRef int) (alias string, exists bool)

func (*Planner) EnterArgument

func (p *Planner) EnterArgument(ref int)

func (*Planner) EnterDirective added in v1.34.0

func (p *Planner) EnterDirective(ref int)

func (*Planner) EnterDocument

func (p *Planner) EnterDocument(operation, definition *ast.Document)

func (*Planner) EnterField

func (p *Planner) EnterField(ref int)

func (*Planner) EnterInlineFragment

func (p *Planner) EnterInlineFragment(ref int)

func (*Planner) EnterOperationDefinition

func (p *Planner) EnterOperationDefinition(ref int)

func (*Planner) EnterSelectionSet

func (p *Planner) EnterSelectionSet(ref int)

func (*Planner) EnterVariableDefinition added in v1.34.0

func (p *Planner) EnterVariableDefinition(ref int)

func (*Planner) LeaveDocument

func (p *Planner) LeaveDocument(operation, definition *ast.Document)

func (*Planner) LeaveField

func (p *Planner) LeaveField(ref int)

func (*Planner) LeaveInlineFragment

func (p *Planner) LeaveInlineFragment(ref int)

func (*Planner) LeaveOperationDefinition

func (p *Planner) LeaveOperationDefinition(ref int)

func (*Planner) LeaveSelectionSet

func (p *Planner) LeaveSelectionSet(ref int)

func (*Planner) LeaveVariableDefinition added in v1.34.0

func (p *Planner) LeaveVariableDefinition(_ int)

func (*Planner) Register

func (p *Planner) Register(visitor *plan.Visitor, configuration plan.DataSourceConfiguration, isNested bool) error

type Source

type Source struct {
	// contains filtered or unexported fields
}

func (*Source) Load

func (s *Source) Load(ctx context.Context, input []byte, writer io.Writer) (err error)

type SubscriptionConfiguration

type SubscriptionConfiguration struct {
	URL string
}

type SubscriptionSource added in v1.21.0

type SubscriptionSource struct {
	// contains filtered or unexported fields
}

func (*SubscriptionSource) Start added in v1.21.0

func (s *SubscriptionSource) Start(ctx context.Context, input []byte, next chan<- []byte) error

type WebSocketGraphQLSubscriptionClient added in v1.21.0

type WebSocketGraphQLSubscriptionClient struct {
	// contains filtered or unexported fields
}

WebSocketGraphQLSubscriptionClient is a WebSocket client that allows running multiple subscriptions via the same WebSocket Connection It takes care of de-duplicating WebSocket connections to the same origin under certain circumstances If Hash(URL,Body,Headers) result in the same result, an existing WS connection is re-used

func NewWebSocketGraphQLSubscriptionClient added in v1.21.0

func NewWebSocketGraphQLSubscriptionClient(httpClient *http.Client, ctx context.Context, options ...Options) *WebSocketGraphQLSubscriptionClient

func (*WebSocketGraphQLSubscriptionClient) Subscribe added in v1.21.0

func (c *WebSocketGraphQLSubscriptionClient) Subscribe(ctx context.Context, options GraphQLSubscriptionOptions, next chan<- []byte) error

Subscribe initiates a new GraphQL Subscription with the origin Each WebSocket (WS) to an origin is uniquely identified by the Hash(URL,Headers,Body) If an existing WS with the same ID (Hash) exists, it is being re-used If no connection exists, the client initiates a new one and sends the "init" and "connection ack" messages

Jump to

Keyboard shortcuts

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