///////////////////////////////////////////////////////////
// THIS FILE IS AUTO GENERATED by gormgen, DON'T EDIT IT //
//        ANY CHANGES DONE HERE WILL BE LOST             //
///////////////////////////////////////////////////////////

package oms_cart_item

import (
	"fmt"
	"time"

	"github.com/pkg/errors"
	"gorm.io/gorm"

	"github.com/ChangSZ/mall-go/internal/repository/mysql"
)

func NewModel() *OmsCartItem {
	return new(OmsCartItem)
}

func NewQueryBuilder() *omsCartItemQueryBuilder {
	return new(omsCartItemQueryBuilder)
}

func (t *OmsCartItem) Create(db *gorm.DB) (id int64, err error) {
	if err = db.Create(t).Error; err != nil {
		return 0, errors.Wrap(err, "create err")
	}
	return t.Id, nil
}

type omsCartItemQueryBuilder struct {
	order []string
	where []struct {
		prefix string
		value  interface{}
	}
	limit  int
	offset int
}

func (qb *omsCartItemQueryBuilder) buildQuery(db *gorm.DB) *gorm.DB {
	ret := db
	for _, where := range qb.where {
		ret = ret.Where(where.prefix, where.value)
	}
	for _, order := range qb.order {
		ret = ret.Order(order)
	}
	if qb.limit != 0 {
		ret = ret.Limit(qb.limit)
	}
	ret = ret.Offset(qb.offset)
	return ret
}

func (qb *omsCartItemQueryBuilder) Updates(db *gorm.DB, m map[string]interface{}) (int64, error) {
	db = db.Model(&OmsCartItem{})

	for _, where := range qb.where {
		db.Where(where.prefix, where.value)
	}

	ret := db.Updates(m)
	err := ret.Error
	if err != nil {
		return 0, errors.Wrap(err, "updates err")
	}
	return ret.RowsAffected, nil
}

func (qb *omsCartItemQueryBuilder) Delete(db *gorm.DB) (int64, error) {
	for _, where := range qb.where {
		db = db.Where(where.prefix, where.value)
	}

	ret := db.Delete(&OmsCartItem{})
	err := ret.Error
	if err != nil {
		return 0, errors.Wrap(err, "delete err")
	}
	return ret.RowsAffected, nil
}

func (qb *omsCartItemQueryBuilder) Count(db *gorm.DB) (int64, error) {
	var c int64
	res := qb.buildQuery(db).Model(&OmsCartItem{}).Count(&c)
	if res.Error != nil && res.Error == gorm.ErrRecordNotFound {
		return 0, nil
	}
	return c, res.Error
}

func (qb *omsCartItemQueryBuilder) First(db *gorm.DB) (*OmsCartItem, error) {
	ret := &OmsCartItem{}
	res := qb.buildQuery(db).First(ret)
	if res.Error != nil && res.Error == gorm.ErrRecordNotFound {
		return nil, nil
	}
	return ret, res.Error
}

func (qb *omsCartItemQueryBuilder) QueryOne(db *gorm.DB) (*OmsCartItem, error) {
	qb.limit = 1
	ret, err := qb.QueryAll(db)
	if len(ret) > 0 {
		return ret[0], err
	}
	return nil, err
}

func (qb *omsCartItemQueryBuilder) QueryAll(db *gorm.DB) ([]*OmsCartItem, error) {
	var ret []*OmsCartItem
	err := qb.buildQuery(db).Find(&ret).Error
	return ret, err
}

func (qb *omsCartItemQueryBuilder) Limit(limit int) *omsCartItemQueryBuilder {
	qb.limit = limit
	return qb
}

func (qb *omsCartItemQueryBuilder) Offset(offset int) *omsCartItemQueryBuilder {
	qb.offset = offset
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereId(p mysql.Predicate, value int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereIdIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereIdNotIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderById(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "id "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductId(p mysql.Predicate, value int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_id", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductIdIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_id", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductIdNotIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductId(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_id "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSkuId(p mysql.Predicate, value int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sku_id", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSkuIdIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sku_id", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSkuIdNotIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sku_id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductSkuId(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_sku_id "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereMemberId(p mysql.Predicate, value int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_id", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereMemberIdIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_id", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereMemberIdNotIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByMemberId(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "member_id "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereQuantity(p mysql.Predicate, value int32) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "quantity", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereQuantityIn(value []int32) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "quantity", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereQuantityNotIn(value []int32) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "quantity", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByQuantity(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "quantity "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WherePrice(p mysql.Predicate, value float64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "price", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WherePriceIn(value []float64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "price", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WherePriceNotIn(value []float64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "price", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByPrice(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "price "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductPic(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_pic", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductPicIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_pic", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductPicNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_pic", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductPic(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_pic "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductName(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_name", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductNameIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_name", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductNameNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_name", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductName(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_name "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSubTitle(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sub_title", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSubTitleIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sub_title", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSubTitleNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sub_title", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductSubTitle(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_sub_title "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSkuCode(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sku_code", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSkuCodeIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sku_code", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSkuCodeNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sku_code", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductSkuCode(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_sku_code "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereMemberNickname(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_nickname", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereMemberNicknameIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_nickname", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereMemberNicknameNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_nickname", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByMemberNickname(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "member_nickname "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereCreateDate(p mysql.Predicate, value time.Time) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "create_date", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereCreateDateIn(value []time.Time) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "create_date", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereCreateDateNotIn(value []time.Time) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "create_date", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByCreateDate(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "create_date "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereModifyDate(p mysql.Predicate, value time.Time) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "modify_date", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereModifyDateIn(value []time.Time) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "modify_date", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereModifyDateNotIn(value []time.Time) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "modify_date", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByModifyDate(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "modify_date "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereDeleteStatus(p mysql.Predicate, value int32) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "delete_status", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereDeleteStatusIn(value []int32) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "delete_status", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereDeleteStatusNotIn(value []int32) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "delete_status", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByDeleteStatus(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "delete_status "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductCategoryId(p mysql.Predicate, value int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_category_id", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductCategoryIdIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_category_id", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductCategoryIdNotIn(value []int64) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_category_id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductCategoryId(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_category_id "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductBrand(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_brand", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductBrandIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_brand", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductBrandNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_brand", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductBrand(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_brand "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSn(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sn", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSnIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sn", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductSnNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_sn", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductSn(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_sn "+order)
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductAttr(p mysql.Predicate, value string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_attr", p),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductAttrIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_attr", "IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) WhereProductAttrNotIn(value []string) *omsCartItemQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "product_attr", "NOT IN"),
		value,
	})
	return qb
}

func (qb *omsCartItemQueryBuilder) OrderByProductAttr(asc bool) *omsCartItemQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "product_attr "+order)
	return qb
}
