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

package v2_user

import (
	"fmt"

	"v2board-telegram-bot/repository/mysql"

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

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

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

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

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

func (qb *v2UserQueryBuilder) 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).Offset(qb.offset)
	}

	return ret
}

func (qb *v2UserQueryBuilder) Updates(db *gorm.DB, m map[string]interface{}) (err error) {
	db = db.Model(&V2User{})

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

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

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

	if err = db.Delete(&V2User{}).Error; err != nil {
		return errors.Wrap(err, "delete err")
	}
	return nil
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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