Documentation ¶
Index ¶
- func IsErrDupEntry(err error) bool
- func RunWithRetry(ctx context.Context, retryCnt int, interval time.Duration, f func() error) error
- type DBAccessor
- type DBConnect
- func (conn *DBConnect) Begin() error
- func (conn *DBConnect) CloseDB() error
- func (conn *DBConnect) Commit() error
- func (conn *DBConnect) Exec(query string, args ...interface{}) (sql.Result, error)
- func (conn *DBConnect) GetBeginTime() time.Time
- func (conn *DBConnect) GetDB() *sql.DB
- func (conn *DBConnect) GetDBAccessor() DBAccessor
- func (conn *DBConnect) GetTiDBTS() (uint64, error)
- func (conn *DBConnect) IfTxn() bool
- func (conn *DBConnect) MustExec(query string, args ...interface{}) sql.Result
- func (conn *DBConnect) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (conn *DBConnect) ReConnect() error
- func (conn *DBConnect) Rollback() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrDupEntry ¶
IsErrDupEntry returns true if error code = 1062
Types ¶
type DBAccessor ¶
type DBAccessor interface { Exec(query string, args ...interface{}) (sql.Result, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row }
DBAccessor can be txn snapshot or db it self
type DBConnect ¶
DBConnect wraps db
func (*DBConnect) GetBeginTime ¶
GetBeginTime get the begin time of a transaction if not in transaction, return 0
func (*DBConnect) GetDBAccessor ¶
func (conn *DBConnect) GetDBAccessor() DBAccessor
GetDBAccessor get DBAccessor interface
Click to show internal directories.
Click to hide internal directories.