Documentation ¶
Index ¶
- Constants
- Variables
- func Dump(conf *Config) (err error)
- func FlushTableWithReadLock(db *sql.DB) error
- func GetColumnTypes(db *sql.DB, fields, database, table string) ([]*sql.ColumnType, error)
- func GetPrimaryKeyName(db *sql.DB, database, table string) (string, error)
- func GetUniqueIndexName(db *sql.DB, database, table string) (string, error)
- func ListAllTables(db *sql.DB, database string) ([]string, error)
- func ListAllViews(db *sql.DB, database string) ([]string, error)
- func LockTables(db *sql.DB, database, table string) error
- func SelectTiDBRowID(db *sql.DB, database, table string) (bool, error)
- func SelectVersion(db *sql.DB) (string, error)
- func SetTiDBSnapshot(db *sql.DB, snapshot string) error
- func ShowCreateDatabase(db *sql.DB, database string) (string, error)
- func ShowCreateTable(db *sql.DB, database, table string) (string, error)
- func ShowCreateView(db *sql.DB, database, view string) (string, error)
- func ShowDatabases(db *sql.DB) ([]string, error)
- func ShowMasterStatus(db *sql.DB, fieldNum int) ([]string, error)
- func ShowTables(db *sql.DB) ([]string, error)
- func UnlockTables(db *sql.DB) error
- func UseDatabase(db *sql.DB, databaseName string) error
- func WriteInsert(tblIR TableDataIR, w io.StringWriter) error
- func WriteMeta(meta MetaIR, w io.StringWriter) error
- type BWList
- type BWListConf
- type BWListMode
- type Config
- type ConsistencyController
- type ConsistencyFlushTableWithReadLock
- type ConsistencyLockDumpingTables
- type ConsistencyNone
- type ConsistencySnapshot
- type DatabaseTables
- func (d DatabaseTables) AppendTable(dbName string, table *TableInfo) DatabaseTables
- func (d DatabaseTables) AppendTables(dbName string, tableNames ...string) DatabaseTables
- func (d DatabaseTables) AppendViews(dbName string, viewNames ...string) DatabaseTables
- func (d DatabaseTables) Literal() string
- func (d DatabaseTables) Merge(other DatabaseTables)
- type InterceptStringWriter
- type LazyStringWriter
- type Logger
- type MetaIR
- type MySQLReplicationBWList
- type MySQLReplicationConf
- type NopeBWList
- type RowReceiver
- type RowReceiverArr
- type RowReceiverStringer
- type SQLRowIter
- type SQLTypeBytes
- type SQLTypeNumber
- type SQLTypeString
- type ServerInfo
- type ServerType
- type SimpleWriter
- type StringIter
- type Stringer
- type TableDataIR
- type TableInfo
- type TableType
- type Writer
Constants ¶
View Source
const ( ServerTypeUnknown = iota ServerTypeMySQL ServerTypeMariaDB ServerTypeTiDB ServerTypeAll )
View Source
const (
UnspecifiedSize = 0
)
Variables ¶
View Source
var ServerInfoUnknown = ServerInfo{ ServerType: ServerTypeUnknown, ServerVersion: nil, }
Functions ¶
func FlushTableWithReadLock ¶
func GetColumnTypes ¶
func GetUniqueIndexName ¶
func ShowTables ¶
ShowTables shows the tables of a database, the caller should use the correct database.
func UnlockTables ¶
func WriteInsert ¶
func WriteInsert(tblIR TableDataIR, w io.StringWriter) error
Types ¶
type BWListConf ¶
type BWListConf struct { Mode BWListMode Rules *MySQLReplicationConf }
type BWListMode ¶
type BWListMode byte
const ( NopMode BWListMode = 0x0 // We have used this black and white list in pingcap/dm and pingcap/tidb-lightning project MySQLReplicationMode BWListMode = 0x1 )
type Config ¶
type Config struct { Database string Host string User string Port int Password string Threads int FileSize uint64 StatementSize uint64 OutputDirPath string ServerInfo ServerInfo SortByPk bool Tables DatabaseTables StatusAddr string Snapshot string Consistency string NoViews bool BlackWhiteList BWListConf Rows uint64 Where string EscapeBackslash bool }
func DefaultConfig ¶
func DefaultConfig() *Config
type ConsistencyController ¶
func NewConsistencyController ¶
func NewConsistencyController(conf *Config, session *sql.DB) (ConsistencyController, error)
type ConsistencyFlushTableWithReadLock ¶
type ConsistencyFlushTableWithReadLock struct {
// contains filtered or unexported fields
}
func (*ConsistencyFlushTableWithReadLock) Setup ¶
func (c *ConsistencyFlushTableWithReadLock) Setup() error
func (*ConsistencyFlushTableWithReadLock) TearDown ¶
func (c *ConsistencyFlushTableWithReadLock) TearDown() error
type ConsistencyLockDumpingTables ¶
type ConsistencyLockDumpingTables struct {
// contains filtered or unexported fields
}
func (*ConsistencyLockDumpingTables) Setup ¶
func (c *ConsistencyLockDumpingTables) Setup() error
func (*ConsistencyLockDumpingTables) TearDown ¶
func (c *ConsistencyLockDumpingTables) TearDown() error
type ConsistencyNone ¶
type ConsistencyNone struct{}
func (*ConsistencyNone) Setup ¶
func (c *ConsistencyNone) Setup() error
func (*ConsistencyNone) TearDown ¶
func (c *ConsistencyNone) TearDown() error
type ConsistencySnapshot ¶
type ConsistencySnapshot struct {
// contains filtered or unexported fields
}
func (*ConsistencySnapshot) Setup ¶
func (c *ConsistencySnapshot) Setup() error
func (*ConsistencySnapshot) TearDown ¶
func (c *ConsistencySnapshot) TearDown() error
type DatabaseTables ¶
type DatabaseTables map[databaseName][]*TableInfo
func NewDatabaseTables ¶
func NewDatabaseTables() DatabaseTables
func (DatabaseTables) AppendTable ¶
func (d DatabaseTables) AppendTable(dbName string, table *TableInfo) DatabaseTables
func (DatabaseTables) AppendTables ¶
func (d DatabaseTables) AppendTables(dbName string, tableNames ...string) DatabaseTables
func (DatabaseTables) AppendViews ¶
func (d DatabaseTables) AppendViews(dbName string, viewNames ...string) DatabaseTables
func (DatabaseTables) Literal ¶
func (d DatabaseTables) Literal() string
func (DatabaseTables) Merge ¶
func (d DatabaseTables) Merge(other DatabaseTables)
type InterceptStringWriter ¶
type InterceptStringWriter struct { io.StringWriter SomethingIsWritten bool }
InterceptStringWriter is an interceptor of io.StringWriter, tracking whether a StringWriter has written something.
func (*InterceptStringWriter) WriteString ¶
func (w *InterceptStringWriter) WriteString(str string) (int, error)
type LazyStringWriter ¶
type LazyStringWriter struct { sync.Once io.StringWriter // contains filtered or unexported fields }
func (*LazyStringWriter) WriteString ¶
func (l *LazyStringWriter) WriteString(str string) (int, error)
type Logger ¶
type Logger interface { Debug(format string, args ...interface{}) Info(format string, args ...interface{}) Warn(format string, args ...interface{}) Error(format string, args ...interface{}) }
Logger used for logging when export.
type MetaIR ¶
type MetaIR interface { SpecialComments() StringIter TargetName() string MetaSQL() string }
type MySQLReplicationBWList ¶
func (*MySQLReplicationBWList) Apply ¶
func (bw *MySQLReplicationBWList) Apply(schema, table string) bool
type MySQLReplicationConf ¶
type NopeBWList ¶
type NopeBWList struct{}
func (*NopeBWList) Apply ¶
func (bw *NopeBWList) Apply(schema, table string) bool
type RowReceiver ¶
type RowReceiver interface { BindAddress([]interface{}) ReportSize() uint64 }
type RowReceiverArr ¶
type RowReceiverArr []RowReceiverStringer
func (RowReceiverArr) BindAddress ¶
func (r RowReceiverArr) BindAddress(args []interface{})
func (RowReceiverArr) ReportSize ¶
func (r RowReceiverArr) ReportSize() uint64
func (RowReceiverArr) ToString ¶
func (r RowReceiverArr) ToString() string
type RowReceiverStringer ¶
type RowReceiverStringer interface { RowReceiver Stringer }
func MakeRowReceiver ¶
func MakeRowReceiver(colTypes []string) RowReceiverStringer
func SQLTypeBytesMaker ¶
func SQLTypeBytesMaker() RowReceiverStringer
func SQLTypeNumberMaker ¶
func SQLTypeNumberMaker() RowReceiverStringer
func SQLTypeStringMaker ¶
func SQLTypeStringMaker() RowReceiverStringer
type SQLRowIter ¶
type SQLRowIter interface { Next(RowReceiver) error HasNext() bool HasNextSQLRowIter() bool NextSQLRowIter() SQLRowIter // release SQLRowIter Close() error }
SQLRowIter is the iterator on a collection of sql.Row.
type SQLTypeBytes ¶
type SQLTypeBytes struct {
// contains filtered or unexported fields
}
func (*SQLTypeBytes) BindAddress ¶
func (s *SQLTypeBytes) BindAddress(arg []interface{})
func (*SQLTypeBytes) ReportSize ¶
func (s *SQLTypeBytes) ReportSize() uint64
func (*SQLTypeBytes) ToString ¶
func (s *SQLTypeBytes) ToString() string
type SQLTypeNumber ¶
type SQLTypeNumber struct {
SQLTypeString
}
func (SQLTypeNumber) ToString ¶
func (s SQLTypeNumber) ToString() string
type SQLTypeString ¶
type SQLTypeString struct {
sql.NullString
}
func (*SQLTypeString) BindAddress ¶
func (s *SQLTypeString) BindAddress(arg []interface{})
func (*SQLTypeString) ReportSize ¶
func (s *SQLTypeString) ReportSize() uint64
func (*SQLTypeString) ToString ¶
func (s *SQLTypeString) ToString() string
type ServerInfo ¶
type ServerInfo struct { ServerType ServerType ServerVersion *semver.Version }
func ParseServerInfo ¶
func ParseServerInfo(src string) ServerInfo
type ServerType ¶
type ServerType int8
func (ServerType) String ¶
func (s ServerType) String() string
type SimpleWriter ¶
type SimpleWriter struct {
// contains filtered or unexported fields
}
func (*SimpleWriter) WriteDatabaseMeta ¶
func (f *SimpleWriter) WriteDatabaseMeta(ctx context.Context, db, createSQL string) error
func (*SimpleWriter) WriteTableData ¶
func (f *SimpleWriter) WriteTableData(ctx context.Context, ir TableDataIR) error
func (*SimpleWriter) WriteTableMeta ¶
func (f *SimpleWriter) WriteTableMeta(ctx context.Context, db, table, createSQL string) error
type StringIter ¶
StringIter is the iterator on a collection of strings.
type TableDataIR ¶
type TableDataIR interface { DatabaseName() string TableName() string ChunkIndex() int ColumnCount() uint ColumnTypes() []string SelectedField() string SpecialComments() StringIter Rows() SQLRowIter }
TableDataIR is table data intermediate representation.
func SelectAllFromTable ¶
Click to show internal directories.
Click to hide internal directories.