本文整理匯總了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})
}