fix: DB空数据源时选择默认
This commit is contained in:
@@ -117,6 +117,9 @@ func DefaultDB() *gorm.DB {
|
|||||||
|
|
||||||
// 获取数据源
|
// 获取数据源
|
||||||
func DB(source string) *gorm.DB {
|
func DB(source string) *gorm.DB {
|
||||||
|
if source == "" {
|
||||||
|
source = config.Get("gorm.defaultDataSourceName").(string)
|
||||||
|
}
|
||||||
return dbMap[source]
|
return dbMap[source]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user