You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dorm/gorm_transaction.go

19 lines
339 B

2 years ago
package dorm
import "gorm.io/gorm"
// Begin 开始事务,不需要创建 Session 对象
func (c *GormClient) Begin() *gorm.DB {
5 months ago
return c.db.Begin()
2 years ago
}
// Rollback 回滚事务
func (c *GormClient) Rollback() *gorm.DB {
5 months ago
return c.db.Rollback()
2 years ago
}
// Commit 提交事务
func (c *GormClient) Commit() *gorm.DB {
5 months ago
return c.db.Commit()
2 years ago
}