Documentation
¶
Index ¶
- func ExpressionToBSON(criteria expression.Expression) bson.M
- type Collection
- func (c Collection) Delete(object data.Object, note string) error
- func (c Collection) List(criteria expression.Expression, options ...option.Option) (data.Iterator, error)
- func (c Collection) Load(criteria expression.Expression, target data.Object) error
- func (c Collection) Mongo() *mongo.Collection
- func (c Collection) Save(object data.Object, note string) error
- type Iterator
- type Server
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpressionToBSON ¶ added in v0.2.0
func ExpressionToBSON(criteria expression.Expression) bson.M
ExpressionToBSON converts a data.Expression value into pure bson.
Types ¶
type Collection ¶ added in v0.3.8
type Collection struct {
// contains filtered or unexported fields
}
Collection wraps a mongodb.Collection with all of the methods required by the data.Collection interface
func (Collection) Delete ¶ added in v0.3.8
func (c Collection) Delete(object data.Object, note string) error
Delete removes a single object from the database, using a "virtual delete"
func (Collection) List ¶ added in v0.3.8
func (c Collection) List(criteria expression.Expression, options ...option.Option) (data.Iterator, error)
List retrieves a group of objects from the database
func (Collection) Load ¶ added in v0.3.8
func (c Collection) Load(criteria expression.Expression, target data.Object) error
Load retrieves a single object from the database
func (Collection) Mongo ¶ added in v0.9.2
func (c Collection) Mongo() *mongo.Collection
Mongo returns the underlying mongodb collection for libraries that need to bypass this abstraction.
type Iterator ¶ added in v0.2.5
Iterator wraps the mongodb Cursor object
func NewIterator ¶ added in v0.2.5
NewIterator returns a fully populated Iterator object
type Server ¶ added in v0.3.6
type Server struct {
// contains filtered or unexported fields
}
Server is an abstract representation of a MongoDB database. It implements the data.Server interface, so that it should be usable anywhere that requires a data.Server.
func New ¶
New returns a fully populated mongodb.Server. It requires that you provide the URI for the mongodb cluster, along with the name of the database to be used for all transactions.
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) Collection ¶ added in v0.3.8
func (s Session) Collection(collection string) data.Collection
Collection returns a reference to an individual database collection.