mongodb

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpressionToBSON added in v0.2.0

func ExpressionToBSON(c data.Expression) bson.M

ExpressionToBSON converts a data.Expression value into pure bson.

Types

type Datastore

type Datastore struct {
	// contains filtered or unexported fields
}

Datastore is an abstract representation of a MongoDB database. It implements the data.Datastore interface, so that it should be usable anywhere that requires a data.Datastore.

func New

func New(uri string, database string) Datastore

New returns a fully populated mongodb.Datastore. It requires that you provide the URI for the mongodb cluster, along with the name of the database to be used for all transactions.

func (Datastore) Session

func (db Datastore) Session(ctx context.Context) data.Session

Session returns a new client session that can be used to perform CRUD transactions on this datastore.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session represents a single database session, such as a session encompassing all of the database queries to respond to a single REST service call.

func (Session) Close

func (s Session) Close()

Close cleans up any remaining connections that need to be removed.

func (Session) Delete

func (s Session) Delete(collection string, object data.Object, note string) *derp.Error

Delete removes a single object from the database, using a "virtual delete"

func (Session) Load

func (s Session) Load(collection string, criteria data.Expression, target data.Object) *derp.Error

Load retrieves a single object from the database

func (Session) Save

func (s Session) Save(collection string, object data.Object, note string) *derp.Error

Save inserts/updates a single object in the database.

Jump to

Keyboard shortcuts

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