mycanal

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package mycanal is a CDC (Change Data Capture) library for MySQL8+

It provides helper functions for full dump (package fulldump) and incremental change capture (package incrdump). Prerequisites:

  • MySQL-8.0.2 and above
  • GTID mode enabled:
  • `--gtid-mode=ON`
  • `--enforce-gtid-consistency=ON`
  • binlog enabled with the following:
  • `--log-bin=xxxx`: enable bin log
  • `--server-id=xxx`: the server id
  • `--binlog-format=ROW`: binlog output row changes instead of statments
  • `--binlog-row-image=FULL`: before and after image of row changes
  • `--binlog-row-metadata=FULL`: extra optional meta for tables such as signedness for numeric columns/column names ...

ref:

Compatiable between fulldump/incrdump (see tst):

  • DECIMAL/NUMERIC fields are returned as string, but may have different trailing zeros.
  • BINARY fields are returned as string, but may have different trailing '\x00'.
  • JSON fields are returned as string, but elements inside may have different position.
  • BIT fields seems have some bugs in incrdump.
  • TIME with fraction seems have some bugs in incrdump too.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Host of MySQL server.
	Host string `json:"host"`

	// Port of MySQL server.
	Port uint16 `json:"port"`

	// User for connection.
	User string `json:"user"`

	// Password for connection.
	Password string `json:"password"`

	// Charset for connecting.
	Charset string `json:"charset"`
}

type FullDumpConfig

type FullDumpConfig struct {
	Config
}

func (*FullDumpConfig) Client

func (cfg *FullDumpConfig) Client() (*sql.DB, error)

func (*FullDumpConfig) ToDriverCfg

func (cfg *FullDumpConfig) ToDriverCfg() *mysql.Config

type IncrDumpConfig

type IncrDumpConfig struct {
	Config

	// ServerId is the server id for the slave.
	ServerId uint32 `json:"serverId"`
}

func (*IncrDumpConfig) ToDriverCfg

func (cfg *IncrDumpConfig) ToDriverCfg() replication.BinlogSyncerConfig

Directories

Path Synopsis
Package fulldump provides helper functions for full dump.
Package fulldump provides helper functions for full dump.
Package incrdum provides helper functions for incremental change capture.
Package incrdum provides helper functions for incremental change capture.

Jump to

Keyboard shortcuts

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