mysql

package
v0.0.0-...-86dfa72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLBinlogHandler

type MySQLBinlogHandler struct {
	canal.DummyEventHandler
	Sinkers []common.Sinker
	C       *canal.Canal
}

func (*MySQLBinlogHandler) OnDDL

func (h *MySQLBinlogHandler) OnDDL(nextPos mysql.Position, queryEvent *replication.QueryEvent) error

func (*MySQLBinlogHandler) OnRotate

func (*MySQLBinlogHandler) OnRow

func (h *MySQLBinlogHandler) OnRow(e *canal.RowsEvent) error

OnRow 对于 DUMP, 此处的区别是 Header是否为空, 可以判断如果header为空用 insert ignore into, 否则用replace into

func (*MySQLBinlogHandler) OnTableChanged

func (h *MySQLBinlogHandler) OnTableChanged(schema string, table string) error

func (*MySQLBinlogHandler) String

func (h *MySQLBinlogHandler) String() string

type MySQLConsumer

type MySQLConsumer struct {
	DB      *sql.DB
	Mapping *mapper.TableMapping
	Lock    sync.Mutex
}

MySQLConsumer 目前需要自己手动建表, 意味着 Mapping 不能为空

func (*MySQLConsumer) Accept

func (c *MySQLConsumer) Accept(e *canal.RowsEvent) error

func (*MySQLConsumer) Name

func (c *MySQLConsumer) Name() string

type MySQLSinker

type MySQLSinker struct {
	ErrorContinue bool                 `json:"errorContinue"`
	Filters       []filter.MySQLFilter `json:"filters"`
	Consumers     []*MySQLConsumer     `json:"consumers"`
	// contains filtered or unexported fields
}

func Build

func Build(c string) *MySQLSinker

func (*MySQLSinker) ContinueOnError

func (s *MySQLSinker) ContinueOnError() bool

func (*MySQLSinker) Disable

func (s *MySQLSinker) Disable()

func (*MySQLSinker) Enable

func (s *MySQLSinker) Enable() bool

func (*MySQLSinker) OnEvent

func (s *MySQLSinker) OnEvent(e *canal.RowsEvent) error

事件处理逻辑

type MySQLSinkerConfig

type MySQLSinkerConfig struct {
	DestDatasource common.MySQLInstance  `json:"destDatasource"`
	Filters        []filter.MySQLFilter  `json:"filters"`
	Mappings       []mapper.TableMapping `json:"mappings"`
	ErrorContinue  bool                  `json:"errorContinue"`
}

MySQLSinkerConfig binlog 消费者配置, 一个生产者,可以对应多个消费者

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL