pubsub_datasource

package
v2.0.0-...-2764257 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 13 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 Configuration

type Configuration struct {
	Events []EventConfiguration `json:"events"`
}

type Connector

type Connector interface {
	New(ctx context.Context) PubSub
}

type EventConfiguration

type EventConfiguration struct {
	Type      EventType `json:"type"`
	TypeName  string    `json:"typeName"`
	FieldName string    `json:"fieldName"`
	Topic     string    `json:"topic"`
}

type EventType

type EventType string
const (
	EventTypePublish   EventType = "publish"
	EventTypeRequest   EventType = "request"
	EventTypeSubscribe EventType = "subscribe"
)

func EventTypeFromString

func EventTypeFromString(s string) (EventType, error)

type Factory

type Factory struct {
	Connector Connector
}

func (*Factory) Planner

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

type Planner

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

func (*Planner) ConfigureFetch

func (p *Planner) ConfigureFetch() resolve.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) EnterDocument

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

func (*Planner) EnterField

func (p *Planner) EnterField(ref int)

func (*Planner) Register

func (p *Planner) Register(visitor *plan.Visitor, configuration plan.DataSourceConfiguration, dataSourcePlannerConfiguration plan.DataSourcePlannerConfiguration) error

func (*Planner) UpstreamSchema

func (p *Planner) UpstreamSchema(dataSourceConfig plan.DataSourceConfiguration) *ast.Document

type PubSub

type PubSub interface {
	// ID is the unique identifier of the pubsub implementation (e.g. NATS)
	// This is used to uniquely identify a subscription
	ID() string
	// Subscribe starts listening on the given topic and sends the received messages to the given next channel
	Subscribe(ctx context.Context, topic string, updater resolve.SubscriptionUpdater) error
	// Publish sends the given data to the given topic
	Publish(ctx context.Context, topic string, data []byte) error
	// Request sends a request on the given topic and writes the response to the given writer
	Request(ctx context.Context, topic string, data []byte, w io.Writer) error
}

PubSub describe the interface that implements the primitive operations for pubsub

type PublishDataSource

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

func (*PublishDataSource) Load

func (s *PublishDataSource) Load(ctx context.Context, input []byte, w io.Writer) error

type RequestDataSource

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

func (*RequestDataSource) Load

func (s *RequestDataSource) Load(ctx context.Context, input []byte, w io.Writer) error

type SubscriptionSource

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

func (*SubscriptionSource) Start

func (s *SubscriptionSource) Start(ctx *resolve.Context, input []byte, updater resolve.SubscriptionUpdater) error

func (*SubscriptionSource) UniqueRequestID

func (s *SubscriptionSource) UniqueRequestID(ctx *resolve.Context, input []byte, xxh *xxhash.Digest) error

Jump to

Keyboard shortcuts

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