execution

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: MPL-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromError

func FromError(err error, opts ...Option) diag.Diagnostics

func WithErrorClassifier

func WithErrorClassifier(e *Error)

Types

type Error

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

Error is a generic error returned when execution is run, Error satisfies diagnostic interface

func NewError

func NewError(severity diag.Severity, dt diag.DiagnosticType, resource, summary string, args ...interface{}) *Error

NewError creates an execution Error

func (Error) Description

func (e Error) Description() diag.Description

func (Error) Err

func (e Error) Err() error

func (Error) Error

func (e Error) Error() string

func (Error) Severity

func (e Error) Severity() diag.Severity

func (Error) Type

func (e Error) Type() diag.DiagnosticType

type ErrorClassifier

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

type Option

type Option func(e *Error)

func WithDetails

func WithDetails(detail string) Option

func WithResource

func WithResource(resource string) Option

func WithSeverity

func WithSeverity(s diag.Severity) Option

func WithSummary

func WithSummary(summary string, args ...interface{}) Option

func WithType

func WithType(dt diag.DiagnosticType) Option

type QueryExecer

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

type Storage

type Storage interface {
	QueryExecer

	Insert(ctx context.Context, t *schema.Table, instance schema.Resources) 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 TableExecutor

type TableExecutor struct {
	// ResourceName name of top-level resource associated with table
	ResourceName string
	// 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 map[string]interface{}, classifier ErrorClassifier) TableExecutor

NewTableExecutor creates a new TableExecutor for given schema.Table

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