diff options
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/models/models.go b/models/models.go index 8c10e7abfc..9eb174e200 100644 --- a/models/models.go +++ b/models/models.go @@ -6,6 +6,7 @@ package models import ( + "context" "database/sql" "errors" "fmt" @@ -164,11 +165,13 @@ func SetEngine() (err error) { } // NewEngine initializes a new xorm.Engine -func NewEngine(migrateFunc func(*xorm.Engine) error) (err error) { +func NewEngine(ctx context.Context, migrateFunc func(*xorm.Engine) error) (err error) { if err = SetEngine(); err != nil { return err } + x.SetDefaultContext(ctx) + if err = x.Ping(); err != nil { return err } |