Documentation ¶
Index ¶
- Constants
- Variables
- func GetPKValues(table *schema.Table, row []interface{}) ([]interface{}, error)
- type Canal
- func (c *Canal) AddDumpDatabases(dbs ...string)
- func (c *Canal) AddDumpIgnoreTables(db string, tables ...string)
- func (c *Canal) AddDumpTables(db string, tables ...string)
- func (c *Canal) CatchMasterPos(timeout int) error
- func (c *Canal) CheckBinlogRowImage(image string) error
- func (c *Canal) Close()
- func (c *Canal) Execute(cmd string, args ...interface{}) (rr *mysql.Result, err error)
- func (c *Canal) GetTable(db string, table string) (*schema.Table, error)
- func (c *Canal) RegRowsEventHandler(h RowsEventHandler)
- func (c *Canal) Start() error
- func (c *Canal) SyncedPosition() mysql.Position
- func (c *Canal) WaitDumpDone() <-chan struct{}
- func (c *Canal) WaitUntilPos(pos mysql.Position, timeout int) error
- type Config
- type DumpConfig
- type RowsEvent
- type RowsEventHandler
Constants ¶
View Source
const ( UpdateAction = "update" InsertAction = "insert" DeleteAction = "delete" )
Variables ¶
View Source
var (
ErrHandleInterrupted = errors.New("do handler error, interrupted")
)
Functions ¶
func GetPKValues ¶
Get primary keys in one row for a table, a table may use multi fields as the PK
Types ¶
type Canal ¶
type Canal struct {
// contains filtered or unexported fields
}
Canal can sync your MySQL data into everywhere, like Elasticsearch, Redis, etc... MySQL must open row format for binlog
func (*Canal) AddDumpDatabases ¶
func (*Canal) AddDumpIgnoreTables ¶
func (*Canal) AddDumpTables ¶
func (*Canal) CatchMasterPos ¶
func (*Canal) CheckBinlogRowImage ¶
Check MySQL binlog row image, must be in FULL, MINIMAL, NOBLOB
func (*Canal) RegRowsEventHandler ¶
func (c *Canal) RegRowsEventHandler(h RowsEventHandler)
func (*Canal) SyncedPosition ¶
func (*Canal) WaitDumpDone ¶
func (c *Canal) WaitDumpDone() <-chan struct{}
type Config ¶
type Config struct { Addr string `toml:"addr"` User string `toml:"user"` Password string `toml:"password"` ServerID uint32 `toml:"server_id"` Flavor string `toml:"flavor"` DataDir string `toml:"data_dir"` Dump DumpConfig `toml:"dump"` }
func NewConfigWithFile ¶
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type DumpConfig ¶
type DumpConfig struct { // mysqldump execution path, like mysqldump or /usr/bin/mysqldump, etc... // If not set, ignore using mysqldump. ExecutionPath string `toml:"mysqldump"` // Will override Databases, tables is in database table_db Tables []string `toml:"tables"` TableDB string `toml:"table_db"` Databases []string `toml:"dbs"` // Ignore table format is db.table IgnoreTables []string `toml:"ignore_tables"` // If true, discard error msg, else, output to stderr DiscardErr bool `toml:"discard_err"` }
type RowsEvent ¶
type RowsEvent struct { Table *schema.Table Action string // changed row list // binlog has three update event version, v0, v1 and v2. // for v1 and v2, the rows number must be even. // Two rows for one event, format is [before update row, after update row] // for update v0, only one row for a event, and we don't support this version. Rows [][]interface{} }
type RowsEventHandler ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.