mongodb

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	User       string         `envconfig:"MONGODB_USER"`
	Pw         string         `envconfig:"MONGODB_PW"`
	Hosts      string         `envconfig:"MONGODB_HOSTS"`
	MasterHost string         `envconfig:"MONGODB_MASTER_HOST_NAME"`
	AuthDB     string         `envconfig:"MONGODB_AUTH_DB_NAME"`
	DB         string         `envconfig:"MONGODB_DB_NAME"`
	Mode       string         `envconfig:"MONGODB_MODE"`
	Tags       []bson.DocElem `envconfig:"MONGODB_TAGS"`
}

Config holds the information required for connecting to a MongoDB replicaset.

func LoadConfigFromEnv

func LoadConfigFromEnv() *Config

LoadConfigFromEnv will attempt to load a MongoCreds object from environment variables.

func (*Config) Must

func (m *Config) Must() *mgo.Session

Must will attempt to initiate a new mgo.Session with the replicaset and will panic if it encounters any issues.

func (*Config) MustMaster

func (m *Config) MustMaster() *mgo.Session

MustMaster will attempt to initiate a new mgo.Session with the Master host and will panic if it encounters any issues.

Jump to

Keyboard shortcuts

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