init.go
391 字节
package bgorm
import (
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
"openapi/pkg/constant"
_ "openapi/pkg/infrastructure/bgorm/model"
)
func init() {
aliasName := "default"
_ = orm.RegisterDataBase(aliasName, "mysql", constant.MYSQL_DATA_SOURCE)
orm.SetMaxIdleConns(aliasName, constant.MYSQL_MAX_IDLE)
orm.SetMaxOpenConns(aliasName, constant.MYSQL_MAX_OPEN)
}