package container
|
|
|
|
import "github.com/go-xorm/xorm"
|
|
|
|
// 事务句柄
|
|
type TransactionHandler interface {
|
|
// 关闭会话
|
|
Close()
|
|
// 开启事务
|
|
// 返回值
|
|
// 1.错误
|
|
Begin() error
|
|
// 提交事务
|
|
// 返回值
|
|
// 1.错误
|
|
Commit() error
|
|
// xorm.Session
|
|
// 返回值
|
|
// 1.xorm.Session
|
|
Session() *xorm.Session
|
|
}
|
|
|
|
func NewTransactionHandler(session *xorm.Session) (TransactionHandler, error) {
|
|
return NewDefaultTransactionHandler(session)
|
|
}
|