Remove global context from db package (#35371)

This commit is contained in:
wxiaoguang
2025-08-28 17:44:02 +08:00
committed by GitHub
parent fb056bf4ed
commit dca1af7cad
2 changed files with 16 additions and 62 deletions

View File

@@ -86,7 +86,6 @@ func InitEngine(ctx context.Context) error {
func SetDefaultEngine(ctx context.Context, eng *xorm.Engine) {
xormEngine = eng
xormEngine.SetDefaultContext(ctx)
xormContext = &xormContextType{Context: ctx, engine: xormEngine}
}
// UnsetDefaultEngine closes and unsets the default engine
@@ -98,7 +97,6 @@ func UnsetDefaultEngine() {
_ = xormEngine.Close()
xormEngine = nil
}
xormContext = nil
}
// InitEngineWithMigration initializes a new xorm.Engine and sets it as the XORM's default context