7120a729bd
+ DB access is now right and uses copied sessions + DB session is now specifying the safe state and the mode + Fixed the issue with too early ICCC messages regarding to late cache + Add the MIME type for Dart + Fixed the issuse with wrong order of shutdown handlers - TODO: Testing of these changes
27 lines
610 B
Go
27 lines
610 B
Go
package CustomerDB
|
|
|
|
import "labix.org/v2/mgo"
|
|
|
|
/*
|
|
Get the database instance of the MGo Mongo driver.
|
|
*/
|
|
func DB() (session *mgo.Session, database *mgo.Database) {
|
|
session = mainSession.Copy()
|
|
database = session.DB(databaseDB)
|
|
database.Login(databaseUsername, databasePassword)
|
|
|
|
return
|
|
}
|
|
|
|
/*
|
|
Get directly the GridFS instance of the Mgo Mongo driver.
|
|
*/
|
|
func GridFS() (session *mgo.Session, filesystem *mgo.GridFS) {
|
|
session = mainSession.Copy()
|
|
database := session.DB(databaseDB)
|
|
database.Login(databaseUsername, databasePassword)
|
|
filesystem = database.GridFS(`fs`)
|
|
|
|
return
|
|
}
|