|
@@ -36,6 +36,14 @@ func GetDB(c *gin.Context, dbName ...string) *gorm.DB {
|
|
return DBS[d].WithContext(ctx)
|
|
return DBS[d].WithContext(ctx)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func GetDB2(dbName ...string) *gorm.DB {
|
|
|
|
+ d := "one"
|
|
|
|
+ if len(dbName) != 0 {
|
|
|
|
+ d = dbName[0]
|
|
|
|
+ }
|
|
|
|
+ return DBS[d]
|
|
|
|
+}
|
|
|
|
+
|
|
func InitDBS(env string, conf []DbConfig) {
|
|
func InitDBS(env string, conf []DbConfig) {
|
|
DBS = map[string]*gorm.DB{}
|
|
DBS = map[string]*gorm.DB{}
|
|
if len(conf) == 1 {
|
|
if len(conf) == 1 {
|