Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultQueryBuilder ¶
type DefaultQueryBuilder struct{}
DefaultQueryBuilder when no Builder is provided to Worker , this implementation is used
type QueryBuilder ¶
type QueryBuilder interface {
//Insert create a new insert statement with given table and colums
Insert(table string, cols []string) string
}
QueryBuilder define methods to build SQL queries for database operations
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader a Worker that execute a given Query and export data via output channel
func NewReader ¶
func NewReader(opts ReaderOptions) *Reader
NewReader create a new Reader with given options
type ReaderOptions ¶
type ReaderOptions struct {
//Driver which driver should be used
//this require that users import required driver
Driver string
//ConnStr connection string relative to Driver
ConnStr string
//Query which SQL select will be executed into database
Query string
//Mapper allow to configure type Scan, default magiccol.DefaultMapper
Mapper *magiccol.Mapper
//WriteFormat default is json.Marshal
WriteFormat selina.Marshaler
}
ReaderOptions provide parameters to create a Reader
func (ReaderOptions) Check ¶ added in v0.8.0
func (o ReaderOptions) Check() error
Check if a combination of options is valid this not guarantees that worker will not fail
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer a Worker that insert data into database
func NewWriter ¶
func NewWriter(opts WriterOptions) *Writer
NewWriter create a new Writer with given options
type WriterOptions ¶
type WriterOptions struct {
//Driver which driver should be used
//this require that users import required driver
Driver string
//ConnStr connection string relative to Driver
ConnStr string
//Table in which table data will be inserted
Table string
//Builder (optional) customize SQL generation
Builder QueryBuilder
//ReadFormat by default is is json.Unmarshal
ReadFormat selina.Unmarshaler
}
WriterOptions provide parameters to create a Writer
func (WriterOptions) Check ¶ added in v0.8.0
func (o WriterOptions) Check() error
Check if a combination of options is valid this not guarantees that worker will not fail