|
@@ -4,22 +4,41 @@ import (
|
|
|
"eta/eta_chart_lib/models/data_manage"
|
|
|
"eta/eta_chart_lib/models/data_manage/future_good"
|
|
|
"eta/eta_chart_lib/utils"
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
+ _ "github.com/lib/pq"
|
|
|
"time"
|
|
|
-
|
|
|
- "github.com/beego/beego/v2/client/orm"
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
- _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL)
|
|
|
+ /*// 高斯数据库的连接字符串
|
|
|
+ connStr := "user=lhr dbname=postgres sslmode=disable password=lhr host=192.168.0.106 port=7654"
|
|
|
+
|
|
|
+ // 使用pq连接高斯数据库
|
|
|
+ db1, err := sql.Open("postgres", connStr)
|
|
|
+ if err != nil {
|
|
|
+ panic(err)
|
|
|
+ }
|
|
|
+ defer db1.Close()
|
|
|
+
|
|
|
+ // 测试连接
|
|
|
+ err = db1.Ping()
|
|
|
+ if err != nil {
|
|
|
+ panic(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println("Connected to the postgres database!")*/
|
|
|
+
|
|
|
+ _ = orm.RegisterDataBase("default", utils.DBDRIVER_NAME, 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.RegisterDataBase("data", "mysql", utils.MYSQL_URL_DATA)
|
|
|
+ _ = orm.RegisterDataBase("data", utils.DBDRIVER_NAME, "user=etadb dbname=eta_index sslmode=disable password=8lAwq4qYbrC7 host=106.14.64.48 port=15400")
|
|
|
orm.SetMaxIdleConns("data", 50)
|
|
|
orm.SetMaxOpenConns("data", 100)
|
|
|
|