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()) }