mongo

package
v0.0.0-...-3295dff Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertObjectIds

func ConvertObjectIds(query map[string]interface{})

func Init

func Init(url string, debugLog *log.Logger) *mgo.Session

Dial up to mongo using the "mongodb-url" from the app.conf First checks for environent variable GOAX_MONGODB_URL

func InitFromConfig

func InitFromConfig(conf *MongoConf, debugLog *log.Logger) *mgo.Session

Dial up to mongo using the "mongodb-url" from the app.conf First checks for environent variable GOAX_MONGODB_URL

func ToBsonMap

func ToBsonMap(fields ...string) (selBson bson.M)

Makes a bson map out of a list of fields

Types

type MongoConf

type MongoConf struct {
	Url            string `config:"url"`
	ConnectTimeout int    `config:"connect-timeout,10"`
	Debug          bool
}

Structure for mongo config section would look like this in the conf file:

mongo {
   url = "mongodb://localhost:27017"
   connect-timeout = 10
   debug = false
}

Directories

Path Synopsis
This package provides a default mongo init.
This package provides a default mongo init.

Jump to

Keyboard shortcuts

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