connector

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPConnector

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

HTTPConnector implements the SDK interface of NDC specification

func NewHTTPConnector

func NewHTTPConnector(opts ...Option) *HTTPConnector

NewHTTPConnector creates a HTTP connector instance

func (*HTTPConnector) ApplyNDCHttpSchemas

func (c *HTTPConnector) ApplyNDCHttpSchemas(ctx context.Context, config *configuration.Configuration, schemas []configuration.NDCHttpRuntimeSchema, logger *slog.Logger) error

ApplyNDCHttpSchemas applies slice of raw NDC HTTP schemas to the connector

func (*HTTPConnector) GetCapabilities

GetCapabilities get the connector's capabilities.

func (*HTTPConnector) GetSchema

GetSchema gets the connector's schema.

func (*HTTPConnector) HealthCheck

func (c *HTTPConnector) HealthCheck(ctx context.Context, configuration *configuration.Configuration, state *State) error

HealthCheck checks the health of the connector.

For example, this function should check that the connector is able to reach its data source over the network.

Should throw if the check fails, else resolve.

func (*HTTPConnector) Mutation

func (c *HTTPConnector) Mutation(ctx context.Context, configuration *configuration.Configuration, state *State, request *schema.MutationRequest) (*schema.MutationResponse, error)

Mutation executes a mutation.

func (*HTTPConnector) MutationExplain

func (c *HTTPConnector) MutationExplain(ctx context.Context, configuration *configuration.Configuration, state *State, request *schema.MutationRequest) (*schema.ExplainResponse, error)

MutationExplain explains a mutation by creating an execution plan.

func (*HTTPConnector) ParseConfiguration

func (c *HTTPConnector) ParseConfiguration(ctx context.Context, configurationDir string) (*configuration.Configuration, error)

ParseConfiguration validates the configuration files provided by the user, returning a validated 'Configuration', or throwing an error to prevents Connector startup.

func (*HTTPConnector) Query

func (c *HTTPConnector) Query(ctx context.Context, configuration *configuration.Configuration, state *State, request *schema.QueryRequest) (schema.QueryResponse, error)

Query executes a query.

func (*HTTPConnector) QueryExplain

func (c *HTTPConnector) QueryExplain(ctx context.Context, configuration *configuration.Configuration, state *State, request *schema.QueryRequest) (*schema.ExplainResponse, error)

QueryExplain explains a query by creating an execution plan.

func (*HTTPConnector) TryInitState

func (c *HTTPConnector) TryInitState(ctx context.Context, configuration *configuration.Configuration, metrics *connector.TelemetryState) (*State, error)

TryInitState initializes the connector's in-memory state.

For example, any connection pools, prepared queries, or other managed resources would be allocated here.

In addition, this function should register any connector-specific metrics with the metrics registry.

type Option

type Option (func(*options))

Option is an interface to set custom HTTP connector options

func WithClient

func WithClient(client *http.Client) Option

WithClient sets the custom HTTP client that satisfy the Doer interface

type State

type State struct {
	Tracer *connector.Tracer
}

State is the global state which is shared for every connector request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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