fix: 数据源找不到直接退出提示改正
This commit is contained in:
@@ -131,7 +131,12 @@ func DB(source string) *gorm.DB {
|
|||||||
if source == "" {
|
if source == "" {
|
||||||
source = config.Get("database.defaultDataSourceName").(string)
|
source = config.Get("database.defaultDataSourceName").(string)
|
||||||
}
|
}
|
||||||
return dbMap[source]
|
db := dbMap[source]
|
||||||
|
if db == nil {
|
||||||
|
logger.Fatalf("not database source: %s", source)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return db
|
||||||
}
|
}
|
||||||
|
|
||||||
// Names 获取数据源名称列表
|
// Names 获取数据源名称列表
|
||||||
|
|||||||
Reference in New Issue
Block a user