writer

package
v0.0.0-...-69a6c05 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyPayload occurs when there's no payload to insert.
	ErrEmptyPayload = errors.New("payload is empty")
	// ErrEmptyKey occurs when there is no value for key.
	ErrEmptyKey = errors.New("key value must be provided")
	// ErrCompositeKeysNotSupported occurs when there are more than one key in a Key map.
	ErrCompositeKeysNotSupported = errors.New("composite keys not yet supported")
	// ErrColumnsValuesLenMismatch occurs when trying to insert a row with a different column and value lengths.
	ErrColumnsValuesLenMismatch = errors.New("number of columns must be equal to number of values")
)

Functions

This section is empty.

Types

type Params

type Params struct {
	DB    *sql.DB
	Table string
}

Params is an incoming params for the NewWriter function.

type Writer

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

Writer implements a writer logic for db2 destination.

func NewWriter

func NewWriter(ctx context.Context, params Params) (*Writer, error)

NewWriter creates new instance of the Writer.

func (*Writer) Close

func (w *Writer) Close(context.Context) error

Close closes the underlying db connection.

func (*Writer) Delete

func (w *Writer) Delete(ctx context.Context, record sdk.Record) error

Delete deletes records by a key. First it looks in the sdk.Record.Key, if it doesn't find a key there it will use the default configured value for a key.

func (*Writer) Insert

func (w *Writer) Insert(ctx context.Context, record sdk.Record) error

Insert row to sql server db.

func (*Writer) Update

func (w *Writer) Update(ctx context.Context, record sdk.Record) error

Update updates records by a key.

Jump to

Keyboard shortcuts

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