Documentation ¶
Index ¶
- Constants
- Variables
- func CastSliceInterfaceToSliceString(a []interface{}) ([]string, error)
- func CastToSlice(arg interface{}) (out []interface{}, ok bool)
- func CheckBinlogFormat(db *sql.DB) error
- func CloseDBConnection(db *sql.DB) error
- func CloseDBConnections(dbs ...*sql.DB)
- func CompareBinlogPos(a, b gomysql.Position, deviation float64) int
- func CreateDBConnection(cfg *DBConfig) (*sql.DB, error)
- func CreateEtcdClient(etcdEndpoints string) (*clientv3.Client, error)
- func EstimateRowsCount(db *sql.DB, schemaName string, tableName string) (int64, error)
- func GenHashKey(key string) uint32
- func GenerateRandomServerID() uint32
- func GenerateTxnTagSQL(pipelineName string) string
- func GetExecutable(url string, dir string, name string) (string, error)
- func GetIndexRows(db *sql.DB, statement string) ([][]sql.NullString, error)
- func GetLabelEnvString() string
- func GetLabelsFromEnv(envString string) (map[string]string, error)
- func GetPrimaryKeys(db *sql.DB, schemaName string, tableName string) ([]string, error)
- func GetScanPtrSafe(columnIdx int, columnTypes []*sql.ColumnType, vPtrs []interface{}) (interface{}, error)
- func GetScanType(columnType *sql.ColumnType) reflect.Type
- func GetServerTimezone(db *sql.DB) (string, error)
- func GetTables(db *sql.DB) ([]string, error)
- func GetUniqueIndexesWithoutPks(db *sql.DB, schemaName string, tableName string) ([]string, error)
- func Glob(pattern, subj string) bool
- func InitInternalTxnTags(db *sql.DB) error
- func IsBinlogPurgedError(err error) bool
- func IsColumnString(columnType *sql.ColumnType) bool
- func IsInternalTraffic(db string, tbl string) bool
- func IsTableEmpty(db *sql.DB, schema string, table string) bool
- func IsTiDB(db *sql.DB) bool
- func LogRawInfo(app string)
- func MustCreateEtcdClient(etcdEndpoints string) *clientv3.Client
- func MustGetLabelsFromEnv() map[string]string
- func NewBinlogSyncer(serverID uint32, dbConfig *DBConfig) *replication.BinlogSyncer
- func NewBoolPtr(b bool) *bool
- func NewStringPtr(s string) *string
- func PrintRawInfo(app string)
- func QueryGeneralRowsDataWithSQL(db *sql.DB, statement string, args ...interface{}) ([][]interface{}, error)
- func SQLWithAnnotation(annotation string, sql string) string
- func ScanGeneralRows(rows *sql.Rows, columnTypes []*sql.ColumnType) ([]interface{}, error)
- func ScanGeneralRowsWithDataPtrs(rows *sql.Rows, columnTypes []*sql.ColumnType, vPtrs []interface{}) ([]interface{}, error)
- func Struct2Map(i interface{}) (ret map[string]interface{})
- func TableIdentity(schemaName string, tableName string) string
- func TakeArg(arg interface{}, kind reflect.Kind) (val reflect.Value, ok bool)
- func TestCaseMd5Name(t *testing.T) string
- type Closer
- type DBConfig
- type MySQLBinlogPosition
- type MySQLDB
- type MySQLStatusGetter
Constants ¶
View Source
const GLOB = "*"
The character which is treated like a glob
Variables ¶
View Source
var ( Version = "None" BuildTS = "None" GitHash = "None" GitBranch = "None" )
Version information.
View Source
var TxnTagSQLFormat = fmt.Sprintf("insert into `%s`.`%s`", dbNameV2, tableNameV2)
Only for test purpose
Functions ¶
func CastSliceInterfaceToSliceString ¶ added in v0.9.8
func CastToSlice ¶ added in v0.9.8
func CastToSlice(arg interface{}) (out []interface{}, ok bool)
arg can be slice of any type
func CheckBinlogFormat ¶
CheckBinlogFormat checks binlog format
func CloseDBConnection ¶
func CloseDBConnections ¶
func CompareBinlogPos ¶
CompareBinlogPos Compare binlog positions. The result will be 0 if |a-b| < deviation, otherwise -1 if a < b, and +1 if a > b.
func EstimateRowsCount ¶
func GenerateRandomServerID ¶
func GenerateRandomServerID() uint32
func GenerateTxnTagSQL ¶ added in v0.9.4
func GetExecutable ¶ added in v0.9.22
func GetIndexRows ¶
func GetLabelEnvString ¶
func GetLabelEnvString() string
func GetPrimaryKeys ¶
func GetScanPtrSafe ¶
func GetScanPtrSafe(columnIdx int, columnTypes []*sql.ColumnType, vPtrs []interface{}) (interface{}, error)
func GetScanType ¶
func GetScanType(columnType *sql.ColumnType) reflect.Type
GetScanType returns better scan type than go-sql-driver/mysql
func GetServerTimezone ¶
GetServerTimezone get timezone of the MySQL server.
func Glob ¶
Glob will test a string pattern, potentially containing globs, against a subject string. The result is a simple true/false, determining whether or not the glob pattern matched the subject text.
func InitInternalTxnTags ¶ added in v0.9.4
func IsBinlogPurgedError ¶
func IsColumnString ¶
func IsColumnString(columnType *sql.ColumnType) bool
func IsInternalTraffic ¶ added in v0.9.4
func IsTableEmpty ¶ added in v0.9.17
func MustCreateEtcdClient ¶
func MustGetLabelsFromEnv ¶
func NewBinlogSyncer ¶
func NewBinlogSyncer(serverID uint32, dbConfig *DBConfig) *replication.BinlogSyncer
func NewBoolPtr ¶
func NewStringPtr ¶
func PrintRawInfo ¶
func PrintRawInfo(app string)
PrintRawInfo prints the version information without log info.
func SQLWithAnnotation ¶
func ScanGeneralRows ¶
func ScanGeneralRows(rows *sql.Rows, columnTypes []*sql.ColumnType) ([]interface{}, error)
func ScanGeneralRowsWithDataPtrs ¶
func ScanGeneralRowsWithDataPtrs(rows *sql.Rows, columnTypes []*sql.ColumnType, vPtrs []interface{}) ([]interface{}, error)
func Struct2Map ¶ added in v0.9.25
func Struct2Map(i interface{}) (ret map[string]interface{})
func TableIdentity ¶
func TestCaseMd5Name ¶ added in v0.9.17
Types ¶
type DBConfig ¶
type DBConfig struct { Host string `toml:"host" json:"host" mapstructure:"host"` Location string `toml:"location" json:"location" mapstructure:"location"` Username string `toml:"username" json:"username" mapstructure:"username"` Password string `toml:"password" json:"password" mapstructure:"password"` Port int `toml:"port" json:"port" mapstructure:"port"` Schema string `toml:"schema" json:"schema" mapstructure:"schema"` MaxIdle int `toml:"max-idle" json:"max-idle" mapstructure:"max-idle"` MaxOpen int `toml:"max-open" json:"max-open" mapstructure:"max-open"` MaxLifeTimeDurationStr string `toml:"max-life-time-duration" json:"max-life-time-duration" mapstructure:"max-life-time-duration"` MaxLifeTimeDuration time.Duration `toml:"-" json:"-" mapstructure:"-"` }
DBConfig is the DB configuration.
func TestConfig ¶
func TestConfig() *DBConfig
func (*DBConfig) ValidateAndSetDefault ¶
type MySQLBinlogPosition ¶
type MySQLStatusGetter ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.