canal

package
v0.0.0-...-0864a4c Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: GPL-3.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canal

type Canal struct {
	Client   *canal.Canal
	Settings *Settings
	ZkCli    *zk.Conn
}

func Setup

func Setup(settings *Settings) (*Canal, error)

func (*Canal) Close

func (c *Canal) Close()

func (*Canal) GetPos

func (c *Canal) GetPos() (*mysql.Position, error)

func (*Canal) Listen

func (c *Canal) Listen(consumerMap map[string]ConsumerFunc) error

func (*Canal) SavePos

func (c *Canal) SavePos(pos *mysql.Position) error

type ConsumerFunc

type ConsumerFunc func(formerRow Row, row Row) error

type EventHandler

type EventHandler struct {
	canal.DummyEventHandler
	ConsumerMap map[string]ConsumerFunc
	CanalCli    *Canal
}

func MakeEventHandler

func MakeEventHandler(consumerMap map[string]ConsumerFunc, canalCli *Canal) *EventHandler

func (*EventHandler) OnPosSynced

func (h *EventHandler) OnPosSynced(pos mysql.Position, force bool) error

func (*EventHandler) OnRow

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

func (*EventHandler) String

func (h *EventHandler) String() string

type Row

type Row map[string]interface{}

type Settings

type Settings struct {
	Addr      string   `yaml:"addr"`
	Username  string   `yaml:"username"`
	Password  string   `yaml:"password"`
	DB        string   `yaml:"db"`
	Tables    []string `yaml:"tables"`
	Zookeeper zookeeper.Settings
	ZkPath    string `yaml:"path"`
}

Jump to

Keyboard shortcuts

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