mongodb

package
v0.0.0-...-13dad8c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL