Documentation ¶
Index ¶
- func Delete(collectionName string, selector interface{}) error
- func Exists(collectionName string, query bson.M) bool
- func GetSession() *mgo.Session
- func InitMasterSession()
- func Insert(collectionName string, docs interface{}) error
- func M(collection string, f func(*mgo.Collection) error) error
- func Select(collectionName string, query bson.M, sort string, fields bson.M, skip int, ...) (results []interface{}, err error)
- func SelectAll(collectionName string, query, fields bson.M, results interface{}) error
- func SelectAllWithParam(collectionName string, query bson.M, sort string, fields bson.M, skip int, ...) error
- func SelectById(collectionName string, id interface{}, fields bson.M, results interface{}) error
- func SelectOne(collectionName string, query, fields bson.M, results interface{}) error
- func Test()
- func Update(collectionName string, selector interface{}, update interface{}) error
- func UpdateById(collectionName string, id interface{}, update interface{}) error
- type Account
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitMasterSession ¶
func InitMasterSession()
func Select ¶
func Select(collectionName string, query bson.M, sort string, fields bson.M, skip int, limit int) (results []interface{}, err error)
*
- 执行查询,此方法可拆分做为公共方法
- [Select description]
- @param {[type]} collectionName string [description]
- @param {[type]} query bson.M [description]
- @param {[type]} sort bson.M [description]
- @param {[type]} fields bson.M [description]
- @param {[type]} skip int [description]
- @param {[type]} limit int) (results []interface{}, err error [description]
func SelectAllWithParam ¶
func SelectAllWithParam(collectionName string, query bson.M, sort string, fields bson.M, skip int, limit int, results interface{}) error
查询所有结果 类似Select方法,需要传入比较详细的参数列表,注意:result 必须传递一个slice指针
func SelectById ¶
根据id查询结果 类似Select方法,注意:result 必须传递一个slice指针
func UpdateById ¶
通过Id更新文档
Types ¶
Click to show internal directories.
Click to hide internal directories.