db

package
v0.0.0-...-b3f521c Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDBProvided = errors.New("invalid DB provided")

ErrInvalidDBProvided is returned in the event that an uninitialized db is used to perform actions against.

Functions

func Query

func Query(value interface{}) string

Query provides a string version of the value

func RegMasterSession

func RegMasterSession(name string, url string, timeout time.Duration) error

RegMasterSession adds a new master session to the set. If no url is provided, it will default to localhost:27017.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB represents our mongo database session.

func New

func New(name string) (*DB, error)

New returns a new DB value for use with MongoDB based on a registered master session.

func (*DB) Close

func (db *DB) Close()

Close closes a DB value being used with MongoDB.

func (*DB) Execute

func (db *DB) Execute(collName string, f func(*mgo.Collection) error) error

Execute is used to execute MongoDB commands.

func (*DB) ExecuteTimeout

func (db *DB) ExecuteTimeout(collName string, f func(*mgo.Collection) error, timeout time.Duration) error

ExecuteTimeout is used to execute MongoDB commands with a timeout.

Jump to

Keyboard shortcuts

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