Zeus/helper/gorm_helper.go

13 lines
308 B
Go

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
}