Documentation ¶
Index ¶
- func ExecWithRollback(db *sql.DB, queries []QueryEntry) (res sql.Result, err error)
- func Hashfnv32a(b []byte) uint32
- func IgnoreErrors(err error, ignoreErrs []terror.ErrCode) bool
- func InstallArchive(ctx context.Context, rawURL string, dest string) error
- func IsErrDupEntry(err error) bool
- func IsErrTableNotExists(err error) bool
- func IsFileExist(name string) bool
- func MustExec(db *sql.DB, query string, args ...interface{}) sql.Result
- func OpenDB(dsn string, maxIdleConns int) (*sql.DB, error)
- func RandString(b []byte, r *rand.Rand)
- func RandomlyChangeReplicaRead(job, replicaRead string, db *sql.DB)
- func RunWithRetry(ctx context.Context, retryCnt int, interval time.Duration, f func() error) error
- func Wget(ctx context.Context, rawURL string, dest string) (string, error)
- type QueryEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecWithRollback ¶
ExecWithRollback executes or rollback
func Hashfnv32a ¶
Hashfnv32a returns 32-bit FNV-1a hash for a byte slice
func IgnoreErrors ¶
IgnoreErrors returs true if ignoreErrs contains err
func InstallArchive ¶
InstallArchive downloads the URL and extracts the archive to the dest diretory. Supports zip, and tarball.
func IsErrDupEntry ¶
IsErrDupEntry returns true if error code = 1062
func IsErrTableNotExists ¶
IsErrTableNotExists checks whether err is TableNotExists error
func RandString ¶
RandString reference: http://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang
func RandomlyChangeReplicaRead ¶
RandomlyChangeReplicaRead changes `tidb_replica_read` randomly in a session.
func RunWithRetry ¶
RunWithRetry tries to run func in specified count
Types ¶
type QueryEntry ¶
QueryEntry is a query
Click to show internal directories.
Click to hide internal directories.