execution

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MPL-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassifyError added in v0.8.0

func ClassifyError(err error, opts ...diag.BaseErrorOption) diag.Diagnostics

func WithResource

func WithResource(resource *schema.Resource) diag.BaseErrorOption

Types

type Copier added in v0.7.4

type Copier interface {
	RawCopyTo(ctx context.Context, w io.Writer, sql string) error
	RawCopyFrom(ctx context.Context, r io.Reader, sql string) error
}

type ErrorClassifier

type ErrorClassifier func(meta schema.ClientMeta, resourceName string, err error) diag.Diagnostics

type QueryExecer

type QueryExecer interface {
	pgxscan.Querier
	Exec(ctx context.Context, query string, args ...interface{}) error
}

type Storage

type Storage interface {
	QueryExecer
	Copier
	TXer
	Insert(ctx context.Context, t *schema.Table, instance schema.Resources, shouldCascade bool, cascadeDeleteFilters map[string]interface{}) error
	Delete(ctx context.Context, t *schema.Table, kvFilters []interface{}) error
	RemoveStaleData(ctx context.Context, t *schema.Table, executionStart time.Time, kvFilters []interface{}) error
	CopyFrom(ctx context.Context, resources schema.Resources, shouldCascade bool, cascadeDeleteFilters map[string]interface{}) error
	Close()
	Dialect() schema.Dialect
}

type TXQueryExecer added in v0.10.0

type TXQueryExecer interface {
	QueryExecer
	TXer
	Rollback(context.Context) error
	Commit(context.Context) error
}

type TXer added in v0.10.0

type TXer interface {
	Begin(context.Context) (TXQueryExecer, error)
}

type TableExecutor

type TableExecutor struct {
	// ResourceName name of top-level resource associated with table
	ResourceName string
	// ParentExecutor is the parent executor, useful for nested tables to propagate up and use IgnoreError and so forth.
	ParentExecutor *TableExecutor
	// Table this execution is associated with
	Table *schema.Table
	// Database connection to insert data into
	Db Storage
	// Logger associated with this execution
	Logger hclog.Logger
	// contains filtered or unexported fields
}

TableExecutor marks all the related execution info passed to TableResolver and ColumnResolver giving access to the Runner's meta

func NewTableExecutor

func NewTableExecutor(resourceName string, db Storage, logger hclog.Logger, table *schema.Table, extraFields, metadata map[string]interface{}, classifier ErrorClassifier, goroutinesSem *semaphore.Weighted, timeout time.Duration) TableExecutor

NewTableExecutor creates a new TableExecutor for given schema.Table

func (TableExecutor) IgnoreError added in v0.11.0

func (e TableExecutor) IgnoreError(err error) bool

IgnoreError returns true if the error is ignored via the current table IgnoreError function or in any other parent table (in that ordered) it stops checking the moment one of them exists and not until it returns true or fals

func (TableExecutor) Resolve

Resolve is the root function of table executor which starts an execution of a Table resolving it, and it's relations.

Jump to

Keyboard shortcuts

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