|
@@ -12,10 +12,11 @@ import (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- Mgo_Log *mongodb.MongodbSim
|
|
|
- Mgo *mongodb.MongodbSim
|
|
|
- Mysql *mysql.Mysql
|
|
|
- Tidb *mysql.Mysql
|
|
|
+ Mgo_Log *mongodb.MongodbSim
|
|
|
+ Mgo *mongodb.MongodbSim
|
|
|
+ Mysql *mysql.Mysql
|
|
|
+ Tidb *mysql.Mysql
|
|
|
+ TidbPoint *mysql.Mysql
|
|
|
)
|
|
|
|
|
|
type MgoConf struct {
|
|
@@ -100,4 +101,20 @@ func init() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ var tidbPointConf MysqlConf
|
|
|
+ if err := gcfg.Instance().MustGet(gctx.New(), "databases.tidbPoint").Scan(&tidbPointConf); err == nil {
|
|
|
+ if tidbPointConf.Address != "" {
|
|
|
+ log.Println("--初始化 tidb--")
|
|
|
+ TidbPoint = &mysql.Mysql{
|
|
|
+ Address: tidbPointConf.Address,
|
|
|
+ UserName: tidbPointConf.UserName,
|
|
|
+ PassWord: tidbPointConf.PassWord,
|
|
|
+ DBName: tidbPointConf.DbName,
|
|
|
+ MaxOpenConns: tidbPointConf.MaxOpenConns,
|
|
|
+ MaxIdleConns: tidbPointConf.MaxIdleConns,
|
|
|
+ }
|
|
|
+ TidbPoint.Init()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|