Add documentation
This commit is contained in:
1 parent
69d0bdabf4
commit
6dab89a1d4
144 files changed
+1107
-549
No files matched your search
@@ -4,25 +4,19 @@ import (
|
||||
"gopkg.in/mgo.v2"
|
||||
)
|
||||
|
||||
/*
|
||||
Get the database instance of the MGo Mongo driver.
|
||||
*/
|
||||
// Get the database instance of the mgo MongoDB 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.
|
||||
*/
|
||||
// Get directly the GridFS instance of the mgo MongoDB 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
|
||||
}
|
||||
+2
-1
@@ -7,10 +7,11 @@ import (
|
||||
"gopkg.in/mgo.v2"
|
||||
)
|
||||
|
||||
// The init function for this package.
|
||||
func init() {
|
||||
|
||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameDATABASE, `Init the customer database.`)
|
||||
|
||||
// Read the configuration values:
|
||||
databaseHost := ConfigurationDB.Read(`CustomerDBHost`)
|
||||
databaseDB = ConfigurationDB.Read(`CustomerDBDatabase`)
|
||||
databaseUsername = ConfigurationDB.Read(`CustomerDBUsername`)
|
||||
|
||||
@@ -5,15 +5,11 @@ import (
|
||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
)
|
||||
|
||||
/*
|
||||
Please do not use this type. It is an internal type of Ocean to provide a shutdown function!
|
||||
*/
|
||||
// The shutdown type.
|
||||
type ShutdownFunction struct {
|
||||
}
|
||||
|
||||
/*
|
||||
This function is called if the Ocean server is shutting down.
|
||||
*/
|
||||
// The shutdown function for this package.
|
||||
func (a ShutdownFunction) Shutdown() {
|
||||
Log.LogShort(senderName, LM.CategoryAPP, LM.LevelWARN, LM.MessageNameSHUTDOWN, `Close now the customer database connection.`)
|
||||
}
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
mainSession *mgo.Session = nil
|
||||
senderName LM.Sender = `System::CustomerDB`
|
||||
databaseUsername string = ``
|
||||
databasePassword string = ``
|
||||
databaseDB string = ``
|
||||
mainSession *mgo.Session = nil // The session for the customer database
|
||||
senderName LM.Sender = `System::CustomerDB` // This is the name for logging event from this package
|
||||
databaseUsername string = `` // The user's name
|
||||
databasePassword string = `` // The user's password
|
||||
databaseDB string = `` // The database
|
||||
)
|
||||
Reference in new issue
Block a user