feat: 实现注册优惠码功能
- 支持创建/编辑/删除优惠码,设置赠送金额和使用限制 - 注册页面实时验证优惠码并显示赠送金额 - 支持 URL 参数自动填充 (?promo=CODE) - 添加优惠码验证接口速率限制 - 使用数据库行锁防止并发超限 - 新增后台优惠码管理页面,支持复制注册链接
This commit is contained in:
594
backend/ent/promocode/where.go
Normal file
594
backend/ent/promocode/where.go
Normal file
@@ -0,0 +1,594 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package promocode
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"github.com/Wei-Shaw/sub2api/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Code applies equality check predicate on the "code" field. It's identical to CodeEQ.
|
||||
func Code(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// BonusAmount applies equality check predicate on the "bonus_amount" field. It's identical to BonusAmountEQ.
|
||||
func BonusAmount(v float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldBonusAmount, v))
|
||||
}
|
||||
|
||||
// MaxUses applies equality check predicate on the "max_uses" field. It's identical to MaxUsesEQ.
|
||||
func MaxUses(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldMaxUses, v))
|
||||
}
|
||||
|
||||
// UsedCount applies equality check predicate on the "used_count" field. It's identical to UsedCountEQ.
|
||||
func UsedCount(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldUsedCount, v))
|
||||
}
|
||||
|
||||
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
||||
func Status(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// ExpiresAt applies equality check predicate on the "expires_at" field. It's identical to ExpiresAtEQ.
|
||||
func ExpiresAt(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldExpiresAt, v))
|
||||
}
|
||||
|
||||
// Notes applies equality check predicate on the "notes" field. It's identical to NotesEQ.
|
||||
func Notes(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldNotes, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
|
||||
func UpdatedAt(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// CodeEQ applies the EQ predicate on the "code" field.
|
||||
func CodeEQ(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeNEQ applies the NEQ predicate on the "code" field.
|
||||
func CodeNEQ(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeIn applies the In predicate on the "code" field.
|
||||
func CodeIn(vs ...string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldCode, vs...))
|
||||
}
|
||||
|
||||
// CodeNotIn applies the NotIn predicate on the "code" field.
|
||||
func CodeNotIn(vs ...string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldCode, vs...))
|
||||
}
|
||||
|
||||
// CodeGT applies the GT predicate on the "code" field.
|
||||
func CodeGT(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeGTE applies the GTE predicate on the "code" field.
|
||||
func CodeGTE(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeLT applies the LT predicate on the "code" field.
|
||||
func CodeLT(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeLTE applies the LTE predicate on the "code" field.
|
||||
func CodeLTE(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeContains applies the Contains predicate on the "code" field.
|
||||
func CodeContains(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldContains(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeHasPrefix applies the HasPrefix predicate on the "code" field.
|
||||
func CodeHasPrefix(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldHasPrefix(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeHasSuffix applies the HasSuffix predicate on the "code" field.
|
||||
func CodeHasSuffix(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldHasSuffix(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeEqualFold applies the EqualFold predicate on the "code" field.
|
||||
func CodeEqualFold(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEqualFold(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeContainsFold applies the ContainsFold predicate on the "code" field.
|
||||
func CodeContainsFold(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldContainsFold(FieldCode, v))
|
||||
}
|
||||
|
||||
// BonusAmountEQ applies the EQ predicate on the "bonus_amount" field.
|
||||
func BonusAmountEQ(v float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldBonusAmount, v))
|
||||
}
|
||||
|
||||
// BonusAmountNEQ applies the NEQ predicate on the "bonus_amount" field.
|
||||
func BonusAmountNEQ(v float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldBonusAmount, v))
|
||||
}
|
||||
|
||||
// BonusAmountIn applies the In predicate on the "bonus_amount" field.
|
||||
func BonusAmountIn(vs ...float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldBonusAmount, vs...))
|
||||
}
|
||||
|
||||
// BonusAmountNotIn applies the NotIn predicate on the "bonus_amount" field.
|
||||
func BonusAmountNotIn(vs ...float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldBonusAmount, vs...))
|
||||
}
|
||||
|
||||
// BonusAmountGT applies the GT predicate on the "bonus_amount" field.
|
||||
func BonusAmountGT(v float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldBonusAmount, v))
|
||||
}
|
||||
|
||||
// BonusAmountGTE applies the GTE predicate on the "bonus_amount" field.
|
||||
func BonusAmountGTE(v float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldBonusAmount, v))
|
||||
}
|
||||
|
||||
// BonusAmountLT applies the LT predicate on the "bonus_amount" field.
|
||||
func BonusAmountLT(v float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldBonusAmount, v))
|
||||
}
|
||||
|
||||
// BonusAmountLTE applies the LTE predicate on the "bonus_amount" field.
|
||||
func BonusAmountLTE(v float64) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldBonusAmount, v))
|
||||
}
|
||||
|
||||
// MaxUsesEQ applies the EQ predicate on the "max_uses" field.
|
||||
func MaxUsesEQ(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldMaxUses, v))
|
||||
}
|
||||
|
||||
// MaxUsesNEQ applies the NEQ predicate on the "max_uses" field.
|
||||
func MaxUsesNEQ(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldMaxUses, v))
|
||||
}
|
||||
|
||||
// MaxUsesIn applies the In predicate on the "max_uses" field.
|
||||
func MaxUsesIn(vs ...int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldMaxUses, vs...))
|
||||
}
|
||||
|
||||
// MaxUsesNotIn applies the NotIn predicate on the "max_uses" field.
|
||||
func MaxUsesNotIn(vs ...int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldMaxUses, vs...))
|
||||
}
|
||||
|
||||
// MaxUsesGT applies the GT predicate on the "max_uses" field.
|
||||
func MaxUsesGT(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldMaxUses, v))
|
||||
}
|
||||
|
||||
// MaxUsesGTE applies the GTE predicate on the "max_uses" field.
|
||||
func MaxUsesGTE(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldMaxUses, v))
|
||||
}
|
||||
|
||||
// MaxUsesLT applies the LT predicate on the "max_uses" field.
|
||||
func MaxUsesLT(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldMaxUses, v))
|
||||
}
|
||||
|
||||
// MaxUsesLTE applies the LTE predicate on the "max_uses" field.
|
||||
func MaxUsesLTE(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldMaxUses, v))
|
||||
}
|
||||
|
||||
// UsedCountEQ applies the EQ predicate on the "used_count" field.
|
||||
func UsedCountEQ(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldUsedCount, v))
|
||||
}
|
||||
|
||||
// UsedCountNEQ applies the NEQ predicate on the "used_count" field.
|
||||
func UsedCountNEQ(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldUsedCount, v))
|
||||
}
|
||||
|
||||
// UsedCountIn applies the In predicate on the "used_count" field.
|
||||
func UsedCountIn(vs ...int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldUsedCount, vs...))
|
||||
}
|
||||
|
||||
// UsedCountNotIn applies the NotIn predicate on the "used_count" field.
|
||||
func UsedCountNotIn(vs ...int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldUsedCount, vs...))
|
||||
}
|
||||
|
||||
// UsedCountGT applies the GT predicate on the "used_count" field.
|
||||
func UsedCountGT(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldUsedCount, v))
|
||||
}
|
||||
|
||||
// UsedCountGTE applies the GTE predicate on the "used_count" field.
|
||||
func UsedCountGTE(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldUsedCount, v))
|
||||
}
|
||||
|
||||
// UsedCountLT applies the LT predicate on the "used_count" field.
|
||||
func UsedCountLT(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldUsedCount, v))
|
||||
}
|
||||
|
||||
// UsedCountLTE applies the LTE predicate on the "used_count" field.
|
||||
func UsedCountLTE(v int) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldUsedCount, v))
|
||||
}
|
||||
|
||||
// StatusEQ applies the EQ predicate on the "status" field.
|
||||
func StatusEQ(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusNEQ applies the NEQ predicate on the "status" field.
|
||||
func StatusNEQ(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusIn applies the In predicate on the "status" field.
|
||||
func StatusIn(vs ...string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// StatusNotIn applies the NotIn predicate on the "status" field.
|
||||
func StatusNotIn(vs ...string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// StatusGT applies the GT predicate on the "status" field.
|
||||
func StatusGT(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusGTE applies the GTE predicate on the "status" field.
|
||||
func StatusGTE(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusLT applies the LT predicate on the "status" field.
|
||||
func StatusLT(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusLTE applies the LTE predicate on the "status" field.
|
||||
func StatusLTE(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusContains applies the Contains predicate on the "status" field.
|
||||
func StatusContains(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldContains(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusHasPrefix applies the HasPrefix predicate on the "status" field.
|
||||
func StatusHasPrefix(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldHasPrefix(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusHasSuffix applies the HasSuffix predicate on the "status" field.
|
||||
func StatusHasSuffix(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldHasSuffix(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusEqualFold applies the EqualFold predicate on the "status" field.
|
||||
func StatusEqualFold(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEqualFold(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusContainsFold applies the ContainsFold predicate on the "status" field.
|
||||
func StatusContainsFold(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldContainsFold(FieldStatus, v))
|
||||
}
|
||||
|
||||
// ExpiresAtEQ applies the EQ predicate on the "expires_at" field.
|
||||
func ExpiresAtEQ(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldExpiresAt, v))
|
||||
}
|
||||
|
||||
// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field.
|
||||
func ExpiresAtNEQ(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldExpiresAt, v))
|
||||
}
|
||||
|
||||
// ExpiresAtIn applies the In predicate on the "expires_at" field.
|
||||
func ExpiresAtIn(vs ...time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldExpiresAt, vs...))
|
||||
}
|
||||
|
||||
// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
|
||||
func ExpiresAtNotIn(vs ...time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldExpiresAt, vs...))
|
||||
}
|
||||
|
||||
// ExpiresAtGT applies the GT predicate on the "expires_at" field.
|
||||
func ExpiresAtGT(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldExpiresAt, v))
|
||||
}
|
||||
|
||||
// ExpiresAtGTE applies the GTE predicate on the "expires_at" field.
|
||||
func ExpiresAtGTE(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldExpiresAt, v))
|
||||
}
|
||||
|
||||
// ExpiresAtLT applies the LT predicate on the "expires_at" field.
|
||||
func ExpiresAtLT(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldExpiresAt, v))
|
||||
}
|
||||
|
||||
// ExpiresAtLTE applies the LTE predicate on the "expires_at" field.
|
||||
func ExpiresAtLTE(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldExpiresAt, v))
|
||||
}
|
||||
|
||||
// ExpiresAtIsNil applies the IsNil predicate on the "expires_at" field.
|
||||
func ExpiresAtIsNil() predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIsNull(FieldExpiresAt))
|
||||
}
|
||||
|
||||
// ExpiresAtNotNil applies the NotNil predicate on the "expires_at" field.
|
||||
func ExpiresAtNotNil() predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotNull(FieldExpiresAt))
|
||||
}
|
||||
|
||||
// NotesEQ applies the EQ predicate on the "notes" field.
|
||||
func NotesEQ(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesNEQ applies the NEQ predicate on the "notes" field.
|
||||
func NotesNEQ(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesIn applies the In predicate on the "notes" field.
|
||||
func NotesIn(vs ...string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldNotes, vs...))
|
||||
}
|
||||
|
||||
// NotesNotIn applies the NotIn predicate on the "notes" field.
|
||||
func NotesNotIn(vs ...string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldNotes, vs...))
|
||||
}
|
||||
|
||||
// NotesGT applies the GT predicate on the "notes" field.
|
||||
func NotesGT(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesGTE applies the GTE predicate on the "notes" field.
|
||||
func NotesGTE(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesLT applies the LT predicate on the "notes" field.
|
||||
func NotesLT(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesLTE applies the LTE predicate on the "notes" field.
|
||||
func NotesLTE(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesContains applies the Contains predicate on the "notes" field.
|
||||
func NotesContains(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldContains(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesHasPrefix applies the HasPrefix predicate on the "notes" field.
|
||||
func NotesHasPrefix(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldHasPrefix(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesHasSuffix applies the HasSuffix predicate on the "notes" field.
|
||||
func NotesHasSuffix(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldHasSuffix(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesIsNil applies the IsNil predicate on the "notes" field.
|
||||
func NotesIsNil() predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIsNull(FieldNotes))
|
||||
}
|
||||
|
||||
// NotesNotNil applies the NotNil predicate on the "notes" field.
|
||||
func NotesNotNil() predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotNull(FieldNotes))
|
||||
}
|
||||
|
||||
// NotesEqualFold applies the EqualFold predicate on the "notes" field.
|
||||
func NotesEqualFold(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEqualFold(FieldNotes, v))
|
||||
}
|
||||
|
||||
// NotesContainsFold applies the ContainsFold predicate on the "notes" field.
|
||||
func NotesContainsFold(v string) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldContainsFold(FieldNotes, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||||
func CreatedAtNEQ(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||||
func CreatedAtGT(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||||
func CreatedAtGTE(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||||
func CreatedAtLT(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||||
func CreatedAtLTE(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||||
func UpdatedAtNEQ(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||||
func UpdatedAtGT(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||||
func UpdatedAtGTE(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldGTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||||
func UpdatedAtLT(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||||
func UpdatedAtLTE(v time.Time) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// HasUsageRecords applies the HasEdge predicate on the "usage_records" edge.
|
||||
func HasUsageRecords() predicate.PromoCode {
|
||||
return predicate.PromoCode(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, UsageRecordsTable, UsageRecordsColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasUsageRecordsWith applies the HasEdge predicate on the "usage_records" edge with a given conditions (other predicates).
|
||||
func HasUsageRecordsWith(preds ...predicate.PromoCodeUsage) predicate.PromoCode {
|
||||
return predicate.PromoCode(func(s *sql.Selector) {
|
||||
step := newUsageRecordsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.PromoCode) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.PromoCode) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.PromoCode) predicate.PromoCode {
|
||||
return predicate.PromoCode(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user