db

package
v0.0.0-...-b3bf091 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 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

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

func NewMGO(url string, timeout time.Duration) (*DB, error)

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

func (*DB) MGOClose

func (db *DB) MGOClose()

MGOClose closes a DB value being used with MongoDB.

func (*DB) MGOCopy

func (db *DB) MGOCopy() (*DB, error)

MGOCopy returns a new DB value for use with MongoDB based the master session.

func (*DB) MGOExecute

func (db *DB) MGOExecute(ctx context.Context, collName string, f func(*mgo.Collection) error) error

MGOExecute is used to execute MongoDB commands.

func (*DB) MGOExecuteTimeout

func (db *DB) MGOExecuteTimeout(ctx context.Context, collName string, f func(*mgo.Collection) error, timeout time.Duration) error

MGOExecuteTimeout 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