push

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: GPL-3.0 Imports: 6 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 IncCommitsCount added in v1.4.0

func IncCommitsCount()

func IncCreatedLinesCount added in v1.4.0

func IncCreatedLinesCount(table string)

func IncDeletedLinesCount added in v1.4.0

func IncDeletedLinesCount(table string)

func IncInputLinesCount added in v1.4.0

func IncInputLinesCount()

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 Reset added in v1.4.0

func Reset()

Reset all statistics to zero

Types

type Column added in v1.8.0

type Column interface {
	Name() string
	Import() string
}

Column of a table.

func NewColumn added in v1.8.0

func NewColumn(name string, imp string) Column

NewColumn initialize a new Column object

type ColumnList added in v1.8.0

type ColumnList interface {
	Len() uint
	Column(idx uint) Column
}

ColumnList is a list of columns.

func NewColumnList added in v1.8.0

func NewColumnList(columns []Column) ColumnList

NewColumnList initialize a new ColumnList object

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) (err *Error)

Push write rows to target table

func (*Error) Error

func (e *Error) Error() string

type ExecutionStats added in v1.4.0

type ExecutionStats interface {
	GetInputLinesCount() int
	GetCreatedLinesCount() map[string]int
	GetDeletedLinesCount() map[string]int
	GetCommitsCount() int

	ToJSON() []byte
}

ExecutionStats provides an overview of the work done

func Compute added in v1.4.0

func Compute() ExecutionStats

Compute current statistics and give a snapshot

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 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 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
	Columns() ColumnList
}

Table from which to push data.

func NewTable

func NewTable(name string, pk []string, columns ColumnList) 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