本文整理汇总了Golang中labix/org/v2/mgo/bson.ObjectId.Valid方法的典型用法代码示例。如果您正苦于以下问题:Golang ObjectId.Valid方法的具体用法?Golang ObjectId.Valid怎么用?Golang ObjectId.Valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类labix/org/v2/mgo/bson.ObjectId
的用法示例。
在下文中一共展示了ObjectId.Valid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CountFollowingBrandByUserId
func CountFollowingBrandByUserId(userId bson.ObjectId) (num int, err error) {
if !userId.Valid() {
err = global.InvalidIdError
return
}
return CountFollowBrand(bson.M{"userid": userId})
}
示例2: FindById
func FindById(id bson.ObjectId) (product *Product, err error) {
if !id.Valid() {
err = global.InvalidIdError
return
}
return FindOne(bson.M{"_id": id})
}
示例3: FindById
func FindById(id bson.ObjectId) (review *Review, err error) {
if !id.Valid() {
err = global.InvalidIdError
return
}
return FindOne(bson.M{"_id": id})
}
示例4: UpdateByPk
func (a *AbstractModel) UpdateByPk(id bson.ObjectId, update interface{}) error {
if !id.Valid() {
return errors.New("20314")
}
return a.Update(M{"_id": id}, update, true)
}
示例5: FindSomeByUserId
func FindSomeByUserId(userId bson.ObjectId) (r []*Note, err error) {
if !userId.Valid() {
err = global.InvalidIdError
return
}
return FindAll(bson.M{"authorid": userId})
}
示例6: CountBrandFollowerByBrandId
func CountBrandFollowerByBrandId(brandId bson.ObjectId) (num int, err error) {
if !brandId.Valid() {
err = global.InvalidIdError
return
}
return CountFollowBrand(bson.M{"brandid": brandId})
}
示例7: CountReviewByProductId
func CountReviewByProductId(productId bson.ObjectId) (num int, err error) {
if !productId.Valid() {
err = global.InvalidIdError
return
}
return CountReview(bson.M{"productid": productId})
}
示例8: CountReviewByBrandId
func CountReviewByBrandId(brandId bson.ObjectId) (num int, err error) {
if !brandId.Valid() {
err = global.InvalidIdError
return
}
return CountReview(bson.M{"brandid": brandId})
}
示例9: FindByUserAndBrandId
func FindByUserAndBrandId(userId, brandId bson.ObjectId) (followBrand *FollowBrand, err error) {
if !userId.Valid() || !brandId.Valid() {
err = global.InvalidIdError
return
}
return FindOne(bson.M{"userid": userId, "brandid": brandId})
}
示例10: FindByUserId
func FindByUserId(userId bson.ObjectId) (r []*FollowBrand, err error) {
if !userId.Valid() {
err = global.InvalidIdError
return
}
return FindAll(bson.M{"userid": userId})
}
示例11: FindByBrandId
func FindByBrandId(brandId bson.ObjectId) (r []*FollowBrand, err error) {
if !brandId.Valid() {
err = global.InvalidIdError
return
}
return FindAll(bson.M{"brandid": brandId})
}
示例12: FindSomeByAuthorId
func FindSomeByAuthorId(authorId bson.ObjectId) (r []*Post, err error) {
if !authorId.Valid() {
err = global.InvalidIdError
return
}
return FindAll(bson.M{"authorid": authorId})
}
示例13: DeleteByUserAndBrandId
func DeleteByUserAndBrandId(userId, brandId bson.ObjectId) (err error) {
if !userId.Valid() || !brandId.Valid() {
err = global.InvalidIdError
return
}
return DeleteFollowBrand(bson.M{"userid": userId, "brandid": brandId})
}
示例14: FindSomeByBrandId
func FindSomeByBrandId(brandId bson.ObjectId) (rs []*Review, err error) {
if !brandId.Valid() {
err = global.InvalidIdError
return
}
return FindAll(bson.M{"brandid": brandId})
}
示例15: FindSomeByProductId
func FindSomeByProductId(productId bson.ObjectId) (rs []*Review, err error) {
if !productId.Valid() {
err = global.InvalidIdError
return
}
return FindAll(bson.M{"productid": productId})
}