common

package
v7.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 20

Documentation

Index

Constants

View Source
const (
	AllTableExistFlag       = 0
	DownstreamTableLackFlag = -1
	UpstreamTableLackFlag   = 1
)

Variables

This section is empty.

Functions

func AllTableExist

func AllTableExist(tableLack int) bool

func ConnectMySQL

func ConnectMySQL(cfg *mysql.Config, num int) (db *sql.DB, err error)

ConnectMySQL creates sql.DB used for select data

Types

type RowData

type RowData struct {
	Data   map[string]*dbutil.ColumnData
	Source int
}

type RowDatas

type RowDatas struct {
	Rows         []RowData
	OrderKeyCols []*model.ColumnInfo
}

RowDatas is a heap of MergeItems.

func (RowDatas) Len

func (r RowDatas) Len() int

func (RowDatas) Less

func (r RowDatas) Less(i, j int) bool

func (*RowDatas) Pop

func (r *RowDatas) Pop() (x interface{})

Pop implements heap.Interface's Pop function

func (*RowDatas) Push

func (r *RowDatas) Push(x interface{})

Push implements heap.Interface's Push function

func (RowDatas) Swap

func (r RowDatas) Swap(i, j int)

type TableDiff

type TableDiff struct {
	// Schema represents the database name.
	Schema string `json:"schema"`

	// Table represents the table name.
	Table string `json:"table"`

	// Info is the parser.TableInfo, include some meta infos for this table.
	// It used for TiDB/MySQL/MySQL Shard sources.
	Info *model.TableInfo `json:"info"`

	// columns be ignored
	IgnoreColumns []string `json:"-"`

	// field should be the primary key, unique key or field with index
	Fields string `json:"fields"`

	// select range, for example: "age > 10 AND age < 20"
	Range string `json:"range"`

	// ignore check table's data
	IgnoreDataCheck bool `json:"-"`

	// the table has column timestamp, which need to reset time_zone.
	NeedUnifiedTimeZone bool `json:"-"`

	Collation string `json:"collation"`

	ChunkSize int64 `json:"chunk-size"`

	// TableLack = 1: the table only exists downstream,
	// TableLack = -1: the table only exists upstream,
	// TableLack = 0: the table exists both upstream and downstream.
	TableLack int `json:"-"`
}

TableDiff saves config for diff table

type TableShardSource

type TableShardSource struct {
	TableSource
	// DBConn represents the origin DB connection for this TableSource.
	// This TableSource may exists in different MySQL shard.
	DBConn *sql.DB
}

TableShardSource represents the origin schema and table and DB connection before router. It used for MySQL Shard source.

type TableSource

type TableSource struct {
	OriginSchema string
	OriginTable  string
}

TableSource represents the origin schema and table before router. It used for TiDB/MySQL source.

Jump to

Keyboard shortcuts

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