add func (eg *EngineGroup) Context(ctx context.Context) *Session (#1267)
This commit is contained in:
parent
617e0ae295
commit
06528a4d83
|
@ -5,6 +5,7 @@
|
|||
package xorm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/go-xorm/core"
|
||||
|
@ -74,6 +75,13 @@ func (eg *EngineGroup) Close() error {
|
|||
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
|
||||
func (eg *EngineGroup) NewSession() *Session {
|
||||
sess := eg.Engine.NewSession()
|
||||
|
|
Loading…
Reference in New Issue