Commit 3b11f6f7 by zhengqiuyun86

初始化

parent c08a7a8d
...@@ -79,10 +79,11 @@ var Es = EsConf{} ...@@ -79,10 +79,11 @@ var Es = EsConf{}
//Mysql conf //Mysql conf
type MysqlConf struct { type MysqlConf struct {
Host string Host string
Port int Port int
User string User string
Password string Password string
NameSpace string
} }
var MySql = MysqlConf{} var MySql = MysqlConf{}
...@@ -107,8 +107,8 @@ func Init() { ...@@ -107,8 +107,8 @@ func Init() {
}, },
) )
var err error var err error
customerDb, err = gorm.Open(mysql.Open(fmt.Sprintf("%s:%s@tcp(%s:%d)/duocaihui_dev?charset=utf8mb4&parseTime=True&loc=Local", customerDb, err = gorm.Open(mysql.Open(fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local",
conf.MySql.User, conf.MySql.Password, conf.MySql.Host, conf.MySql.Port)), &gorm.Config{ conf.MySql.User, conf.MySql.Password, conf.MySql.Host, conf.MySql.Port, conf.MySql.NameSpace)), &gorm.Config{
Logger: newLogger, Logger: newLogger,
}) })
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment