Documentation ¶
Overview ¶
Package mongo provides mongo connectivity support.
Index ¶
- Constants
- func CloneMasterSession(sessionID string) (*mgo.Session, error)
- func CloneMonotonicSession(sessionID string) (*mgo.Session, error)
- func CloneSession(sessionID string, useSession string) (*mgo.Session, error)
- func CloseSession(sessionID string, mongoSession *mgo.Session)
- func CollectionExists(sessionID string, mongoSession *mgo.Session, useDatabase string, ...) bool
- func CopyMasterSession(sessionID string) (*mgo.Session, error)
- func CopyMonotonicSession(sessionID string) (*mgo.Session, error)
- func CopySession(sessionID string, useSession string) (*mgo.Session, error)
- func CreateSession(sessionID string, mode string, sessionName string, hosts []string, ...) error
- func Execute(sessionID string, mongoSession *mgo.Session, databaseName string, ...) error
- func GetCollection(mongoSession *mgo.Session, useDatabase string, useCollection string) *mgo.Collection
- func GetDatabase(mongoSession *mgo.Session, useDatabase string) *mgo.Database
- func Shutdown(sessionID string) error
- func Startup(sessionID string) error
- func ToString(queryMap interface{}) string
- func ToStringD(queryMap bson.D) string
- type DBCall
Constants ¶
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 ¶
CloneMasterSession makes a clone of the master session for client use.
func CloneMonotonicSession ¶
CloneMonotonicSession makes a clone of the monotinic session for client use.
func CloneSession ¶
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 ¶
CopyMasterSession makes a copy of the master session for client use.
func CopyMonotonicSession ¶
CopyMonotonicSession makes a copy of the monotonic session for client use.
func CopySession ¶
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.