package models import ( "eta/eta_forum_hub/models/system" "eta/eta_forum_hub/utils" "github.com/beego/beego/v2/client/orm" _ "github.com/go-sql-driver/mysql" "time" ) func init() { _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL) orm.SetMaxIdleConns("default", 50) orm.SetMaxOpenConns("default", 100) db, _ := orm.GetDB("default") db.SetConnMaxLifetime(10 * time.Minute) orm.Debug = true orm.DebugLog = orm.NewLog(utils.Binlog) initChart() initEdbData() initSystem() } // initChart 图表 数据表 func initChart() { orm.RegisterModel( new(ChartClassify), new(ChartInfo), new(ChartEdbMapping), new(ChartTheme), new(ChartThemeType), new(ChartSeries), new(ChartSeriesEdbMapping), ) } // initEdbData 指标服务 数据表 func initEdbData() { orm.RegisterModel( new(EdbInfoCalculateMapping), new(EdbInfo), ) } func initSystem() { orm.RegisterModel(new(system.Admin)) }