Documentation
¶
Overview ¶
Package db abstracts different database systems we can use.
Index ¶
- func RegMasterSession(context interface{}, name string, cfg mongo.Config) error
- type DB
- func (db *DB) BatchedQueryMGO(context interface{}, colName string, q bson.M) (*mgo.Iter, error)
- func (db *DB) BulkOperationMGO(context interface{}, colName string) (*mgo.Bulk, error)
- func (db *DB) CloseMGO(context interface{})
- func (db *DB) CollectionMGO(context interface{}, colName string) (*mgo.Collection, error)
- func (db *DB) CollectionMGOTimeout(context interface{}, timeout time.Duration, colName string) (*mgo.Collection, error)
- func (db *DB) ExecuteMGO(context interface{}, colName string, f func(*mgo.Collection) error) error
- func (db *DB) ExecuteMGOTimeout(context interface{}, timeout time.Duration, colName string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a collection of support for different DB technologies. Currently only MongoDB has been implemented. We want to be able to access the raw database support for the given DB so an interface does not work. Each database is too different.
func NewMGO ¶
NewMGO returns a new DB value for use with MongoDB based on a registered master session.
func (*DB) BatchedQueryMGO ¶
BatchedQueryMGO returns an iterator capable of iterating over all the results of a query in batches.
func (*DB) BulkOperationMGO ¶
BulkOperationMGO returns a bulk value that allows multiple orthogonal changes to be delivered to the server.
func (*DB) CloseMGO ¶
func (db *DB) CloseMGO(context interface{})
CloseMGO closes a DB value being used with MongoDB.
func (*DB) CollectionMGO ¶
func (db *DB) CollectionMGO(context interface{}, colName string) (*mgo.Collection, error)
CollectionMGO is used to get a collection value.
func (*DB) CollectionMGOTimeout ¶
func (db *DB) CollectionMGOTimeout(context interface{}, timeout time.Duration, colName string) (*mgo.Collection, error)
CollectionMGOTimeout is used to get a collection value with a timeout.
func (*DB) ExecuteMGO ¶
ExecuteMGO is used to execute MongoDB commands.
func (*DB) ExecuteMGOTimeout ¶
func (db *DB) ExecuteMGOTimeout(context interface{}, timeout time.Duration, colName string, f func(*mgo.Collection) error) error
ExecuteMGOTimeout is used to execute MongoDB commands with a timeout.