完善资源关闭逻辑,添加数据库和Redis连接的退出处理
This commit is contained in:
@@ -47,6 +47,17 @@ func Init() {
|
||||
DB = db
|
||||
}
|
||||
|
||||
func Exit() error {
|
||||
if DB != nil {
|
||||
conn, err := DB.DB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return conn.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type WithAlias interface {
|
||||
Alias() string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user