first commit
way too late.
This commit is contained in:
commit
d4f7dc57fc
53 files changed
+3518
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package mongoconnector
|
||||
|
||||
//var mongoClient int
|
||||
|
||||
import (
|
||||
"github.com/didiercrunch/doormanserver/shared"
|
||||
mgo "gopkg.in/mgo.v2"
|
||||
)
|
||||
|
||||
var mongoClient *mgo.Session
|
||||
var DB *mgo.Database
|
||||
|
||||
func initMongo() error {
|
||||
if mongoClient != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
mongoClient, err = mgo.Dial(shared.GetParams().Mongo.Url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
DB = mongoClient.DB(shared.GetParams().Mongo.DatabaseName)
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user