mongo

package
Version: v0.0.0-...-a78190c Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2014 License: BSD-2-Clause-Views Imports: 8 Imported by: 88

Documentation

Overview

Package mongo provides mongo connectivity support.

Index

Constants

View Source
const (
	// MasterSession provides direct access to master database.
	MasterSession = "master"

	// MonotonicSession provides reads to slaves.
	MonotonicSession = "monotonic"
)

Variables

This section is empty.

Functions

func CloneMasterSession

func CloneMasterSession(sessionID string) (*mgo.Session, error)

CloneMasterSession makes a clone of the master session for client use.

func CloneMonotonicSession

func CloneMonotonicSession(sessionID string) (*mgo.Session, error)

CloneMonotonicSession makes a clone of the monotinic session for client use.

func CloneSession

func CloneSession(sessionID string, useSession string) (*mgo.Session, error)

CloneSession makes a clone of the specified session for client use.

func CloseSession

func CloseSession(sessionID string, mongoSession *mgo.Session)

CloseSession puts the connection back into the pool.

func CollectionExists

func CollectionExists(sessionID string, mongoSession *mgo.Session, useDatabase string, useCollection string) bool

CollectionExists returns true if the collection name exists in the specified database.

func CopyMasterSession

func CopyMasterSession(sessionID string) (*mgo.Session, error)

CopyMasterSession makes a copy of the master session for client use.

func CopyMonotonicSession

func CopyMonotonicSession(sessionID string) (*mgo.Session, error)

CopyMonotonicSession makes a copy of the monotonic session for client use.

func CopySession

func CopySession(sessionID string, useSession string) (*mgo.Session, error)

CopySession makes a copy of the specified session for client use.

func CreateSession

func CreateSession(sessionID string, mode string, sessionName string, hosts []string, databaseName string, username string, password string) error

CreateSession creates a connection pool for use.

func Execute

func Execute(sessionID string, mongoSession *mgo.Session, databaseName string, collectionName string, dbCall DBCall) error

Execute the MongoDB literal function.

func GetCollection

func GetCollection(mongoSession *mgo.Session, useDatabase string, useCollection string) *mgo.Collection

GetCollection returns a reference to a collection for the specified database and collection name.

func GetDatabase

func GetDatabase(mongoSession *mgo.Session, useDatabase string) *mgo.Database

GetDatabase returns a reference to the specified database.

func Shutdown

func Shutdown(sessionID string) error

Shutdown systematically brings the manager down gracefully.

func Startup

func Startup(sessionID string) error

Startup brings the manager to a running state.

func ToString

func ToString(queryMap interface{}) string

ToString converts the quer map to a string.

func ToStringD

func ToStringD(queryMap bson.D) string

ToStringD converts bson.D to a string.

Types

type DBCall

type DBCall func(*mgo.Collection) error

DBCall defines a type of function that can be used to excecute code against MongoDB.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL