Documentation ¶
Index ¶
- Variables
- func ExecuteSQLs(db *sql.DB, sqls []string, args [][]interface{}, isDDL bool) error
- func ExecuteSQLsWithHistogram(db *sql.DB, sqls []string, args [][]interface{}, isDDL bool, ...) error
- func ExecuteTxn(db *sql.DB, sqls []string, args [][]interface{}) error
- func ExecuteTxnWithHistogram(db *sql.DB, sqls []string, args [][]interface{}, hist *prometheus.HistogramVec) error
- func GetOraclePosition(db *sql.DB) (int64, error)
- func GetSQLErrCode(err error) (errors.ErrCode, bool)
- func GetTidbPosition(db *sql.DB) (int64, error)
- func IgnoreDDLError(err error) bool
- func OpenCH(host string, port int, username string, password string, dbName string, ...) (*sql.DB, error)
- func OpenDB(proto string, host string, port int, username string, password string) (*sql.DB, error)
- func OpenDBWithSQLMode(proto string, host string, port int, username string, password string, ...) (*sql.DB, error)
- func QuoteName(name string) string
- func QuoteSchema(schema string, table string) string
- func ScanRow(rows *sql.Rows) (map[string][]byte, error)
- type CHHostAndPort
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MaxDMLRetryCount defines maximum number of times of DML retrying. MaxDMLRetryCount = 100 // MaxDDLRetryCount defines maximum number of times of DDL retrying. MaxDDLRetryCount = 5 // RetryWaitTime defines wait time when retrying. RetryWaitTime = 3 * time.Second // SlowWarnLog defines the duration to log warn log of sql when exec time greater than SlowWarnLog = 100 * time.Millisecond )
Functions ¶
func ExecuteSQLs ¶
ExecuteSQLs execute sqls in a transaction with retry.
func ExecuteSQLsWithHistogram ¶
func ExecuteSQLsWithHistogram(db *sql.DB, sqls []string, args [][]interface{}, isDDL bool, hist *prometheus.HistogramVec) error
ExecuteSQLsWithHistogram execute sqls in a transaction with retry.
func ExecuteTxn ¶
ExecuteTxn executes transaction
func ExecuteTxnWithHistogram ¶
func ExecuteTxnWithHistogram(db *sql.DB, sqls []string, args [][]interface{}, hist *prometheus.HistogramVec) error
ExecuteTxnWithHistogram executes transaction
func GetOraclePosition ¶
GetOraclePosition return oracle scn
func GetSQLErrCode ¶
GetSQLErrCode returns error code if err is a mysql error
func GetTidbPosition ¶
GetTidbPosition gets tidb's position.
func IgnoreDDLError ¶
IgnoreDDLError checks the error can be ignored or not.
func OpenCH ¶
func OpenCH(host string, port int, username string, password string, dbName string, blockSize int) (*sql.DB, error)
OpenCH opens a connection to CH and returns the standard SQL driver's DB interface.
func OpenDBWithSQLMode ¶
func OpenDBWithSQLMode(proto string, host string, port int, username string, password string, sqlMode *string) (*sql.DB, error)
OpenDBWithSQLMode creates an instance of sql.DB.
func QuoteSchema ¶
QuoteSchema quote like `dbname`.`table` name
Types ¶
type CHHostAndPort ¶
CHHostAndPort is a CH host:port pair.
func ParseCHAddr ¶
func ParseCHAddr(addr string) ([]CHHostAndPort, error)
ParseCHAddr parses an address config string to CHHostAndPort pairs.
Click to show internal directories.
Click to hide internal directories.