Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Settings *mongoDBSettings
Settings holds all pertient connection parameters for MongoDB
Functions ¶
func LoadConfig ¶
func LoadConfig()
LoadConfig (re)loads the influxDB config so a connection can be initialized
Types ¶
type CollectionManager ¶
type CollectionManager interface { GetCollection() *mgo.Collection Close() }
CollectionManager provides utility interface methods for managing collections in a mongo database
type ResourceManager ¶
type ResourceManager struct { Session *mgo.Session DB *mgo.Database CollectionName string }
ResourceManager provides concrete implementation of methods for interacting with mongo databases
func NewResourceManager ¶
func NewResourceManager(collectionName string) (*ResourceManager, error)
NewResourceManager constructs a manager object for one of the Collections in the mongo DB. Management of the collection is delegated to the given CollectionManager
func (*ResourceManager) Close ¶
func (r *ResourceManager) Close()
Close should be called before the ResourceManager is garbage collected The underlying resources will be released cleanly by closing the session and logging out of the database
func (*ResourceManager) GetCollection ¶
func (r *ResourceManager) GetCollection() *mgo.Collection
GetCollection returns the collection being operated on by this manager