This feature allows API Keys to have their own quota limits and expiration times, independent of the user's balance. Backend: - Add quota, quota_used, expires_at fields to api_key schema - Implement IsExpired() and IsQuotaExhausted() checks in middleware - Add ResetQuota and ClearExpiration API endpoints - Integrate quota billing in gateway handlers (OpenAI, Anthropic, Gemini) - Include quota/expiration fields in auth cache for performance - Expiration check returns 403, quota exhausted returns 429 Frontend: - Add quota and expiration inputs to key create/edit dialog - Add quick-select buttons for expiration (+7, +30, +90 days) - Add reset quota confirmation dialog - Add expires_at column to keys list - Add i18n translations for new features (en/zh) Migration: - Add 045_add_api_key_quota.sql for new columns
721 lines
24 KiB
Go
721 lines
24 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package apikey
|
|
|
|
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.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldID, id))
|
|
}
|
|
|
|
// IDEQ applies the EQ predicate on the ID field.
|
|
func IDEQ(id int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldID, id))
|
|
}
|
|
|
|
// IDNEQ applies the NEQ predicate on the ID field.
|
|
func IDNEQ(id int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldID, id))
|
|
}
|
|
|
|
// IDIn applies the In predicate on the ID field.
|
|
func IDIn(ids ...int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldID, ids...))
|
|
}
|
|
|
|
// IDNotIn applies the NotIn predicate on the ID field.
|
|
func IDNotIn(ids ...int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldID, ids...))
|
|
}
|
|
|
|
// IDGT applies the GT predicate on the ID field.
|
|
func IDGT(id int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldID, id))
|
|
}
|
|
|
|
// IDGTE applies the GTE predicate on the ID field.
|
|
func IDGTE(id int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldID, id))
|
|
}
|
|
|
|
// IDLT applies the LT predicate on the ID field.
|
|
func IDLT(id int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldID, id))
|
|
}
|
|
|
|
// IDLTE applies the LTE predicate on the ID field.
|
|
func IDLTE(id int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldID, id))
|
|
}
|
|
|
|
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
|
func CreatedAt(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(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.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldUpdatedAt, v))
|
|
}
|
|
|
|
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
|
|
func DeletedAt(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldDeletedAt, v))
|
|
}
|
|
|
|
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
|
func UserID(v int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldUserID, v))
|
|
}
|
|
|
|
// Key applies equality check predicate on the "key" field. It's identical to KeyEQ.
|
|
func Key(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldKey, v))
|
|
}
|
|
|
|
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
|
func Name(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldName, v))
|
|
}
|
|
|
|
// GroupID applies equality check predicate on the "group_id" field. It's identical to GroupIDEQ.
|
|
func GroupID(v int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldGroupID, v))
|
|
}
|
|
|
|
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
|
func Status(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldStatus, v))
|
|
}
|
|
|
|
// Quota applies equality check predicate on the "quota" field. It's identical to QuotaEQ.
|
|
func Quota(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldQuota, v))
|
|
}
|
|
|
|
// QuotaUsed applies equality check predicate on the "quota_used" field. It's identical to QuotaUsedEQ.
|
|
func QuotaUsed(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldQuotaUsed, v))
|
|
}
|
|
|
|
// ExpiresAt applies equality check predicate on the "expires_at" field. It's identical to ExpiresAtEQ.
|
|
func ExpiresAt(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldExpiresAt, v))
|
|
}
|
|
|
|
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
|
func CreatedAtEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
|
func CreatedAtNEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtIn applies the In predicate on the "created_at" field.
|
|
func CreatedAtIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldCreatedAt, vs...))
|
|
}
|
|
|
|
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
|
func CreatedAtNotIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldCreatedAt, vs...))
|
|
}
|
|
|
|
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
|
func CreatedAtGT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
|
func CreatedAtGTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
|
func CreatedAtLT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
|
func CreatedAtLTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldCreatedAt, v))
|
|
}
|
|
|
|
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
|
func UpdatedAtEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldUpdatedAt, v))
|
|
}
|
|
|
|
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
|
func UpdatedAtNEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldUpdatedAt, v))
|
|
}
|
|
|
|
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
|
func UpdatedAtIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldUpdatedAt, vs...))
|
|
}
|
|
|
|
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
|
func UpdatedAtNotIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
|
}
|
|
|
|
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
|
func UpdatedAtGT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldUpdatedAt, v))
|
|
}
|
|
|
|
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
|
func UpdatedAtGTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldUpdatedAt, v))
|
|
}
|
|
|
|
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
|
func UpdatedAtLT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldUpdatedAt, v))
|
|
}
|
|
|
|
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
|
func UpdatedAtLTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldUpdatedAt, v))
|
|
}
|
|
|
|
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
|
|
func DeletedAtEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldDeletedAt, v))
|
|
}
|
|
|
|
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
|
|
func DeletedAtNEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldDeletedAt, v))
|
|
}
|
|
|
|
// DeletedAtIn applies the In predicate on the "deleted_at" field.
|
|
func DeletedAtIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldDeletedAt, vs...))
|
|
}
|
|
|
|
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
|
|
func DeletedAtNotIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldDeletedAt, vs...))
|
|
}
|
|
|
|
// DeletedAtGT applies the GT predicate on the "deleted_at" field.
|
|
func DeletedAtGT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldDeletedAt, v))
|
|
}
|
|
|
|
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
|
|
func DeletedAtGTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldDeletedAt, v))
|
|
}
|
|
|
|
// DeletedAtLT applies the LT predicate on the "deleted_at" field.
|
|
func DeletedAtLT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldDeletedAt, v))
|
|
}
|
|
|
|
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
|
|
func DeletedAtLTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldDeletedAt, v))
|
|
}
|
|
|
|
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
|
|
func DeletedAtIsNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIsNull(FieldDeletedAt))
|
|
}
|
|
|
|
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
|
|
func DeletedAtNotNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotNull(FieldDeletedAt))
|
|
}
|
|
|
|
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
|
func UserIDEQ(v int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldUserID, v))
|
|
}
|
|
|
|
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
|
|
func UserIDNEQ(v int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldUserID, v))
|
|
}
|
|
|
|
// UserIDIn applies the In predicate on the "user_id" field.
|
|
func UserIDIn(vs ...int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldUserID, vs...))
|
|
}
|
|
|
|
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
|
|
func UserIDNotIn(vs ...int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldUserID, vs...))
|
|
}
|
|
|
|
// KeyEQ applies the EQ predicate on the "key" field.
|
|
func KeyEQ(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldKey, v))
|
|
}
|
|
|
|
// KeyNEQ applies the NEQ predicate on the "key" field.
|
|
func KeyNEQ(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldKey, v))
|
|
}
|
|
|
|
// KeyIn applies the In predicate on the "key" field.
|
|
func KeyIn(vs ...string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldKey, vs...))
|
|
}
|
|
|
|
// KeyNotIn applies the NotIn predicate on the "key" field.
|
|
func KeyNotIn(vs ...string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldKey, vs...))
|
|
}
|
|
|
|
// KeyGT applies the GT predicate on the "key" field.
|
|
func KeyGT(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldKey, v))
|
|
}
|
|
|
|
// KeyGTE applies the GTE predicate on the "key" field.
|
|
func KeyGTE(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldKey, v))
|
|
}
|
|
|
|
// KeyLT applies the LT predicate on the "key" field.
|
|
func KeyLT(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldKey, v))
|
|
}
|
|
|
|
// KeyLTE applies the LTE predicate on the "key" field.
|
|
func KeyLTE(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldKey, v))
|
|
}
|
|
|
|
// KeyContains applies the Contains predicate on the "key" field.
|
|
func KeyContains(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldContains(FieldKey, v))
|
|
}
|
|
|
|
// KeyHasPrefix applies the HasPrefix predicate on the "key" field.
|
|
func KeyHasPrefix(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldHasPrefix(FieldKey, v))
|
|
}
|
|
|
|
// KeyHasSuffix applies the HasSuffix predicate on the "key" field.
|
|
func KeyHasSuffix(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldHasSuffix(FieldKey, v))
|
|
}
|
|
|
|
// KeyEqualFold applies the EqualFold predicate on the "key" field.
|
|
func KeyEqualFold(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEqualFold(FieldKey, v))
|
|
}
|
|
|
|
// KeyContainsFold applies the ContainsFold predicate on the "key" field.
|
|
func KeyContainsFold(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldContainsFold(FieldKey, v))
|
|
}
|
|
|
|
// NameEQ applies the EQ predicate on the "name" field.
|
|
func NameEQ(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldName, v))
|
|
}
|
|
|
|
// NameNEQ applies the NEQ predicate on the "name" field.
|
|
func NameNEQ(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldName, v))
|
|
}
|
|
|
|
// NameIn applies the In predicate on the "name" field.
|
|
func NameIn(vs ...string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldName, vs...))
|
|
}
|
|
|
|
// NameNotIn applies the NotIn predicate on the "name" field.
|
|
func NameNotIn(vs ...string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldName, vs...))
|
|
}
|
|
|
|
// NameGT applies the GT predicate on the "name" field.
|
|
func NameGT(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldName, v))
|
|
}
|
|
|
|
// NameGTE applies the GTE predicate on the "name" field.
|
|
func NameGTE(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldName, v))
|
|
}
|
|
|
|
// NameLT applies the LT predicate on the "name" field.
|
|
func NameLT(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldName, v))
|
|
}
|
|
|
|
// NameLTE applies the LTE predicate on the "name" field.
|
|
func NameLTE(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldName, v))
|
|
}
|
|
|
|
// NameContains applies the Contains predicate on the "name" field.
|
|
func NameContains(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldContains(FieldName, v))
|
|
}
|
|
|
|
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
|
|
func NameHasPrefix(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldHasPrefix(FieldName, v))
|
|
}
|
|
|
|
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
|
|
func NameHasSuffix(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldHasSuffix(FieldName, v))
|
|
}
|
|
|
|
// NameEqualFold applies the EqualFold predicate on the "name" field.
|
|
func NameEqualFold(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEqualFold(FieldName, v))
|
|
}
|
|
|
|
// NameContainsFold applies the ContainsFold predicate on the "name" field.
|
|
func NameContainsFold(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldContainsFold(FieldName, v))
|
|
}
|
|
|
|
// GroupIDEQ applies the EQ predicate on the "group_id" field.
|
|
func GroupIDEQ(v int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldGroupID, v))
|
|
}
|
|
|
|
// GroupIDNEQ applies the NEQ predicate on the "group_id" field.
|
|
func GroupIDNEQ(v int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldGroupID, v))
|
|
}
|
|
|
|
// GroupIDIn applies the In predicate on the "group_id" field.
|
|
func GroupIDIn(vs ...int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldGroupID, vs...))
|
|
}
|
|
|
|
// GroupIDNotIn applies the NotIn predicate on the "group_id" field.
|
|
func GroupIDNotIn(vs ...int64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldGroupID, vs...))
|
|
}
|
|
|
|
// GroupIDIsNil applies the IsNil predicate on the "group_id" field.
|
|
func GroupIDIsNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIsNull(FieldGroupID))
|
|
}
|
|
|
|
// GroupIDNotNil applies the NotNil predicate on the "group_id" field.
|
|
func GroupIDNotNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotNull(FieldGroupID))
|
|
}
|
|
|
|
// StatusEQ applies the EQ predicate on the "status" field.
|
|
func StatusEQ(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldStatus, v))
|
|
}
|
|
|
|
// StatusNEQ applies the NEQ predicate on the "status" field.
|
|
func StatusNEQ(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldStatus, v))
|
|
}
|
|
|
|
// StatusIn applies the In predicate on the "status" field.
|
|
func StatusIn(vs ...string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldStatus, vs...))
|
|
}
|
|
|
|
// StatusNotIn applies the NotIn predicate on the "status" field.
|
|
func StatusNotIn(vs ...string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldStatus, vs...))
|
|
}
|
|
|
|
// StatusGT applies the GT predicate on the "status" field.
|
|
func StatusGT(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldStatus, v))
|
|
}
|
|
|
|
// StatusGTE applies the GTE predicate on the "status" field.
|
|
func StatusGTE(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldStatus, v))
|
|
}
|
|
|
|
// StatusLT applies the LT predicate on the "status" field.
|
|
func StatusLT(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldStatus, v))
|
|
}
|
|
|
|
// StatusLTE applies the LTE predicate on the "status" field.
|
|
func StatusLTE(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldStatus, v))
|
|
}
|
|
|
|
// StatusContains applies the Contains predicate on the "status" field.
|
|
func StatusContains(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldContains(FieldStatus, v))
|
|
}
|
|
|
|
// StatusHasPrefix applies the HasPrefix predicate on the "status" field.
|
|
func StatusHasPrefix(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldHasPrefix(FieldStatus, v))
|
|
}
|
|
|
|
// StatusHasSuffix applies the HasSuffix predicate on the "status" field.
|
|
func StatusHasSuffix(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldHasSuffix(FieldStatus, v))
|
|
}
|
|
|
|
// StatusEqualFold applies the EqualFold predicate on the "status" field.
|
|
func StatusEqualFold(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEqualFold(FieldStatus, v))
|
|
}
|
|
|
|
// StatusContainsFold applies the ContainsFold predicate on the "status" field.
|
|
func StatusContainsFold(v string) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldContainsFold(FieldStatus, v))
|
|
}
|
|
|
|
// IPWhitelistIsNil applies the IsNil predicate on the "ip_whitelist" field.
|
|
func IPWhitelistIsNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIsNull(FieldIPWhitelist))
|
|
}
|
|
|
|
// IPWhitelistNotNil applies the NotNil predicate on the "ip_whitelist" field.
|
|
func IPWhitelistNotNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotNull(FieldIPWhitelist))
|
|
}
|
|
|
|
// IPBlacklistIsNil applies the IsNil predicate on the "ip_blacklist" field.
|
|
func IPBlacklistIsNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIsNull(FieldIPBlacklist))
|
|
}
|
|
|
|
// IPBlacklistNotNil applies the NotNil predicate on the "ip_blacklist" field.
|
|
func IPBlacklistNotNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotNull(FieldIPBlacklist))
|
|
}
|
|
|
|
// QuotaEQ applies the EQ predicate on the "quota" field.
|
|
func QuotaEQ(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldQuota, v))
|
|
}
|
|
|
|
// QuotaNEQ applies the NEQ predicate on the "quota" field.
|
|
func QuotaNEQ(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldQuota, v))
|
|
}
|
|
|
|
// QuotaIn applies the In predicate on the "quota" field.
|
|
func QuotaIn(vs ...float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldQuota, vs...))
|
|
}
|
|
|
|
// QuotaNotIn applies the NotIn predicate on the "quota" field.
|
|
func QuotaNotIn(vs ...float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldQuota, vs...))
|
|
}
|
|
|
|
// QuotaGT applies the GT predicate on the "quota" field.
|
|
func QuotaGT(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldQuota, v))
|
|
}
|
|
|
|
// QuotaGTE applies the GTE predicate on the "quota" field.
|
|
func QuotaGTE(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldQuota, v))
|
|
}
|
|
|
|
// QuotaLT applies the LT predicate on the "quota" field.
|
|
func QuotaLT(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldQuota, v))
|
|
}
|
|
|
|
// QuotaLTE applies the LTE predicate on the "quota" field.
|
|
func QuotaLTE(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldQuota, v))
|
|
}
|
|
|
|
// QuotaUsedEQ applies the EQ predicate on the "quota_used" field.
|
|
func QuotaUsedEQ(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldQuotaUsed, v))
|
|
}
|
|
|
|
// QuotaUsedNEQ applies the NEQ predicate on the "quota_used" field.
|
|
func QuotaUsedNEQ(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldQuotaUsed, v))
|
|
}
|
|
|
|
// QuotaUsedIn applies the In predicate on the "quota_used" field.
|
|
func QuotaUsedIn(vs ...float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldQuotaUsed, vs...))
|
|
}
|
|
|
|
// QuotaUsedNotIn applies the NotIn predicate on the "quota_used" field.
|
|
func QuotaUsedNotIn(vs ...float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldQuotaUsed, vs...))
|
|
}
|
|
|
|
// QuotaUsedGT applies the GT predicate on the "quota_used" field.
|
|
func QuotaUsedGT(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldQuotaUsed, v))
|
|
}
|
|
|
|
// QuotaUsedGTE applies the GTE predicate on the "quota_used" field.
|
|
func QuotaUsedGTE(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldQuotaUsed, v))
|
|
}
|
|
|
|
// QuotaUsedLT applies the LT predicate on the "quota_used" field.
|
|
func QuotaUsedLT(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldQuotaUsed, v))
|
|
}
|
|
|
|
// QuotaUsedLTE applies the LTE predicate on the "quota_used" field.
|
|
func QuotaUsedLTE(v float64) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldQuotaUsed, v))
|
|
}
|
|
|
|
// ExpiresAtEQ applies the EQ predicate on the "expires_at" field.
|
|
func ExpiresAtEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldEQ(FieldExpiresAt, v))
|
|
}
|
|
|
|
// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field.
|
|
func ExpiresAtNEQ(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNEQ(FieldExpiresAt, v))
|
|
}
|
|
|
|
// ExpiresAtIn applies the In predicate on the "expires_at" field.
|
|
func ExpiresAtIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIn(FieldExpiresAt, vs...))
|
|
}
|
|
|
|
// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
|
|
func ExpiresAtNotIn(vs ...time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotIn(FieldExpiresAt, vs...))
|
|
}
|
|
|
|
// ExpiresAtGT applies the GT predicate on the "expires_at" field.
|
|
func ExpiresAtGT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGT(FieldExpiresAt, v))
|
|
}
|
|
|
|
// ExpiresAtGTE applies the GTE predicate on the "expires_at" field.
|
|
func ExpiresAtGTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldGTE(FieldExpiresAt, v))
|
|
}
|
|
|
|
// ExpiresAtLT applies the LT predicate on the "expires_at" field.
|
|
func ExpiresAtLT(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLT(FieldExpiresAt, v))
|
|
}
|
|
|
|
// ExpiresAtLTE applies the LTE predicate on the "expires_at" field.
|
|
func ExpiresAtLTE(v time.Time) predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldLTE(FieldExpiresAt, v))
|
|
}
|
|
|
|
// ExpiresAtIsNil applies the IsNil predicate on the "expires_at" field.
|
|
func ExpiresAtIsNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldIsNull(FieldExpiresAt))
|
|
}
|
|
|
|
// ExpiresAtNotNil applies the NotNil predicate on the "expires_at" field.
|
|
func ExpiresAtNotNil() predicate.APIKey {
|
|
return predicate.APIKey(sql.FieldNotNull(FieldExpiresAt))
|
|
}
|
|
|
|
// HasUser applies the HasEdge predicate on the "user" edge.
|
|
func HasUser() predicate.APIKey {
|
|
return predicate.APIKey(func(s *sql.Selector) {
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
|
)
|
|
sqlgraph.HasNeighbors(s, step)
|
|
})
|
|
}
|
|
|
|
// HasUserWith applies the HasEdge predicate on the "user" edge with a given conditions (other predicates).
|
|
func HasUserWith(preds ...predicate.User) predicate.APIKey {
|
|
return predicate.APIKey(func(s *sql.Selector) {
|
|
step := newUserStep()
|
|
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
|
for _, p := range preds {
|
|
p(s)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
// HasGroup applies the HasEdge predicate on the "group" edge.
|
|
func HasGroup() predicate.APIKey {
|
|
return predicate.APIKey(func(s *sql.Selector) {
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn),
|
|
)
|
|
sqlgraph.HasNeighbors(s, step)
|
|
})
|
|
}
|
|
|
|
// HasGroupWith applies the HasEdge predicate on the "group" edge with a given conditions (other predicates).
|
|
func HasGroupWith(preds ...predicate.Group) predicate.APIKey {
|
|
return predicate.APIKey(func(s *sql.Selector) {
|
|
step := newGroupStep()
|
|
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
|
for _, p := range preds {
|
|
p(s)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
// HasUsageLogs applies the HasEdge predicate on the "usage_logs" edge.
|
|
func HasUsageLogs() predicate.APIKey {
|
|
return predicate.APIKey(func(s *sql.Selector) {
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, UsageLogsTable, UsageLogsColumn),
|
|
)
|
|
sqlgraph.HasNeighbors(s, step)
|
|
})
|
|
}
|
|
|
|
// HasUsageLogsWith applies the HasEdge predicate on the "usage_logs" edge with a given conditions (other predicates).
|
|
func HasUsageLogsWith(preds ...predicate.UsageLog) predicate.APIKey {
|
|
return predicate.APIKey(func(s *sql.Selector) {
|
|
step := newUsageLogsStep()
|
|
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.APIKey) predicate.APIKey {
|
|
return predicate.APIKey(sql.AndPredicates(predicates...))
|
|
}
|
|
|
|
// Or groups predicates with the OR operator between them.
|
|
func Or(predicates ...predicate.APIKey) predicate.APIKey {
|
|
return predicate.APIKey(sql.OrPredicates(predicates...))
|
|
}
|
|
|
|
// Not applies the not operator on the given predicate.
|
|
func Not(p predicate.APIKey) predicate.APIKey {
|
|
return predicate.APIKey(sql.NotPredicates(p))
|
|
}
|