12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package models
- import (
- "eta/eta_mini_bridge/utils"
- "time"
- "github.com/beego/beego/v2/client/orm"
- _ "github.com/go-sql-driver/mysql"
- )
- func init() {
- _ = orm.RegisterDataBase("rddp", "mysql", utils.MYSQL_URL_RDDP)
- orm.SetMaxIdleConns("rddp", 50)
- orm.SetMaxOpenConns("rddp", 100)
- report_db, _ := orm.GetDB("rddp")
- report_db.SetConnMaxLifetime(10 * time.Minute)
- _ = orm.RegisterDataBase("data", "mysql", utils.MYSQL_URL_DATA)
- orm.SetMaxIdleConns("data", 50)
- orm.SetMaxOpenConns("data", 100)
- data_db, _ := orm.GetDB("data")
- data_db.SetConnMaxLifetime(10 * time.Minute)
- _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL_MASTER)
- orm.SetMaxIdleConns("default", 50)
- orm.SetMaxOpenConns("default", 100)
- master_db, _ := orm.GetDB("default")
- master_db.SetConnMaxLifetime(10 * time.Minute)
- orm.Debug = true
- orm.DebugLog = orm.NewLog(utils.BinLog)
- // register model
- orm.RegisterModel(
- new(User),
- new(UserRecord),
- new(UserTemplateRecord),
- )
- }
|