Documentation ¶
Overview ¶
Package db abstracts different database systems we can use.
Index ¶
- Variables
- func RegMasterSession(context interface{}, name string, url string, timeout time.Duration) 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) CloseCayley(context interface{})
- 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
- func (db *DB) GraphHandle(context interface{}) (*cayley.Handle, error)
- func (db *DB) NewCayley(context interface{}, name string) error
Constants ¶
This section is empty.
Variables ¶
var ErrGraphHandle = errors.New("Graph handle not initialized.")
ErrGraphHandle is returned when a graph handle is not initialized.
var ErrInvalidDBProvided = errors.New("Invalid DB provided")
ErrInvalidDBProvided is returned in the event that an uninitialized db is used to perform actions against.
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) CloseCayley ¶
func (db *DB) CloseCayley(context interface{})
CloseCayley closes a graph handle value.
func (*DB) CloseMGO ¶
func (db *DB) CloseMGO(context interface{})
CloseMGO closes a DB value being used with MongoDB.
func (*DB) CollectionMGO ¶
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.
func (*DB) GraphHandle ¶
GraphHandle returns the Cayley graph handle for graph interactions.