db

package
v0.0.0-...-e7a724a Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 6 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
}

func New

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

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

func (*DB) Close

func (db *DB) Close()

Close closes a DB value being used with MongoDB.

func (*DB) Copy

func (db *DB) Copy() *DB

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

func (*DB) Execute

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

Execute is used to execute MongoDB commands.

func (*DB) ExecuteTimeout

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

ExecuteTimeout is used to execute MongoDB commands with a timeout.

func (*DB) StatusCheck

func (db *DB) StatusCheck(ctx context.Context) error

StatusCheck validates the DB status good.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL