|
@@ -5,6 +5,7 @@
|
|
|
package xorm
|
|
package xorm
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "context"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/xormplus/core"
|
|
"github.com/xormplus/core"
|
|
@@ -74,6 +75,13 @@ func (eg *EngineGroup) Close() error {
|
|
|
return nil
|
|
return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// Context returned a group session
|
|
|
|
|
+func (eg *EngineGroup) Context(ctx context.Context) *Session {
|
|
|
|
|
+ sess := eg.NewSession()
|
|
|
|
|
+ sess.isAutoClose = true
|
|
|
|
|
+ return sess.Context(ctx)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// NewSession returned a group session
|
|
// NewSession returned a group session
|
|
|
func (eg *EngineGroup) NewSession() *Session {
|
|
func (eg *EngineGroup) NewSession() *Session {
|
|
|
sess := eg.Engine.NewSession()
|
|
sess := eg.Engine.NewSession()
|