push

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterRelation

func FilterRelation(row Row, relations map[string]Relation) (Row, map[string]Row, map[string][]Row, *Error)

FilterRelation split values and relations to follow

func IsValidMode

func IsValidMode(value byte) bool

IsValidMode return true if value is a valide mode

func Modes

func Modes() [4]string

Modes list all modes string representation

func ParseMode

func ParseMode(mode string) (Mode, *Error)

ParseMode return mode value of string representation of mode

func SetLogger

func SetLogger(l Logger)

SetLogger if needed, default no logger

Types

type DataDestination

type DataDestination interface {
	Open(plan Plan, mode Mode, disableConstraints bool) *Error
	Commit() *Error
	RowWriter(table Table) (RowWriter, *Error)
	Close() *Error
}

DataDestination to write in the push process.

type DataDestinationFactory

type DataDestinationFactory interface {
	New(url string, schema string) DataDestination
}

DataDestinationFactory exposes methods to create new datadestinations.

type Error

type Error struct {
	Description string
}

Error is the error type returned by the domain

func Push

func Push(ri RowIterator, destination DataDestination, plan Plan, mode Mode, commitSize uint, disableConstraints bool, catchError RowWriter) *Error

Push write rows to target table

func (*Error) Error

func (e *Error) Error() string

type Logger

type Logger interface {
	Trace(msg string)
	Debug(msg string)
	Info(msg string)
	Warn(msg string)
	Error(msg string)
}

Logger for events.

type MockDataDestination

type MockDataDestination struct {
	mock.Mock
}

MockDataDestination is an autogenerated mock type for the DataDestination type

func (*MockDataDestination) Close

func (_m *MockDataDestination) Close() *Error

Close provides a mock function with given fields:

func (*MockDataDestination) Commit

func (_m *MockDataDestination) Commit() *Error

Commit provides a mock function with given fields:

func (*MockDataDestination) Open

func (_m *MockDataDestination) Open(plan Plan, mode Mode, disableConstraints bool) *Error

Open provides a mock function with given fields: plan, mode, disableConstraints

func (*MockDataDestination) RowWriter

func (_m *MockDataDestination) RowWriter(table Table) (RowWriter, *Error)

RowWriter provides a mock function with given fields: table

type MockDataDestinationFactory

type MockDataDestinationFactory struct {
	mock.Mock
}

MockDataDestinationFactory is an autogenerated mock type for the DataDestinationFactory type

func (*MockDataDestinationFactory) New

New provides a mock function with given fields: url, schema

type MockLogger

type MockLogger struct {
	mock.Mock
}

MockLogger is an autogenerated mock type for the Logger type

func (*MockLogger) Debug

func (_m *MockLogger) Debug(msg string)

Debug provides a mock function with given fields: msg

func (*MockLogger) Error

func (_m *MockLogger) Error(msg string)

Error provides a mock function with given fields: msg

func (*MockLogger) Info

func (_m *MockLogger) Info(msg string)

Info provides a mock function with given fields: msg

func (*MockLogger) Trace

func (_m *MockLogger) Trace(msg string)

Trace provides a mock function with given fields: msg

func (*MockLogger) Warn

func (_m *MockLogger) Warn(msg string)

Warn provides a mock function with given fields: msg

type MockPlan

type MockPlan struct {
	mock.Mock
}

MockPlan is an autogenerated mock type for the Plan type

func (*MockPlan) FirstTable

func (_m *MockPlan) FirstTable() Table

FirstTable provides a mock function with given fields:

func (*MockPlan) RelationsFromTable

func (_m *MockPlan) RelationsFromTable(table Table) map[string]Relation

RelationsFromTable provides a mock function with given fields: table

func (*MockPlan) Tables

func (_m *MockPlan) Tables() []Table

Tables provides a mock function with given fields:

type MockRelation

type MockRelation struct {
	mock.Mock
}

MockRelation is an autogenerated mock type for the Relation type

func (*MockRelation) Child

func (_m *MockRelation) Child() Table

Child provides a mock function with given fields:

func (*MockRelation) Name

func (_m *MockRelation) Name() string

Name provides a mock function with given fields:

func (*MockRelation) OppositeOf

func (_m *MockRelation) OppositeOf(table Table) Table

OppositeOf provides a mock function with given fields: table

func (*MockRelation) Parent

func (_m *MockRelation) Parent() Table

Parent provides a mock function with given fields:

type MockRowIterator

type MockRowIterator struct {
	mock.Mock
}

MockRowIterator is an autogenerated mock type for the RowIterator type

func (*MockRowIterator) Close

func (_m *MockRowIterator) Close() *Error

Close provides a mock function with given fields:

func (*MockRowIterator) Error

func (_m *MockRowIterator) Error() *Error

Error provides a mock function with given fields:

func (*MockRowIterator) Next

func (_m *MockRowIterator) Next() bool

Next provides a mock function with given fields:

func (*MockRowIterator) Value

func (_m *MockRowIterator) Value() *Row

Value provides a mock function with given fields:

type MockRowPusher

type MockRowPusher struct {
	mock.Mock
}

MockRowPusher is an autogenerated mock type for the RowPusher type

func (*MockRowPusher) Export

func (_m *MockRowPusher) Export(_a0 Row) *Error

Export provides a mock function with given fields: _a0

type MockRowWriter

type MockRowWriter struct {
	mock.Mock
}

MockRowWriter is an autogenerated mock type for the RowWriter type

func (*MockRowWriter) Write

func (_m *MockRowWriter) Write(row Row) *Error

Write provides a mock function with given fields: row

type MockTable

type MockTable struct {
	mock.Mock
}

MockTable is an autogenerated mock type for the Table type

func (*MockTable) Name

func (_m *MockTable) Name() string

Name provides a mock function with given fields:

func (*MockTable) PrimaryKey

func (_m *MockTable) PrimaryKey() []string

PrimaryKey provides a mock function with given fields:

type MockValue

type MockValue struct {
	mock.Mock
}

MockValue is an autogenerated mock type for the Value type

type Mode

type Mode byte

Mode to push rows

const (
	// Truncate table before pushing
	Truncate Mode = iota
	// Insert only new rows
	Insert
	// Delete only existing row
	Delete
	// TODO Upsert insert and update on conflict
	// Update only existing row
	Update
)

func (Mode) String

func (m Mode) String() string

String representation

type NoErrorCaptureRowWriter

type NoErrorCaptureRowWriter struct{}

func (NoErrorCaptureRowWriter) Write

func (necrw NoErrorCaptureRowWriter) Write(row Row) *Error

type Nologger

type Nologger struct{}

Nologger default implementation do nothing.

func (Nologger) Debug

func (l Nologger) Debug(msg string)

Debug event.

func (Nologger) Error

func (l Nologger) Error(msg string)

Error event.

func (Nologger) Info

func (l Nologger) Info(msg string)

Info event.

func (Nologger) Trace

func (l Nologger) Trace(msg string)

Trace event.

func (Nologger) Warn

func (l Nologger) Warn(msg string)

Warn event.

type Plan

type Plan interface {
	FirstTable() Table
	RelationsFromTable(table Table) map[string]Relation
	Tables() []Table
}

Plan describe how to push data

func NewPlan

func NewPlan(first Table, relations []Relation) Plan

NewPlan initialize a new Plan object

type Relation

type Relation interface {
	Name() string
	Parent() Table
	Child() Table
	OppositeOf(table Table) Table
}

Relation between two tables.

func NewRelation

func NewRelation(name string, parent Table, child Table) Relation

NewRelation initialize a new Relation object

type Row

type Row map[string]Value

Row of data.

type RowIterator

type RowIterator interface {
	Next() bool
	Value() *Row
	Error() *Error
	Close() *Error
}

RowIterator iter over a collection of rows

type RowWriter

type RowWriter interface {
	Write(row Row) *Error
}

RowWriter write row to destination table

type StopIteratorError

type StopIteratorError struct{}

StopIteratorError signal the end of iterator

type Table

type Table interface {
	Name() string
	PrimaryKey() []string
}

Table from which to push data.

func NewTable

func NewTable(name string, pk []string) Table

NewTable initialize a new Table object

type Value

type Value interface{}

Value is an untyped data.

Jump to

Keyboard shortcuts

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