Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DeleteSupport // TODO: For now, use bulkwrite.Delete as a stand-in for delete support. DeleteSupport = providers.Support{BulkWrite: providers.BulkWriteSupport{Delete: true}} ReadSupport = providers.Support{Read: true} WriteSupport = providers.Support{Write: true} NoSupport = providers.Support{} AllSupport = providers.Support{ BulkWrite: providers.BulkWriteSupport{ Delete: true, Insert: true, Update: true, Upsert: true, }, Proxy: true, Read: true, Subscribe: true, Write: true, } )
Quick access to common support levels. nolint:gochecknoglobals
var ErrSupportNotConfigured = errors.New("support not configured")
Functions ¶
func Initialize ¶
func Initialize[T any]( provider providers.Provider, params common.Parameters, constructor ConnectorConstructor[T], ) (conn *T, err error)
Initialize initializes a connector with the given provider and parameters by using Connector as a base type. It runs the constructor with the connector and returns the connector as the specified T type.
Types ¶
type Connector ¶
type Connector struct {
*Transport
}
Connector provides a reusable base for implementing API connectors.
type ConnectorConstructor ¶
ConnectorConstructor is a function that constructs a connector from a connector and an endpoint supportregistry. TODO: Convert this to a type alias for easier usage when we go to go1.24: https://go.dev/doc/go1.24#language
type Deleter ¶
type Deleter interface {
Delete(ctx context.Context, params common.DeleteParams) (*common.DeleteResult, error)
}
Deleter represents the ability to delete objects from a data source.
type EndpointRegistry ¶
type EndpointRegistry struct {
// contains filtered or unexported fields
}
EndpointRegistry manages operation support for provider endpoints. It uses glob pattern matching to determine support levels for endpoints. Read more on how to write these patterns: https://github.com/gobwas/glob
func NewEndpointRegistry ¶
func NewEndpointRegistry(es EndpointRegistryInput) (*EndpointRegistry, error)
func (*EndpointRegistry) GetSupport ¶
func (p *EndpointRegistry) GetSupport(module common.ModuleID, path string) (*providers.Support, error)
GetSupport determines support for an endpoint by matching against registered patterns. Multiple patterns can match, in which case their support levels are combined.
type EndpointRegistryInput ¶
type EndpointRegistryInput map[common.ModuleID][]struct { Endpoint string Support providers.Support // contains filtered or unexported fields }
EndpointSupport defines support configuration for modules and their endpoints. Each key in this map is a module that supports an array of endpoints. Each endpoint is defined by a string and a support level. For example, you may define a root module that supports reading /users/* and /accounts/*, but only supports writing to /users/:id.
type ProviderContext ¶
type ProviderContext struct {
// contains filtered or unexported fields
}
ProviderContext is a component that adds provider information to a connector.
func NewProviderContext ¶
func (*ProviderContext) Module ¶
func (p *ProviderContext) Module() common.ModuleID
func (*ProviderContext) Provider ¶
func (p *ProviderContext) Provider() providers.Provider
func (*ProviderContext) ProviderInfo ¶
func (p *ProviderContext) ProviderInfo() *providers.ProviderInfo
func (*ProviderContext) String ¶
func (p *ProviderContext) String() string
type Reader ¶
type Reader interface { // Read retrieves an object from the data source Read(ctx context.Context, params common.ReadParams) (*common.ReadResult, error) }
Reader represents the ability to read objects from a data source.
type SchemaProvider ¶
type SchemaProvider interface {
ListObjectMetadata(ctx context.Context, objects []string) (*common.ListObjectMetadataResult, error)
}
SchemaProvider represents the ability to retrieve metadata about objects.
type Transport ¶
type Transport struct { ProviderContext // contains filtered or unexported fields }
TODO: Add support for XML, CSV, etc.
func NewTransport ¶
TODO: The JSON client by itself is not providing any functionality right now - this is to only provide continuity for the existing codebase. We should refactor the existing JSON/XML/CSV/HTTP clients to satisfy a common interface, and then hook them up in here.
func (*Transport) HTTPClient ¶
func (c *Transport) HTTPClient() *common.HTTPClient
func (*Transport) JSONHTTPClient ¶
func (c *Transport) JSONHTTPClient() *common.JSONHTTPClient
type Writer ¶
type Writer interface {
Write(ctx context.Context, params common.WriteParams) (*common.WriteResult, error)
}
Writer represents the ability to write objects to a data source.