Documentation ¶
Index ¶
- func Count(collection *mgo.Collection, q interface{}) int
- func Delete(collection *mgo.Collection, q interface{}) bool
- func DeleteAll(collection *mgo.Collection, q interface{}) bool
- func DeleteAllByIdAndUserId(collection *mgo.Collection, id, userId string) bool
- func DeleteAllByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId) bool
- func DeleteByIdAndUserId(collection *mgo.Collection, id, userId string) bool
- func DeleteByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId) bool
- func Distinct(collection *mgo.Collection, q bson.M, field string, i interface{})
- func Err(err error) bool
- func Get(collection *mgo.Collection, id string, i interface{})
- func Get2(collection *mgo.Collection, id bson.ObjectId, i interface{})
- func GetByIdAndUserId(collection *mgo.Collection, id, userId string, i interface{})
- func GetByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId, i interface{})
- func GetByQ(collection *mgo.Collection, q interface{}, i interface{})
- func GetByQWithFields(collection *mgo.Collection, q bson.M, fields []string, i interface{})
- func GetIdAndUserIdBsonQ(id, userId bson.ObjectId) bson.M
- func GetIdAndUserIdQ(id, userId string) bson.M
- func Has(collection *mgo.Collection, q interface{}) bool
- func Insert(collection *mgo.Collection, i interface{}) bool
- func ListByQ(collection *mgo.Collection, q interface{}, i interface{})
- func ListByQLimit(collection *mgo.Collection, q interface{}, i interface{}, limit int)
- func ListByQWithFields(collection *mgo.Collection, q bson.M, fields []string, i interface{})
- func Update(collection *mgo.Collection, query interface{}, i interface{}) bool
- func UpdateAll(collection *mgo.Collection, query interface{}, i interface{}) bool
- func UpdateByIdAndUserId(collection *mgo.Collection, id, userId string, i interface{}) bool
- func UpdateByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId, i interface{}) bool
- func UpdateByIdAndUserIdField(collection *mgo.Collection, id, userId, field string, value interface{}) bool
- func UpdateByIdAndUserIdField2(collection *mgo.Collection, id, userId bson.ObjectId, field string, ...) bool
- func UpdateByIdAndUserIdMap(collection *mgo.Collection, id, userId string, v bson.M) bool
- func UpdateByIdAndUserIdMap2(collection *mgo.Collection, id, userId bson.ObjectId, v bson.M) bool
- func UpdateByQField(collection *mgo.Collection, q interface{}, field string, value interface{}) bool
- func UpdateByQI(collection *mgo.Collection, q interface{}, v interface{}) bool
- func UpdateByQMap(collection *mgo.Collection, q interface{}, v interface{}) bool
- func Upsert(collection *mgo.Collection, query interface{}, i interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
func Count(collection *mgo.Collection, q interface{}) int
func DeleteAll ¶
func DeleteAll(collection *mgo.Collection, q interface{}) bool
func DeleteAllByIdAndUserId ¶
func DeleteAllByIdAndUserId(collection *mgo.Collection, id, userId string) bool
删除所有
func DeleteAllByIdAndUserId2 ¶
func DeleteAllByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId) bool
func DeleteByIdAndUserId ¶
func DeleteByIdAndUserId(collection *mgo.Collection, id, userId string) bool
func DeleteByIdAndUserId2 ¶
func DeleteByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId) bool
func Distinct ¶
func Distinct(collection *mgo.Collection, q bson.M, field string, i interface{})
按field去重
func Get ¶
func Get(collection *mgo.Collection, id string, i interface{})
func GetByIdAndUserId ¶
func GetByIdAndUserId(collection *mgo.Collection, id, userId string, i interface{})
func GetByIdAndUserId2 ¶
func GetByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId, i interface{})
func GetByQ ¶
func GetByQ(collection *mgo.Collection, q interface{}, i interface{})
func GetByQWithFields ¶
func GetByQWithFields(collection *mgo.Collection, q bson.M, fields []string, i interface{})
查询某些字段, q是查询条件, fields是字段名列表
func Has ¶
func Has(collection *mgo.Collection, q interface{}) bool
func Insert ¶
func Insert(collection *mgo.Collection, i interface{}) bool
func ListByQ ¶
func ListByQ(collection *mgo.Collection, q interface{}, i interface{})
func ListByQLimit ¶
func ListByQLimit(collection *mgo.Collection, q interface{}, i interface{}, limit int)
func ListByQWithFields ¶
func ListByQWithFields(collection *mgo.Collection, q bson.M, fields []string, i interface{})
查询某些字段, q是查询条件, fields是字段名列表
func Update ¶
func Update(collection *mgo.Collection, query interface{}, i interface{}) bool
适合一条记录全部更新
func UpdateAll ¶
func UpdateAll(collection *mgo.Collection, query interface{}, i interface{}) bool
func UpdateByIdAndUserId ¶
func UpdateByIdAndUserId(collection *mgo.Collection, id, userId string, i interface{}) bool
func UpdateByIdAndUserId2 ¶
func UpdateByIdAndUserId2(collection *mgo.Collection, id, userId bson.ObjectId, i interface{}) bool
func UpdateByIdAndUserIdField ¶
func UpdateByIdAndUserIdField(collection *mgo.Collection, id, userId, field string, value interface{}) bool
func UpdateByIdAndUserIdMap ¶
func UpdateByIdAndUserIdMap2 ¶
func UpdateByQField ¶
func UpdateByQField(collection *mgo.Collection, q interface{}, field string, value interface{}) bool
func UpdateByQI ¶
func UpdateByQI(collection *mgo.Collection, q interface{}, v interface{}) bool
func UpdateByQMap ¶
func UpdateByQMap(collection *mgo.Collection, q interface{}, v interface{}) bool
查询条件和值
func Upsert ¶
func Upsert(collection *mgo.Collection, query interface{}, i interface{}) bool
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.