123456789101112131415161718192021 |
- package mgodb
- import (
- "encoding/json"
- "eta/eta_forum_hub/utils"
- "eta/eta_forum_hub/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.NewMgoClient(mgoConfig)
- utils.MgoDataCli = mgoCli
- utils.MgoDataDbName = mgoConfig.Database
- }
- }
|