util

package
v0.0.0-...-be15534 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSyncState

func CheckSyncState(sourceDB, targetDB *sql.DB, schema string) bool

CheckSyncState check if srouceDB and targetDB has the same table and data

func CloseDB

func CloseDB(db *sql.DB) error

CloseDB close the mysql fd

func CloseDBs

func CloseDBs(dbs []*sql.DB) error

CloseDBs close the mysql fd

func CreateDB

func CreateDB(cfg DBConfig) (*sql.DB, error)

CreateDB create a mysql fd

func CreateSinkDB

func CreateSinkDB() (db *sql.DB, err error)

CreateSinkDB return sink sql.DB for test

func CreateSourceDB

func CreateSourceDB() (db *sql.DB, err error)

CreateSourceDB return source sql.DB for test

func CreateSourceDBs

func CreateSourceDBs() (dbs []*sql.DB, err error)

CreateSourceDBs return source sql.DB for test we create two TiDB instance now in tests/integration_tests/run.sh, change it if needed

func MustExec

func MustExec(db *sql.DB, sql string, args ...interface{})

MustExec executes sqls

func MustExecWithConn

func MustExecWithConn(ctx context.Context, conn *sql.Conn, sql string, args ...interface{})

MustExecWithConn executes sqls with context

Types

type Config

type Config struct {
	*flag.FlagSet `json:"-"`

	LogLevel string `toml:"log-level" json:"log-level"`

	WorkerCount int `toml:"worker-count" json:"worker-count"`

	JobCount int `toml:"job-count" json:"job-count"`

	Batch int `toml:"batch" json:"batch"`

	PDAddr string `toml:"pd" json:"pd"`

	SourceDBCfg []DBConfig `toml:"source-db" json:"source-db"`

	TargetDBCfg DBConfig `toml:"target-db" json:"target-db"`
	// contains filtered or unexported fields
}

Config is the configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates a new config.

func (*Config) Parse

func (c *Config) Parse(arguments []string) error

Parse parses flag definitions from the argument list.

func (*Config) String

func (c *Config) String() string

type DBConfig

type DBConfig struct {
	Host string `toml:"host" json:"host"`

	User string `toml:"user" json:"user"`

	Password string `toml:"password" json:"password"`

	Name string `toml:"name" json:"name"`

	Port int `toml:"port" json:"port"`
}

DBConfig is the DB configuration.

func (*DBConfig) String

func (c *DBConfig) String() string

Jump to

Keyboard shortcuts

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