writer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 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")
)

Functions

This section is empty.

Types

type Params

type Params struct {
	DB        *sql.DB
	Table     string
	KeyColumn 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 sql server 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.

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