mongo

package module
v0.0.0-...-7896f14 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 5 Imported by: 0

README

mongo

Mongo DB wrapper without context

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type D

type D = bson.D

D for bson.D object

type DB

type DB struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DB for database

func GetDb

func GetDb() *DB

func NewConnection

func NewConnection(dsn string) (*DB, error)

func NewConnectionWithTimeout

func NewConnectionWithTimeout(dsn string, timeout time.Duration) (*DB, error)

func (*DB) Connect

func (db *DB) Connect(dsn string) error

func (*DB) ConnectWithTimeout

func (db *DB) ConnectWithTimeout(dsn string, timeout time.Duration) error

func (*DB) Count

func (db *DB) Count(coll string, query interface{}) (int, error)

func (*DB) CreateIndexKey

func (db *DB) CreateIndexKey(coll string, key ...string) error

func (*DB) CreateIndexKeys

func (db *DB) CreateIndexKeys(coll string, keys ...string) error

func (*DB) Disconnect

func (db *DB) Disconnect()

func (*DB) Find

func (db *DB) Find(coll string, query map[string]interface{}, v interface{}) error

func (*DB) FindAll

func (db *DB) FindAll(coll string, v interface{}) error

func (*DB) FindByID

func (db *DB) FindByID(coll string, id string, v interface{}) bool

func (*DB) FindWithQuery

func (db *DB) FindWithQuery(coll string, query interface{}, v interface{}) error

func (*DB) FindWithQueryAll

func (db *DB) FindWithQueryAll(coll string, query interface{}, v interface{}) error

func (*DB) FindWithQueryOne

func (db *DB) FindWithQueryOne(coll string, query interface{}, v interface{}) error

func (*DB) FindWithQuerySortAll

func (db *DB) FindWithQuerySortAll(coll string, query interface{},
	order string, v interface{}) error

func (*DB) FindWithQuerySortLimitAll

func (db *DB) FindWithQuerySortLimitAll(coll string, query interface{},
	order string, limit int, v interface{}) error

func (*DB) FindWithQuerySortLimitOffsetAll

func (db *DB) FindWithQuerySortLimitOffsetAll(coll string, query interface{}, sort string,
	limit int, offset int, v interface{}) error

func (*DB) FindWithQuerySortLimitOffsetTotalAll

func (db *DB) FindWithQuerySortLimitOffsetTotalAll(coll string, query interface{},
	sort string, limit int, offset int, v interface{}, total *int) error

func (*DB) FindWithQuerySortOne

func (db *DB) FindWithQuerySortOne(coll string, query interface{},
	order string, v interface{}) error

func (*DB) Insert

func (db *DB) Insert(coll string, v ...interface{}) error

func (*DB) InsertBulk

func (db *DB) InsertBulk(coll string, v ...interface{}) error

func (*DB) InsertSess

func (db *DB) InsertSess(coll string, sess *mgo.Session,
	v ...interface{}) error

func (*DB) IsConnected

func (db *DB) IsConnected() bool

func (*DB) Pipe

func (db *DB) Pipe(coll string, query []bson.M, v interface{}) error

func (*DB) PipeOne

func (db *DB) PipeOne(coll string, query []bson.M, v interface{}) error

func (*DB) Remove

func (db *DB) Remove(coll string, id interface{}) error

func (*DB) RemoveAll

func (db *DB) RemoveAll(coll string) error

func (*DB) RemoveWithIDs

func (db *DB) RemoveWithIDs(coll string, ids interface{}) error

func (*DB) RemoveWithQuery

func (db *DB) RemoveWithQuery(coll string, query interface{}) error

func (*DB) SessClose

func (db *DB) SessClose(sess *mgo.Session)

func (*DB) SessCopy

func (db *DB) SessCopy() *mgo.Session

func (*DB) SessExec

func (db *DB) SessExec(cb func(*mgo.Session))

func (*DB) SetMaxTimeMS

func (db *DB) SetMaxTimeMS(d time.Duration)

func (*DB) Update

func (db *DB) Update(coll string, id interface{}, v interface{}) error

func (*DB) UpdateWithQuery

func (db *DB) UpdateWithQuery(coll string, query interface{}, set interface{}) error

func (*DB) UpdateWithQueryAll

func (db *DB) UpdateWithQueryAll(coll string, query interface{}, set interface{}) error

func (*DB) Upsert

func (db *DB) Upsert(coll string, id interface{}, v interface{}) error

func (*DB) UpsertMulti

func (db *DB) UpsertMulti(coll string, id []interface{}, v []interface{}) error

func (*DB) UpsertWithQuery

func (db *DB) UpsertWithQuery(coll string, query interface{}, set interface{}) error

type M

type M = bson.M

M for bson.M object

Jump to

Keyboard shortcuts

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