Documentation ¶
Index ¶
- Constants
- Variables
- func JSONSchemaValidator(jsonSchema string) (*jsonschema.Schema, error)
- func MatchesTable(name string, includeTablesPattern []string, skipTablesPattern []string) bool
- func RecordsDiff(sc *arrow.Schema, have, want []arrow.Record) string
- func TableDiff(have, want arrow.Table) string
- func TestWriterSuiteRunner(t *testing.T, p *Plugin, tests WriterTestSuiteTests, ...)
- func TotalRows(records []arrow.Record) int64
- func ValidateNoEmptyColumns(t *testing.T, tables schema.Tables, messages message.SyncMessages)
- func WithRandomSeed(seed int64) func(o *WriterTestSuite)
- func WithTestDataOptions(opts schema.TestSourceOptions) func(o *WriterTestSuite)
- func WithTestIgnoreNullsInLists() func(o *WriterTestSuite)
- func WithTestSourceAllowNull(allowNull func(arrow.DataType) bool) func(o *WriterTestSuite)
- type AllowNullFunc
- type BackendOptions
- type BuildTarget
- type Client
- type DestinationClient
- type Kind
- type MigrateMode
- type NewClientFunc
- type NewClientOptions
- type NewPluginFunc
- type NewSourceClientFunc
- type Option
- type PackageType
- type Plugin
- func (p *Plugin) Close(ctx context.Context) error
- func (p *Plugin) Init(ctx context.Context, spec []byte, options NewClientOptions) error
- func (p *Plugin) Name() string
- func (p *Plugin) Read(ctx context.Context, table *schema.Table, res chan<- arrow.Record) error
- func (p *Plugin) SetLogger(logger zerolog.Logger)
- func (p *Plugin) Sync(ctx context.Context, options SyncOptions, res chan<- message.SyncMessage) error
- func (p *Plugin) SyncAll(ctx context.Context, options SyncOptions) (message.SyncMessages, error)
- func (p *Plugin) Tables(ctx context.Context, options TableOptions) (schema.Tables, error)
- func (p *Plugin) Targets() []BuildTarget
- func (p *Plugin) Version() string
- func (p *Plugin) Write(ctx context.Context, res <-chan message.WriteMessage) error
- func (p *Plugin) WriteAll(ctx context.Context, resources []message.WriteMessage) error
- type SafeMigrations
- type SourceClient
- type SyncOptions
- type TableOptions
- type UnimplementedDestination
- type UnimplementedSource
- type WriterTestSuite
- type WriterTestSuiteTests
Constants ¶
const ( GoOSLinux = "linux" GoOSWindows = "windows" GoOSDarwin = "darwin" GoArchAmd64 = "amd64" GoArchArm64 = "arm64" )
Variables ¶
var DefaultBuildTargets = []BuildTarget{ {GoOSLinux, GoArchAmd64}, {GoOSWindows, GoArchAmd64}, {GoOSDarwin, GoArchAmd64}, {GoOSDarwin, GoArchArm64}, }
var ErrNotImplemented = fmt.Errorf("not implemented")
Functions ¶
func JSONSchemaValidator ¶ added in v4.10.0
func MatchesTable ¶
func RecordsDiff ¶ added in v4.5.2
func TestWriterSuiteRunner ¶
func TestWriterSuiteRunner(t *testing.T, p *Plugin, tests WriterTestSuiteTests, opts ...func(o *WriterTestSuite))
func ValidateNoEmptyColumns ¶ added in v4.1.0
func WithRandomSeed ¶ added in v4.1.0
func WithRandomSeed(seed int64) func(o *WriterTestSuite)
func WithTestDataOptions ¶
func WithTestDataOptions(opts schema.TestSourceOptions) func(o *WriterTestSuite)
func WithTestIgnoreNullsInLists ¶
func WithTestIgnoreNullsInLists() func(o *WriterTestSuite)
func WithTestSourceAllowNull ¶
func WithTestSourceAllowNull(allowNull func(arrow.DataType) bool) func(o *WriterTestSuite)
Types ¶
type AllowNullFunc ¶
type BackendOptions ¶
type BuildTarget ¶ added in v4.5.0
type Client ¶
type Client interface { SourceClient DestinationClient }
type DestinationClient ¶
type MigrateMode ¶
type MigrateMode int
const ( MigrateModeSafe MigrateMode = iota MigrateModeForce )
func (MigrateMode) String ¶
func (m MigrateMode) String() string
type NewClientFunc ¶
type NewClientOptions ¶
type NewClientOptions struct {
NoConnection bool
}
type NewPluginFunc ¶
type NewPluginFunc func() *Plugin
type NewSourceClientFunc ¶
type Option ¶
type Option func(*Plugin)
func WithBuildTargets ¶ added in v4.8.0
func WithBuildTargets(targets []BuildTarget) Option
func WithJSONSchema ¶ added in v4.9.0
type PackageType ¶ added in v4.5.0
type PackageType string
const (
PackageTypeNative PackageType = "native"
)
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is the base structure required to pass to sdk.serve We take a declarative approach to API here similar to Cobra
func NewPlugin ¶
func NewPlugin(name string, version string, newClient NewClientFunc, options ...Option) *Plugin
NewPlugin returns a new CloudQuery Plugin with the given name, version and implementation. Depending on the options, it can be a write-only plugin, read-only plugin, or both.
func NewSourcePlugin ¶
func NewSourcePlugin(name string, version string, newClient NewSourceClientFunc, options ...Option) *Plugin
NewSourcePlugin returns a new CloudQuery Plugin with the given name, version and implementation. Source plugins only support read operations. For Read & Write plugin use NewPlugin.
func (*Plugin) Read ¶
Read is read data from the requested table to the given channel, returned in the same format as the table
func (*Plugin) Sync ¶
func (p *Plugin) Sync(ctx context.Context, options SyncOptions, res chan<- message.SyncMessage) error
Sync is syncing data from the requested tables in spec to the given channel
func (*Plugin) SyncAll ¶
func (p *Plugin) SyncAll(ctx context.Context, options SyncOptions) (message.SyncMessages, error)
func (*Plugin) Targets ¶ added in v4.5.0
func (p *Plugin) Targets() []BuildTarget
type SafeMigrations ¶
type SafeMigrations struct { AddColumn bool AddColumnNotNull bool RemoveColumn bool RemoveColumnNotNull bool ChangeColumn bool }
SafeMigrations defines which migrations are supported by the plugin in safe migrate mode
type SourceClient ¶
type SourceClient interface { Close(ctx context.Context) error Tables(ctx context.Context, options TableOptions) (schema.Tables, error) Sync(ctx context.Context, options SyncOptions, res chan<- message.SyncMessage) error }
type SyncOptions ¶
type SyncOptions struct { Tables []string SkipTables []string SkipDependentTables bool DeterministicCQID bool BackendOptions *BackendOptions }
type TableOptions ¶
type UnimplementedDestination ¶
type UnimplementedDestination struct{}
func (UnimplementedDestination) Write ¶
func (UnimplementedDestination) Write(context.Context, <-chan message.WriteMessage) error
type UnimplementedSource ¶
type UnimplementedSource struct{}
func (UnimplementedSource) Sync ¶
func (UnimplementedSource) Sync(context.Context, SyncOptions, chan<- message.SyncMessage) error
func (UnimplementedSource) Tables ¶
func (UnimplementedSource) Tables(context.Context, TableOptions) (schema.Tables, error)
type WriterTestSuite ¶
type WriterTestSuite struct {
// contains filtered or unexported fields
}
type WriterTestSuiteTests ¶
type WriterTestSuiteTests struct { // SkipUpsert skips testing with message.Insert and Upsert=true. // Usually when a destination is not supporting primary keys SkipUpsert bool // SkipDeleteStale skips testing message.Delete events. SkipDeleteStale bool // SkipAppend skips testing message.Insert and Upsert=false. SkipInsert bool // SkipMigrate skips testing migration SkipMigrate bool // SafeMigrations defines which tests should work with force migration // and which should pass with safe migration SafeMigrations SafeMigrations }