12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package models
- import (
- "eta/eta_chart_lib/models/data_manage"
- "eta/eta_chart_lib/models/data_manage/future_good"
- "eta/eta_chart_lib/utils"
- _ "github.com/go-sql-driver/mysql"
- "time"
- "github.com/beego/beego/v2/client/orm"
- )
- 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.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.Debug = true
- orm.DebugLog = orm.NewLog(utils.Binlog)
- //注册对象
- orm.RegisterModel(
- new(data_manage.EdbInfo),
- new(ShareChartRefreshLog), //分享图表刷新日志表
- new(ExcelInfo), //excel表格
- new(data_manage.PredictEdbConf), //预测指标配置
- new(data_manage.PredictEdbRuleData), //预测指标配置生成的数据
- new(data_manage.PredictEdbConfCalculateMapping), //预测指标关系表
- new(data_manage.ChartInfoCorrelation), // 图表相关性信息
- new(FactorEdbSeriesCalculateDataQjjs), // 因子指标系列-区间计算数据
- )
- // 期货数据库
- initFutureGood()
- // 初始化部分数据表变量(直接init会有顺序问题=_=!)
- afterInitTable()
- }
- // initFutureGood 注册期货数据 数据表
- func initFutureGood() {
- //注册对象
- orm.RegisterModel(
- new(future_good.FutureGoodEdbInfo), //期货指标表
- new(future_good.FutureGoodEdbData), //期货指标数据表
- new(future_good.ChartInfoFutureGoodProfit), //期货利润图的扩展表
- )
- }
- // afterInitTable
- // @Description: 初始化表结构的的后置操作
- // @author: Roc
- // @datetime 2024-07-01 13:31:09
- func afterInitTable() {
- // 初始化指标来源配置
- data_manage.InitEdbSourceVar()
- // 初始化是否启用mongo配置
- InitUseMongoConf()
- }
|