Documentation ¶
Index ¶
- func Session(config db.DataSource) db.Database
- type MongoDataSource
- func (m *MongoDataSource) Close() error
- func (m *MongoDataSource) Collection(name string) db.Collection
- func (m *MongoDataSource) Collections() []string
- func (m *MongoDataSource) Driver() interface{}
- func (m *MongoDataSource) Drop() error
- func (m *MongoDataSource) Open() error
- func (m *MongoDataSource) Use(database string) error
- type MongoDataSourceCollection
- func (c *MongoDataSourceCollection) Append(items ...interface{}) bool
- func (c *MongoDataSourceCollection) BuildQuery(terms ...interface{}) *mgo.Query
- func (c *MongoDataSourceCollection) Count(terms ...interface{}) int
- func (c *MongoDataSourceCollection) Find(terms ...interface{}) db.Item
- func (c *MongoDataSourceCollection) FindAll(terms ...interface{}) []db.Item
- func (c *MongoDataSourceCollection) Remove(terms ...interface{}) bool
- func (c *MongoDataSourceCollection) Truncate() bool
- func (c *MongoDataSourceCollection) Update(terms ...interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MongoDataSource ¶
type MongoDataSource struct {
// contains filtered or unexported fields
}
MongoDataSource session.
func (*MongoDataSource) Close ¶
func (m *MongoDataSource) Close() error
Entirely drops the active database.
func (*MongoDataSource) Collection ¶
func (m *MongoDataSource) Collection(name string) db.Collection
Returns a Collection from the currently active database given the name. See Session().
func (*MongoDataSource) Collections ¶
func (m *MongoDataSource) Collections() []string
Returns all the collection names in the active database.
func (*MongoDataSource) Driver ¶
func (m *MongoDataSource) Driver() interface{}
func (*MongoDataSource) Drop ¶
func (m *MongoDataSource) Drop() error
Entirely drops the active database.
func (*MongoDataSource) Open ¶
func (m *MongoDataSource) Open() error
Connects to the previously specified datasource. See Session().
func (*MongoDataSource) Use ¶
func (m *MongoDataSource) Use(database string) error
Switches the current session database to the provided name. See Session().
type MongoDataSourceCollection ¶
type MongoDataSourceCollection struct {
// contains filtered or unexported fields
}
MongoDataSource collection.
func (*MongoDataSourceCollection) Append ¶
func (c *MongoDataSourceCollection) Append(items ...interface{}) bool
Inserts items into the collection.
func (*MongoDataSourceCollection) BuildQuery ¶
func (c *MongoDataSourceCollection) BuildQuery(terms ...interface{}) *mgo.Query
Returns a mgo.Query that matches the provided terms.
func (*MongoDataSourceCollection) Count ¶
func (c *MongoDataSourceCollection) Count(terms ...interface{}) int
Returns the number of total items matching the provided conditions.
func (*MongoDataSourceCollection) Find ¶
func (c *MongoDataSourceCollection) Find(terms ...interface{}) db.Item
Returns a document that matches all the provided conditions. db.Ordering of the terms doesn't matter but you must take in account that conditions are generally evaluated from left to right (or from top to bottom).
func (*MongoDataSourceCollection) FindAll ¶
func (c *MongoDataSourceCollection) FindAll(terms ...interface{}) []db.Item
Returns all the results that match the provided conditions. See Find().
func (*MongoDataSourceCollection) Remove ¶
func (c *MongoDataSourceCollection) Remove(terms ...interface{}) bool
Removes all the items that match the provided conditions.
func (*MongoDataSourceCollection) Truncate ¶
func (c *MongoDataSourceCollection) Truncate() bool
Deletes the whole collection.
func (*MongoDataSourceCollection) Update ¶
func (c *MongoDataSourceCollection) Update(terms ...interface{}) bool
Updates all the items that match the provided conditions. You can specify the modification type by using db.Set, db.Modify or db.Upsert.