sql

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InsertFunc

type InsertFunc func(*sql.Tx, *streams.Message) error

InsertFunc represents a callback to handle processing a Message on the Sink.

type Sink

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

Sink represents a SQL sink processor.

func NewSink

func NewSink(db *sql.DB, fn InsertFunc, opts ...SinkFunc) (*Sink, error)

NewSink creates a new batch sql insert sink.

func (*Sink) Close

func (p *Sink) Close() error

Close closes the processor.

func (*Sink) Process

func (p *Sink) Process(msg *streams.Message) error

Process processes the stream record.

func (*Sink) WithPipe added in v0.3.0

func (p *Sink) WithPipe(pipe streams.Pipe)

WithPipe sets the pipe on the Processor.

type SinkFunc

type SinkFunc func(*Sink)

SinkFunc represents a function that configures the Sink.

func WithBatchFrequency added in v1.0.0

func WithBatchFrequency(freq time.Duration) SinkFunc

WithBatchFrequency configures the frequency to send a batch on the Sink.

func WithBatchMessages added in v1.0.0

func WithBatchMessages(messages int) SinkFunc

WithBatchMessages configures the number of messages to send in a batch on the Sink.

func WithBeginFn

func WithBeginFn(fn TxFunc) SinkFunc

WithBeginFn sets the transaction start callback on the Sink.

func WithCommitFn

func WithCommitFn(fn TxFunc) SinkFunc

WithCommitFn sets the transaction commit callback on the Sink.

type TxFunc

type TxFunc func(*sql.Tx) error

TxFunc represents a function that receives a sql transaction.

Jump to

Keyboard shortcuts

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