Documentation
¶
Index ¶
- type Config
- type Mdb
- func (self *Mdb) All(collection string, query interface{}, result interface{}) error
- func (self *Mdb) AllSelect(collection string, query interface{}, projection interface{}, ...) error
- func (self *Mdb) Count(collection string, query interface{}) (n int)
- func (self *Mdb) CountId(collection string, id interface{}) (n int)
- func (self *Mdb) DB(s *mgo.Session) *mgo.Database
- func (self *Mdb) Exist(collection string, query interface{}) bool
- func (self *Mdb) ExistId(collection string, id interface{}) bool
- func (self *Mdb) FindId(collection string, id interface{}, result interface{}) error
- func (self *Mdb) Insert(collection string, data ...interface{}) error
- func (self *Mdb) One(collection string, query interface{}, result interface{}) error
- func (self *Mdb) OneSelect(collection string, query interface{}, projection interface{}, ...) error
- func (self *Mdb) Page(collection string, query bson.M, offset int, limit int, result interface{}) error
- func (self *Mdb) PageAndCount(collection string, query bson.M, offset int, limit int, result interface{}) (total int, err error)
- func (self *Mdb) Remove(collection string, selector interface{}) error
- func (self *Mdb) RemoveAll(collection string, selector interface{}) error
- func (self *Mdb) RemoveId(collection string, id interface{}) error
- func (self *Mdb) Session() *mgo.Session
- func (self *Mdb) SetId(collection string, id interface{}, change interface{}) error
- func (self *Mdb) Update(collection string, selector, change interface{}) error
- func (self *Mdb) UpdateAll(collection string, selector, change interface{}) error
- func (self *Mdb) UpdateId(collection string, id interface{}, change interface{}) error
- func (self *Mdb) Upsert(collection string, selector interface{}, change interface{}) error
- func (self *Mdb) WithC(collection string, job func(*mgo.Collection) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mdb ¶
type Mdb struct {
*Config
// contains filtered or unexported fields
}
mongo的辅助类
func NewMdbWithConf ¶
func NewMdbWithHost ¶
func (*Mdb) AllSelect ¶
func (self *Mdb) AllSelect(collection string, query interface{}, projection interface{}, result interface{}) error
返回所有复合 query 条件的item, 并且被 projection 限制返回的fields
func (*Mdb) PageAndCount ¶
func (self *Mdb) PageAndCount(collection string, query bson.M, offset int, limit int, result interface{}) (total int, err error)
获取页面数据和“所有”符合条件的记录“总共”的条数
Click to show internal directories.
Click to hide internal directories.