common

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertNil

func AssertNil(err error)

AssertNil used to assert the error.

func Dumper

func Dumper(log *xlog.Log, args *config.Config, listener MyDumperListener)

Dumper used to start the dumper worker.

func EscapeBytes

func EscapeBytes(bytes []byte) []byte

EscapeBytes used to escape the literal byte.

func Loader

func Loader(log *xlog.Log, args *config.Config)

Loader used to start the loader worker.

func ParseDumperConfigStruct

func ParseDumperConfigStruct(dumpNode *DumpNode) (*config.Config, error)

* 读取结构体配置

func ReadFile

func ReadFile(file string) ([]byte, error)

ReadFile used to read datas from file.

func WriteFile

func WriteFile(file string, data string) error

WriteFile used to write datas to file.

Types

type Connection

type Connection struct {
	ID int
	// contains filtered or unexported fields
}

Connection tuple.

func (*Connection) Execute

func (conn *Connection) Execute(query string) error

Execute used to executes the query.

func (*Connection) Fetch

func (conn *Connection) Fetch(query string) (*sqltypes.Result, error)

Fetch used to fetch the results.

func (*Connection) StreamFetch

func (conn *Connection) StreamFetch(query string) (driver.Rows, error)

StreamFetch used to the results with streaming.

type DumpNode

type DumpNode struct {
	Host      string
	Port      int
	User      string
	Password  string
	DataBase  string
	Table     string
	OutDir    string
	ChunkSize int

	DatabaseRegexp       string
	DatabaseInvertRegexp bool

	ChunksizeInMB int
	SessionVars   string
	// contains filtered or unexported fields
}

type Files

type Files struct {
	// contains filtered or unexported fields
}

Files tuple.

type MyDumperListener

type MyDumperListener interface {
	Start(time string, dataBase string, table string, rags *config.Config)
	StartNode(time string, dataBase string, table string, args *config.Config, connection *Connection)
	DoneNode(time string, dataBase string, table string, args *config.Config, connection *Connection)
	PendingNode(time string, dataBase string, table string, allrows uint64, allbytes uint64, rates float64)
	Done(time string, dataBase string, table string, args *config.Config, allrows uint64, allbytes uint64, rates float64)
}

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool tuple.

func NewPool

func NewPool(log *xlog.Log, cap int, address string, user string, password string, vars string) (*Pool, error)

NewPool creates the new pool.

func (*Pool) Close

func (p *Pool) Close()

Close used to close the pool and the connections.

func (*Pool) Get

func (p *Pool) Get() *Connection

Get used to get one connection from the pool.

func (*Pool) Put

func (p *Pool) Put(conn *Connection)

Put used to put one connection to the pool.

Jump to

Keyboard shortcuts

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