plugins

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MPL-2.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

View Source
const ExampleSourceConfig = `` /* 294-byte string literal not displayed */

Variables

This section is empty.

Functions

func TestSourcePluginSync added in v0.0.4

func TestSourcePluginSync(t *testing.T, plugin *SourcePlugin, spec specs.Source)

Types

type DestinationPlugin

type DestinationPlugin interface {
	Name() string
	Version() string
	ExampleConfig() string
	Initialize(ctx context.Context, spec specs.Destination) error
	Migrate(ctx context.Context, tables schema.Tables) error
	Write(ctx context.Context, table string, data map[string]interface{}) error
	SetLogger(logger zerolog.Logger)
}

type ResourceTestCase

type ResourceTestCase struct {
	Plugin *SourcePlugin
	Spec   specs.Source
	// ParallelFetchingLimit limits parallel resources fetch at a time
	ParallelFetchingLimit uint64
	// SkipIgnoreInTest flag which detects if schema.Table or schema.Column should be ignored
	SkipIgnoreInTest bool
	// Verifiers are map from resource name to its verifiers.
	// If no verifiers specified for resource (resource name is not in key set of map),
	// non emptiness check of all columns in table and its relations will be performed.
	Verifiers map[string][]Verifier
}

type SourceNewExecutionClientFunc added in v0.0.4

type SourceNewExecutionClientFunc func(context.Context, *SourcePlugin, specs.Source) (schema.ClientMeta, error)

type SourceOption added in v0.0.4

type SourceOption func(*SourcePlugin)

func WithClassifyError added in v0.0.4

func WithClassifyError(ignoreError schema.IgnoreErrorFunc) SourceOption

func WithSourceExampleConfig added in v0.0.4

func WithSourceExampleConfig(exampleConfig string) SourceOption

func WithSourceLogger added in v0.0.4

func WithSourceLogger(logger zerolog.Logger) SourceOption

type SourcePlugin

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

SourcePlugin is the base structure required to pass to sdk.serve We take a similar/declerative approach to API here similar to Cobra

func NewSourcePlugin added in v0.0.4

func NewSourcePlugin(name string, version string, tables []*schema.Table, newExecutionClient SourceNewExecutionClientFunc, opts ...SourceOption) *SourcePlugin

func (*SourcePlugin) ExampleConfig

func (p *SourcePlugin) ExampleConfig() (string, error)

func (*SourcePlugin) Name

func (p *SourcePlugin) Name() string

func (*SourcePlugin) SetLogger added in v0.0.4

func (p *SourcePlugin) SetLogger(log zerolog.Logger)

func (*SourcePlugin) Sync added in v0.0.4

func (p *SourcePlugin) Sync(ctx context.Context, spec specs.Source, res chan<- *schema.Resource) error

Sync data from source to the given channel

func (*SourcePlugin) Tables

func (p *SourcePlugin) Tables() schema.Tables

func (*SourcePlugin) Version

func (p *SourcePlugin) Version() string

type Verifier

type Verifier func(t *testing.T, table *schema.Table, conn pgxscan.Querier, shouldSkipIgnoreInTest bool)

Verifier verifies tables specified by table schema (main table and its relations).

Jump to

Keyboard shortcuts

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