Documentation ¶
Index ¶
- func ParseTable(table string) (schemaName, tableName string)
- type Batcher
- type InsertBatcher
- type MySQLSchema
- func (m MySQLSchema) CompatibleDs() string
- func (m MySQLSchema) Pump(table string, rowsPumped chan<- model.RowsPumped, config model.PumpConfig, ...) error
- func (m *MySQLSchema) SetVerbose(verbose int)
- func (m MySQLSchema) TableColumns(table string) ([]model.TableColumn, error)
- func (m MySQLSchema) Tables() ([]model.Table, error)
- type MySQLTable
- type MyTableColumn
- func (c MyTableColumn) GetCharacterSet() string
- func (c MyTableColumn) GetComment() string
- func (c MyTableColumn) GetDataType() string
- func (c MyTableColumn) GetMaxSize() int
- func (c MyTableColumn) GetName() string
- func (c MyTableColumn) GetRandomizer() model.Randomizer
- func (c MyTableColumn) IsAutoIncrement() bool
- func (c MyTableColumn) IsNullable() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseTable ¶
ParseTable parses the schema and table name from table which may be like db1.t1
Types ¶
type Batcher ¶
type Batcher interface { // GetBatchNum returns the batch num GetBatchNum() int // AddRow adds a row to batcher and execute when rows accumulated to the batch num. AddRow(colValues []interface{}) error // Complete completes the left rows that less than batch num. Complete() (int, error) }
Batcher ...
type InsertBatcher ¶
type InsertBatcher struct {
// contains filtered or unexported fields
}
InsertBatcher ...
func NewInsertBatch ¶
func NewInsertBatch(table string, columnNames []string, batchNum int, db *sql.DB, batchOp func(int), verbose, rows int) *InsertBatcher
NewInsertBatch ...
func (*InsertBatcher) AddRow ¶
func (b *InsertBatcher) AddRow(colValues []interface{}) error
AddRow adds a row to batcher and execute when rows accumulated to the batch num.
func (*InsertBatcher) Complete ¶
func (b *InsertBatcher) Complete() (int, error)
Complete completes the left rows that less than batch num.
func (InsertBatcher) GetBatchNum ¶
func (b InsertBatcher) GetBatchNum() int
GetBatchNum returns the batch num
type MySQLSchema ¶
type MySQLSchema struct { DS string // contains filtered or unexported fields }
MySQLSchema ...
func CreateMySQLSchema ¶
func CreateMySQLSchema(dataSourceName string) (*MySQLSchema, error)
CreateMySQLSchema ...
func (MySQLSchema) CompatibleDs ¶
func (m MySQLSchema) CompatibleDs() string
CompatibleDs returns the dataSourceName from various the compatible format.
func (MySQLSchema) Pump ¶
func (m MySQLSchema) Pump(table string, rowsPumped chan<- model.RowsPumped, config model.PumpConfig, ready chan bool, onerr string, retryMaxTimes int) error
Pump ...
func (*MySQLSchema) SetVerbose ¶
func (m *MySQLSchema) SetVerbose(verbose int)
SetVerbose set verbose mode
func (MySQLSchema) TableColumns ¶
func (m MySQLSchema) TableColumns(table string) ([]model.TableColumn, error)
TableColumns ...
type MySQLTable ¶
MySQLTable ...
type MyTableColumn ¶
type MyTableColumn struct { Name string `name:"COLUMN_NAME"` Type string `name:"COLUMN_TYPE"` Extra string `name:"EXTRA"` // auto_increment Comment string `name:"COLUMN_COMMENT"` DataType string `name:"DATA_TYPE"` MaxLength int `name:"CHARACTER_MAXIMUM_LENGTH"` Nullable string `name:"IS_NULLABLE"` Default string `name:"COLUMN_DEFAULT"` CharacterSet string `name:"CHARACTER_SET_NAME"` NumericPrecision int `name:"NUMERIC_PRECISION"` NumericScale int `name:"NUMERIC_SCALE"` // contains filtered or unexported fields }
MyTableColumn ...
func (MyTableColumn) GetCharacterSet ¶
func (c MyTableColumn) GetCharacterSet() string
GetCharacterSet returns the CharacterSet of the column
func (MyTableColumn) GetRandomizer ¶
func (c MyTableColumn) GetRandomizer() model.Randomizer
GetRandomizer ...
func (MyTableColumn) IsAutoIncrement ¶
func (c MyTableColumn) IsAutoIncrement() bool
IsAutoIncrement tells if the col is auto_increment or not. eg. create table a.ta(id int auto_increment, name varchar(10), age int, primary key(id));