Documentation
¶
Overview ¶
Package datastorage abstracts the data storage source.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InsertOptions ¶
type InsertOptions struct { // Formatter formats each value of a record. // Optional. Formatter func(value string) string // IgnoreDuplicateError ignores duplicate error from the datasource if set // to true. IgnoreDuplicateError bool }
InsertOptions gathers the options of an insert process.
type Inserter ¶
type Inserter interface {
Insert(ctx context.Context, records [][]string, options InsertOptions) error
}
Inserter inserts records from a CSV file to a datasource.
type MySQLInserter ¶
type MySQLInserter struct {
// contains filtered or unexported fields
}
MySQLInserter implements Inserter for a MySQL datasource.
func NewMySQLInserter ¶
func NewMySQLInserter(dsn, table string, columns []string, timeout time.Duration) (*MySQLInserter, error)
NewMySQLInserter creates an instance of MySQLInserter.
func (*MySQLInserter) Insert ¶
func (inserter *MySQLInserter) Insert(ctx context.Context, records [][]string, options InsertOptions) error
Insert inserts records to a MySQL table.
Click to show internal directories.
Click to hide internal directories.