Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 06528a4

Browse files
jixiufBetaCat0
authored andcommitted
add func (eg *EngineGroup) Context(ctx context.Context) *Session (#1267)
1 parent 617e0ae commit 06528a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

engine_group.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package xorm
66

77
import (
8+
"context"
89
"time"
910

1011
"github.com/go-xorm/core"
@@ -74,6 +75,13 @@ func (eg *EngineGroup) Close() error {
7475
return nil
7576
}
7677

78+
// Context returned a group session
79+
func (eg *EngineGroup) Context(ctx context.Context) *Session {
80+
sess := eg.NewSession()
81+
sess.isAutoClose = true
82+
return sess.Context(ctx)
83+
}
84+
7785
// NewSession returned a group session
7886
func (eg *EngineGroup) NewSession() *Session {
7987
sess := eg.Engine.NewSession()

0 commit comments

Comments
 (0)