Documentation
¶
Index ¶
- func All(db *mgo.Database, collection string, query interface{}, result interface{}) error
- func AllSelect(db *mgo.Database, collection string, query interface{}, projection interface{}, ...) error
- func Count(db *mgo.Database, collection string, query interface{}) (n int)
- func CountId(db *mgo.Database, collection string, id interface{}) (n int)
- func Exec(db *mgo.Database, callback func(*mgo.Database) error) error
- func Exist(db *mgo.Database, collection string, query interface{}) bool
- func ExistId(db *mgo.Database, collection string, id interface{}) bool
- func FindId(db *mgo.Database, collection string, id interface{}, result interface{}) error
- func Insert(db *mgo.Database, collection string, data ...interface{}) error
- func NewMdb(host, port, database, userName, password string) (*mgo.Database, error)
- func NewMdbWithURL(url string) (*mgo.Database, error)
- func One(db *mgo.Database, collection string, query interface{}, result interface{}) error
- func OneSelect(db *mgo.Database, collection string, query interface{}, projection interface{}, ...) error
- func Page(db *mgo.Database, collection string, query bson.M, offset int, limit int, ...) error
- func PageAndCount(db *mgo.Database, collection string, query bson.M, offset int, limit int, ...) (total int, err error)
- func Remove(db *mgo.Database, collection string, selector interface{}) error
- func RemoveAll(db *mgo.Database, collection string, selector interface{}) error
- func RemoveId(db *mgo.Database, collection string, id interface{}) error
- func SetId(db *mgo.Database, collection string, id interface{}, change interface{}) error
- func Update(db *mgo.Database, collection string, selector, change interface{}) error
- func UpdateAll(db *mgo.Database, collection string, selector, change interface{}) error
- func UpdateId(db *mgo.Database, collection string, id interface{}, change interface{}) error
- func Upsert(db *mgo.Database, collection string, selector interface{}, change interface{}) error
- func WithC(db *mgo.Database, collection string, job func(*mgo.Collection) error) error
- type Config
- type MgoIndexs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllSelect ¶
func AllSelect(db *mgo.Database, collection string, query interface{}, projection interface{}, result interface{}) error
返回所有复合 query 条件的item, 并且被 projection 限制返回的fields
func NewMdbWithURL ¶
func PageAndCount ¶
func PageAndCount(db *mgo.Database, collection string, query bson.M, offset int, limit int, result interface{}) (total int, err error)
获取页面数据和“所有”符合条件的记录“总共”的条数
Types ¶
Click to show internal directories.
Click to hide internal directories.