{"modulePath":"github.com/cloudquery/plugin-sdk/v2","version":"v2.7.0","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)\n```\n\n```go\nfunc RecordDiff(l arrow.Record, r arrow.Record) string\n```\n\n## Types\n\n```go\ntype Client interface {\n\tMigrate(ctx context.Context, tables schema.Schemas) error\n\tRead(ctx context.Context, table *arrow.Schema, sourceName string, res chan\u003c- arrow.Record) error\n\tManagedWriter\n\tUnmanagedWriter\n\tDeleteStale(ctx context.Context, tables schema.Schemas, 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 *arrow.Schema, 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.Schemas, 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.Schemas) 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 *arrow.Schema, 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.Schemas, 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 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, *arrow.Schema, []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.Schemas, \u003c-chan arrow.Record) error\n```\n\n```go\ntype UnmanagedWriter interface {\n\tWrite(ctx context.Context, tables schema.Schemas, res \u003c-chan arrow.Record) error\n\tMetrics() Metrics\n}\n```\n\n","path":"github.com/cloudquery/plugin-sdk/v2/plugins/destination","name":"destination","synopsis":"","isRedistributable":true}
