Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSVReader ¶
CSVReader is implementation of RowReader using CSV as data source.
type DBConfig ¶
type DBConfig struct {
User string
Password string
Host string
Port int32
Db string
SSLMode string `yaml:"sslmode"`
}
DBConfig specifies database connection configurations.
func NewDBConfig ¶
NewDBConfig creates a new database configuration from YAML file.
func (DBConfig) ConnectionString ¶
ConnectionString returns connection string generated from configuration.
type DBSynchronizer ¶
type DBSynchronizer interface {
// Name returns the table's name
Name() string
// DependsOn returns other tables that this table depends on
DependsOn() []string
// Create table
Create(*sql.DB) error
// Delete all rows from table
Delete(*sql.DB) error
// Drop table
Drop(*sql.DB) error
// Fill rows
Fill(*sql.DB) error
// RowCount returns number of rows that is filled.
RowCount() int64
}
DBSynchronizer synchronize specs and data with database table.
type FieldProvider ¶
type FieldProvider interface {
Setup(header []string) error
ProvideField([]string) (map[string]interface{}, error)
}
FieldProvider is the interface that wraps the functionality of accessing fields.
type RecordReader ¶
type RecordReader struct {
Name string
RowReader RowReader
FieldProvider FieldProvider
Converter Converter
Computer Computer
Validator Validator
}
RecordReader is a type that specify record reader.
func (*RecordReader) Close ¶
func (r *RecordReader) Close() error
Close closes the record reader, no further reading allowed.
func (*RecordReader) Open ¶
func (r *RecordReader) Open() error
Open opens the record reader for reading.
func (*RecordReader) ReadRecord ¶
func (r *RecordReader) ReadRecord() (map[string]interface{}, error)
ReadRecord reads a single record.
type RowReader ¶
type RowReader interface {
Open() error
ReadRow() ([]string, error)
HeaderRow() []string
Close() error
// RowCount returns the number of rows read.
RowCount() int64
// Source returns the source of rows.
Source() string
}
RowReader is the interface that wraps the functionality of row reader.