数据库事务操作优化
This commit is contained in:
parent
125ccc5c3b
commit
dcce8ace9e
@ -271,7 +271,11 @@ func (that *HoTimeDB) GetType() string {
|
|||||||
|
|
||||||
// Action 事务,如果action返回true则执行成功;false则回滚
|
// Action 事务,如果action返回true则执行成功;false则回滚
|
||||||
func (that *HoTimeDB) Action(action func(db HoTimeDB) (isSuccess bool)) (isSuccess bool) {
|
func (that *HoTimeDB) Action(action func(db HoTimeDB) (isSuccess bool)) (isSuccess bool) {
|
||||||
db := HoTimeDB{DB: that.DB, HoTimeCache: that.HoTimeCache, Prefix: that.Prefix}
|
db := HoTimeDB{that.DB, that.ContextBase, that.DBName,
|
||||||
|
that.HoTimeCache, that.Log, that.Type,
|
||||||
|
that.Prefix, that.LastQuery, that.LastData,
|
||||||
|
that.ConnectFunc, that.LastErr, that.limit, that.Tx,
|
||||||
|
that.SlaveDB, that.Mode}
|
||||||
tx, err := db.Begin()
|
tx, err := db.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
that.LastErr.SetError(err)
|
that.LastErr.SetError(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user