Zeus/helper/gorm_helper.go

13 lines
308 B
Go
Raw Normal View History

2021-12-13 21:39:15 +08:00
package helper
import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
func GormMap() (map[string]*gorm.DB, error) {
dsn := "root:123456qwe@tcp(127.0.0.1:3306)/test?charset=utf8mb4&parseTime=True&loc=Local"
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
return map[string]*gorm.DB{"local": db}, err
}