gwmongo

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(url string, dbname string, ac async.AsyncCallback)

Dial connects the a MongoDB returns *MongoDB

Types

type DB

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

MongoDB is a MongoDB instance can be used to manipulate Mongo DBs

func (*DB) Close

func (mdb *DB) Close(ac async.AsyncCallback)

Close closes MongoDB

func (*DB) Count

func (mdb *DB) Count(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ac async.AsyncCallback)

Count counts the number of documents by query

func (*DB) DropCollection

func (mdb *DB) DropCollection(collectionName string, ac async.AsyncCallback)

DropCollection drops c collection

func (*DB) DropDatabase

func (mdb *DB) DropDatabase(ac async.AsyncCallback)

DropDatabase drops the database

func (*DB) DropIndex

func (mdb *DB) DropIndex(collectionName string, keys []string, ac async.AsyncCallback)

DropIndex drops an index by keys

func (*DB) EnsureIndex

func (mdb *DB) EnsureIndex(collectionName string, index mgo.Index, ac async.AsyncCallback)

EnsureIndex creates an index

func (*DB) EnsureIndexKey

func (mdb *DB) EnsureIndexKey(collectionName string, keys []string, ac async.AsyncCallback)

EnsureIndexKey creates an index by keys

func (*DB) FindAll

func (mdb *DB) FindAll(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ac async.AsyncCallback)

FindAll finds all documents with specified query

func (*DB) FindId

func (mdb *DB) FindId(collectionName string, id interface{}, setupQuery func(query *mgo.Query), ac async.AsyncCallback)

FindId finds document in collection by Id

func (*DB) FindOne

func (mdb *DB) FindOne(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ac async.AsyncCallback)

FindOne finds one document with specified query

func (*DB) Insert

func (mdb *DB) Insert(collectionName string, doc bson.M, ac async.AsyncCallback)

Insert inserts a document

func (*DB) InsertMany

func (mdb *DB) InsertMany(collectionName string, docs []bson.M, ac async.AsyncCallback)

InsertMany inserts multiple documents

func (*DB) Remove

func (mdb *DB) Remove(collectionName string, query bson.M, ac async.AsyncCallback)

Remove removes a document by query

func (*DB) RemoveAll

func (mdb *DB) RemoveAll(collectionName string, query bson.M, ac async.AsyncCallback)

Remove removes all documents by query

func (*DB) RemoveId

func (mdb *DB) RemoveId(collectionName string, id interface{}, ac async.AsyncCallback)

RemoveId removes a document by id

func (*DB) SetMode

func (mdb *DB) SetMode(consistency mgo.Mode, ac async.AsyncCallback)

SetMode sets the consistency mode

func (*DB) Update

func (mdb *DB) Update(collectionName string, query bson.M, update bson.M, ac async.AsyncCallback)

Update updates a document by query

func (*DB) UpdateAll

func (mdb *DB) UpdateAll(collectionName string, query bson.M, update bson.M, ac async.AsyncCallback)

UpdateAll updates all documents by query

func (*DB) UpdateId

func (mdb *DB) UpdateId(collectionName string, id interface{}, update bson.M, ac async.AsyncCallback)

UpdateId updates a document by id

func (*DB) Upsert

func (mdb *DB) Upsert(collectionName string, query bson.M, update bson.M, ac async.AsyncCallback)

Upsert updates or inserts a document by query

func (*DB) UpsertId

func (mdb *DB) UpsertId(collectionName string, id interface{}, update bson.M, ac async.AsyncCallback)

UpsertId updates or inserts a document by id

func (*DB) UseDB

func (mdb *DB) UseDB(dbname string, ac async.AsyncCallback)

UseDB uses the specified DB

Jump to

Keyboard shortcuts

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