GAAS GFrame项目web后台
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.

30 lines
735 B

package container
import (
"fmt"
"github.com/go-xorm/xorm"
)
type DefaultTransactionHandlerFactory struct {
// xorm.Engine
engine *xorm.Engine
}
// 创建事务句柄工厂
// 参数:
// 1.xorm.Engine
// 返回值:
// 1.事务句柄工厂
// 异常:
// 1.xorm.Engine不能为空!
func NewDefaultTransactionHandlerFactory(engine *xorm.Engine) *DefaultTransactionHandlerFactory {
if engine == nil {
panic(fmt.Sprintf("xorm.Engine不能为空!"))
}
return &DefaultTransactionHandlerFactory{engine}
}
// @Reference LAPP_GAAS_GFrame_BACKEND/container/TransactionHandlerFactory.Create
func (impl *DefaultTransactionHandlerFactory) Create() (TransactionHandler, error) {
return NewTransactionHandler(impl.engine.NewSession())
}