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 Count(session *mgo.Session, db string, collection string) int64
- func CreateDBConnection(cfg *config.DBConfig) (*sql.DB, error)
- func CreateEtcdClient(etcdEndpoints string) (*clientv3.Client, error)
- func CreateMongoClient(cfg *config.MongoConnConfig) (*mongo.Client, error)
- func CreateMongoSession(cfg *config.MongoConnConfig) (*mgo.Session, 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 IsCircularTrafficTag(db string, tbl string) bool
- func IsColumnFloat(columnType *sql.ColumnType) bool
- func IsColumnString(columnType *sql.ColumnType) bool
- func IsDeadSignal(op *gtm.Op, pipeline string) bool
- func IsEmpty(session *mgo.Session, db string, collection string) bool
- func IsTableEmpty(db *sql.DB, schema string, table string, condition string) bool
- func IsTiDB(db *sql.DB) bool
- func ListAllUserCollections(session *mgo.Session) map[string][]string
- func LogRawInfo(app string)
- func MustAny2Map(i interface{}) (ret map[string]interface{})
- func MustCreateEtcdClient(etcdEndpoints string) *clientv3.Client
- func MustGetLabelsFromEnv() map[string]string
- func NewBinlogSyncer(serverID uint32, dbConfig *config.DBConfig, heartbeatPeriod time.Duration) *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 SendDeadSignal(session *mgo.Session, pipeline string) error
- 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
- func TestConfig() *config.DBConfig
- type Closer
- type MinMax
- type MySQLDB
- type MySQLStatusGetter
Constants ¶
const GLOB = "*"
The character which is treated like a glob
Variables ¶
var ( Version = "None" BuildTS = "None" GitHash = "None" GitBranch = "None" )
Version information.
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 CreateMongoClient ¶ added in v0.9.44
func CreateMongoClient(cfg *config.MongoConnConfig) (*mongo.Client, error)
func CreateMongoSession ¶ added in v0.9.44
func CreateMongoSession(cfg *config.MongoConnConfig) (*mgo.Session, error)
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 IsCircularTrafficTag ¶ added in v0.9.58
func IsColumnFloat ¶ added in v0.9.55
func IsColumnFloat(columnType *sql.ColumnType) bool
float, double is already handled https://github.com/go-sql-driver/mysql/blob/master/fields.go#L166
func IsColumnString ¶
func IsColumnString(columnType *sql.ColumnType) bool
We need to look at this file to check each type https://github.com/go-sql-driver/mysql/blob/master/fields.go
func IsTableEmpty ¶ added in v0.9.17
func ListAllUserCollections ¶ added in v0.9.44
func MustAny2Map ¶ added in v0.9.35
func MustAny2Map(i interface{}) (ret map[string]interface{})
func MustCreateEtcdClient ¶
func MustGetLabelsFromEnv ¶
func NewBinlogSyncer ¶
func NewBinlogSyncer(serverID uint32, dbConfig *config.DBConfig, heartbeatPeriod time.Duration) *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 SendDeadSignal ¶ added in v0.9.44
func TableIdentity ¶
func TestCaseMd5Name ¶ added in v0.9.17
func TestConfig ¶
Types ¶
type MinMax ¶ added in v0.9.44
type MinMax struct { Min interface{} Max interface{} }