applycfg

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package applycfg contains code for persisting applier configurations. This is separate from apply since we use the staging database as the storage location.

Index

Constants

View Source
const DefaultRowLimit = 100

DefaultRowLimit limits the number of rows to be sent in a single statement for targets that do not have a bulk-transfer mechanism. If the target doesn't have a bulk-transfer method, then the generated SQL depends on the number of rows being sent, i.e. a bind variable per column per row. This flush size will place an upper bound on the length of the generated SQL and may need to be tuned for hyper-wide tables.

View Source
const SubstitutionToken = "$0"

SubstitutionToken contains the string that we'll use to substitute in the actual parameter index into the generated SQL.

Variables

Set is used by Wire.

Functions

This section is empty.

Types

type Config

type Config struct {
	// NB: Update TestCopyEquals if adding new fields.
	CASColumns  TargetColumns             // The columns for compare-and-set operations.
	Deadlines   *ident.Map[time.Duration] // Deadline-based operation.
	Exprs       *ident.Map[string]        // Synthetic or replacement SQL expressions.
	Extras      TargetColumn              // JSONB column to store unmapped values in.
	Ignore      *ident.Map[bool]          // Source column names to ignore.
	Merger      merge.Merger              // Conflict resolution.
	RowLimit    int                       // Adjust if hitting limits on bind variables.
	SourceNames *ident.Map[SourceColumn]  // Look for alternate name in the incoming data.
}

A Config contains per-target-table configuration.

func NewConfig

func NewConfig() *Config

NewConfig constructs a Config with all map fields populated.

func (*Config) Copy

func (c *Config) Copy() *Config

Copy returns a copy of the Config.

func (*Config) Equal

func (c *Config) Equal(o *Config) bool

Equal returns true if the other Config is equivalent to the receiver.

This method is intended for testing only. It does not compare the callback fields, since not all implementations of those interfaces are guaranteed to have a defined comparison operation (e.g. merge.Func).

func (*Config) IsZero

func (c *Config) IsZero() bool

IsZero returns true if the Config represents the absence of a configuration.

func (*Config) Patch

func (c *Config) Patch(other *Config) *Config

Patch applies any non-empty fields from another Config to the receiver and returns the receiver.

type Configs

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

Configs provides a lookup service for per-destination-table configurations.

func ProvideConfigs

func ProvideConfigs(diags *diag.Diagnostics) (*Configs, error)

ProvideConfigs is called by Wire to construct a Configs instance.

func (*Configs) Diagnostic

func (c *Configs) Diagnostic(_ context.Context) any

Diagnostic implements diag.Diagnostic.

func (*Configs) Get

func (c *Configs) Get(tbl ident.Table) *notify.Var[*Config]

Get returns a handle to the configuration for the named table. If the table has not (yet) been configured, the handle will contain a non-nil Config.

func (*Configs) Set

func (c *Configs) Set(tbl ident.Table, cfg *Config) error

Set updates the active configuration for the given table.

type SourceColumn

type SourceColumn = ident.Ident

SourceColumn is the name of a column found in incoming data.

type SourceColumns

type SourceColumns = ident.Idents

SourceColumns is the names of columns found in the source database.

type TargetColumn

type TargetColumn = ident.Ident

TargetColumn is the name of a column found in the target database.

type TargetColumns

type TargetColumns = ident.Idents

TargetColumns is the names of columns found in the target database.

Jump to

Keyboard shortcuts

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