12345678910111213141516171819202122 |
- package models
- import (
- "encoding/json"
- "eta_gn/eta_index_lib/utils"
- "eta_gn/eta_index_lib/utils/mgodb"
- )
- func init() {
- if utils.MgoUrlData != `` {
- var mgoConfig mgodb.MgoConfig
- if e := json.Unmarshal([]byte(utils.MgoUrlData), &mgoConfig); e != nil {
- panic("mongodb链接失败,Err:" + e.Error())
- return
- }
- mgoCli := mgodb.MgoNewClient(mgoConfig)
- utils.MgoDataCli = mgoCli
- utils.MgoDataDbName = mgoConfig.Database
- }
- }
|