diff --git a/engine.go b/engine.go index 6c974d7a..07a23d30 100644 --- a/engine.go +++ b/engine.go @@ -1420,6 +1420,6 @@ func (engine *Engine) FormatTime(sqlTypeName string, t time.Time) (v interface{} // Always disable struct tag "deleted" func (engine *Engine) Unscoped() *Session { session := engine.NewSession() - defer session.Close() + session.IsAutoClose = true return session.Unscoped() }