Documentation
¶
Index ¶
- Variables
- func CharsetWhite() []string
- func IsCannotAddOrUpdateAChildRowError(e error) bool
- func MaxSamplingSize() uint64
- func ParseCreateTableStmt(create string) (*ast.CreateTableStmt, error)
- func Sampling() bool
- func TrimBlockFormat(create string) string
- func TrimCharacterSetFromRawCreateTableSQL(create string, except ...string) string
- func TrimCollateOptionFromCols(create *ast.CreateTableStmt)
- func TrimCollateOptionFromCreateTable(create *ast.CreateTableStmt)
- func TrimConstraintCheckFromCreateTable(create *ast.CreateTableStmt)
- func TrimInvalidCollate(create string) string
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
var ( CharsetCollatePat = `` /* 187-byte string literal not displayed */ //CharsetCollateRe = regexp.MustCompile(`(?mi)(?P<charset_expr>((default\s+)?(CHARACTER\s+SET|CHARSET)(\s*=?\s*|\s+)(?P<charset_value>[^(utf8mb4)]+))|(?P<collate_expr>COLLATE(\s*=?\s*|\s+)(?P<collate_value>[A-Za-z0-9_]+)))`) CharsetCollateRe = regexp.MustCompile(CharsetCollatePat, regexp.IgnoreCase|regexp.Multiline|regexp.RE2) )
Functions ¶
func CharsetWhite ¶
func CharsetWhite() []string
func MaxSamplingSize ¶
func MaxSamplingSize() uint64
MaxSamplingSize returns the max sampling size. Set it by env "PIPELINE_MIGRATION_SAMPLING_SIZE"
func ParseCreateTableStmt ¶
func ParseCreateTableStmt(create string) (*ast.CreateTableStmt, error)
ParseCreateTableStmt parses CreateTableStmt as *ast.CreateTableStmt node
func Sampling ¶
func Sampling() bool
Sampling returns true if it needs to sampling when snapshot. Set it by env "PIPELINE_MIGRATION_DATABASE=true"
func TrimBlockFormat ¶
func TrimCollateOptionFromCols ¶
func TrimCollateOptionFromCols(create *ast.CreateTableStmt)
func TrimCollateOptionFromCreateTable ¶
func TrimCollateOptionFromCreateTable(create *ast.CreateTableStmt)
func TrimConstraintCheckFromCreateTable ¶
func TrimConstraintCheckFromCreateTable(create *ast.CreateTableStmt)
func TrimInvalidCollate ¶
Types ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot maintains the structure of the database tables
func From ¶
From snapshots the structure of the database tables, and returns the Snapshot. tx is the connection handler of the goal DB. ignore is the tables you do not want to snapshot.
func (*Snapshot) Dump ¶
Dump dumps data from DB. tableName is the table you want to dump. lines is the numbers of lines you want to dump. Note: lines is an approximate number rather than an exact number. Note: the max data size is not more than 1<<16 (the MySQL default max placeholders size).
func (*Snapshot) HasAnyTable ¶
HasAnyTable returns true if there is any table in the Snapshot
func (*Snapshot) TableNames ¶
TableNames returns all tables names