{"modulePath":"github.com/cloudquery/plugin-sdk/v3","version":"v3.10.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package destination\n\n## Functions\n\n```go\nfunc PluginTestSuiteRunner(t *testing.T, newPlugin NewPluginFunc, destSpec specs.Destination, tests PluginTestSuiteTests, testOptions ...func(o *PluginTestSuiteRunnerOptions))\n```\n\n```go\nfunc RecordDiff(l, r arrow.Record) string\n```\n\n```go\nfunc WithTestIgnoreNullsInLists() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceAllowNull(allowNull func(arrow.DataType) bool) func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipDates() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipDecimals() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipDurations() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipIntervals() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipLargeTypes() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipLists() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipMaps() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipStructs() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipTimes() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceSkipTimestamps() func(o *PluginTestSuiteRunnerOptions)\n```\n\n```go\nfunc WithTestSourceTimePrecision(precision time.Duration) func(o *PluginTestSuiteRunnerOptions)\n```\n\n## Types\n\n```go\ntype AllowNullFunc func(arrow.DataType) bool\n```\n\n```go\ntype Client interface {\n\tMigrate(ctx context.Context, tables schema.Tables) error\n\tRead(ctx context.Context, table *schema.Table, sourceName string, res chan\u003c- arrow.Record) error\n\tManagedWriter\n\tUnmanagedWriter\n\tDeleteStale(ctx context.Context, tables schema.Tables, sourceName string, syncTime time.Time) error\n\tClose(ctx context.Context) error\n}\n```\n\n```go\ntype ClientResource struct {\n\tTableName string\n\tData      []any\n}\n```\n\n```go\ntype ManagedWriter interface {\n\tWriteTableBatch(ctx context.Context, table *schema.Table, data []arrow.Record) error\n}\n```\n\n```go\ntype Metrics struct {\n\t// Errors number of errors / failed writes\n\tErrors uint64\n\t// Writes number of successful writes\n\tWrites uint64\n}\n```\n\n```go\ntype MigrateStrategy struct {\n\tAddColumn           specs.MigrateMode\n\tAddColumnNotNull    specs.MigrateMode\n\tRemoveColumn        specs.MigrateMode\n\tRemoveColumnNotNull specs.MigrateMode\n\tChangeColumn        specs.MigrateMode\n}\n```\nMigrateStrategy defines which tests we should include\n\n```go\ntype NewClientFunc func(context.Context, zerolog.Logger, specs.Destination) (Client, error)\n```\n\n```go\ntype NewPluginFunc func() *Plugin\n```\n\n```go\ntype Option func(*Plugin)\n```\n\n```go\nfunc WithBatchTimeout(seconds int) Option\n```\n\n```go\nfunc WithDefaultBatchSize(defaultBatchSize int) Option\n```\n\n```go\nfunc WithDefaultBatchSizeBytes(defaultBatchSizeBytes int) Option\n```\n\n```go\nfunc WithManagedWriter() Option\n```\n\n```go\ntype Plugin struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewPlugin(name string, version string, newClientFunc NewClientFunc, opts ...Option) *Plugin\n```\nNewPlugin creates a new destination plugin\n\n```go\nfunc (p *Plugin) Close(ctx context.Context) error\n```\n\n```go\nfunc (p *Plugin) DeleteStale(ctx context.Context, tables schema.Tables, sourceName string, syncTime time.Time) error\n```\n\n```go\nfunc (p *Plugin) Init(ctx context.Context, logger zerolog.Logger, spec specs.Destination) error\n```\nwe need lazy loading because we want to be able to initialize after\n\n```go\nfunc (p *Plugin) Metrics() Metrics\n```\n\n```go\nfunc (p *Plugin) Migrate(ctx context.Context, tables schema.Tables) error\n```\nwe implement all DestinationClient functions so we can hook into pre-post behavior\n\n```go\nfunc (p *Plugin) Name() string\n```\n\n```go\nfunc (p *Plugin) Read(ctx context.Context, table *schema.Table, sourceName string, res chan\u003c- arrow.Record) error\n```\n\n```go\nfunc (p *Plugin) Version() string\n```\n\n```go\nfunc (p *Plugin) Write(ctx context.Context, sourceSpec specs.Source, tables schema.Tables, syncTime time.Time, res \u003c-chan arrow.Record) error\n```\n\n```go\ntype PluginTestSuite struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype PluginTestSuiteRunnerOptions struct {\n\t// IgnoreNullsInLists allows stripping null values from lists before comparison.\n\t// Destination setups that don't support nulls in lists should set this to true.\n\tIgnoreNullsInLists bool\n\n\t// AllowNull is a custom func to determine whether a data type may be correctly represented as null.\n\t// Destinations that have problems representing some data types should provide a custom implementation here.\n\t// If this param is empty, the default is to allow all data types to be nullable.\n\t// When the value returned by this func is `true` the comparison is made with the empty value instead of null.\n\tAllowNull AllowNullFunc\n\n\tschema.TestSourceOptions\n}\n```\n\n```go\ntype PluginTestSuiteTests struct {\n\t// SkipOverwrite skips testing for \"overwrite\" mode. Use if the destination\n\t// plugin doesn't support this feature.\n\tSkipOverwrite bool\n\n\t// SkipDeleteStale skips testing \"delete-stale\" mode. Use if the destination\n\t// plugin doesn't support this feature.\n\tSkipDeleteStale bool\n\n\t// SkipAppend skips testing for \"append\" mode. Use if the destination\n\t// plugin doesn't support this feature.\n\tSkipAppend bool\n\n\t// SkipSecondAppend skips the second append step in the test.\n\t// This is useful in cases like cloud storage where you can't append to an\n\t// existing object after the file has been closed.\n\tSkipSecondAppend bool\n\n\t// SkipMigrateAppend skips a test for the migrate function where a column is added,\n\t// data is appended, then the column is removed and more data appended, checking that the migrations handle\n\t// this correctly.\n\tSkipMigrateAppend bool\n\t// SkipMigrateAppendForce skips a test for the migrate function where a column is changed in force mode\n\tSkipMigrateAppendForce bool\n\n\t// SkipMigrateOverwrite skips a test for the migrate function where a column is added,\n\t// data is appended, then the column is removed and more data overwritten, checking that the migrations handle\n\t// this correctly.\n\tSkipMigrateOverwrite bool\n\t// SkipMigrateOverwriteForce skips a test for the migrate function where a column is changed in force mode\n\tSkipMigrateOverwriteForce bool\n\n\tMigrateStrategyOverwrite MigrateStrategy\n\tMigrateStrategyAppend    MigrateStrategy\n}\n```\n\n```go\ntype UnimplementedManagedWriter struct{}\n```\n\n```go\nfunc (UnimplementedManagedWriter) WriteTableBatch(context.Context, *schema.Table, []arrow.Record) error\n```\n\n```go\ntype UnimplementedUnmanagedWriter struct{}\n```\n\n```go\nfunc (UnimplementedUnmanagedWriter) Metrics() Metrics\n```\n\n```go\nfunc (UnimplementedUnmanagedWriter) Write(context.Context, schema.Tables, \u003c-chan arrow.Record) error\n```\n\n```go\ntype UnmanagedWriter interface {\n\tWrite(ctx context.Context, tables schema.Tables, res \u003c-chan arrow.Record) error\n\tMetrics() Metrics\n}\n```\n\n","path":"github.com/cloudquery/plugin-sdk/v3/plugins/destination","name":"destination","synopsis":"","isRedistributable":true}
