作者 yangfu

注释

... ... @@ -6,16 +6,16 @@ import (
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
)
func NewBeeormEngine(conf config.Mysql){
aliasName :="default"
if len(conf.AliasName)>0{
func NewBeeormEngine(conf config.Mysql) {
aliasName := "default"
if len(conf.AliasName) > 0 {
aliasName = conf.AliasName
}
err:=orm.RegisterDataBase(aliasName,"mysql",conf.DataSource)
if err!=nil{
err := orm.RegisterDataBase(aliasName, "mysql", conf.DataSource)
if err != nil {
log.Error(err)
}else{
log.Debug("open db address:",conf.DataSource)
} else {
//log.Debug("open db address:",conf.DataSource)
}
orm.SetMaxIdleConns(aliasName, conf.MaxIdle)
orm.SetMaxOpenConns(aliasName, conf.MaxOpen)
... ...