Merge branch 'main' into test
This commit is contained in:
@@ -79,6 +79,11 @@ type APIKeyMutation struct {
|
||||
appendip_whitelist []string
|
||||
ip_blacklist *[]string
|
||||
appendip_blacklist []string
|
||||
quota *float64
|
||||
addquota *float64
|
||||
quota_used *float64
|
||||
addquota_used *float64
|
||||
expires_at *time.Time
|
||||
clearedFields map[string]struct{}
|
||||
user *int64
|
||||
cleareduser bool
|
||||
@@ -634,6 +639,167 @@ func (m *APIKeyMutation) ResetIPBlacklist() {
|
||||
delete(m.clearedFields, apikey.FieldIPBlacklist)
|
||||
}
|
||||
|
||||
// SetQuota sets the "quota" field.
|
||||
func (m *APIKeyMutation) SetQuota(f float64) {
|
||||
m.quota = &f
|
||||
m.addquota = nil
|
||||
}
|
||||
|
||||
// Quota returns the value of the "quota" field in the mutation.
|
||||
func (m *APIKeyMutation) Quota() (r float64, exists bool) {
|
||||
v := m.quota
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldQuota returns the old "quota" field's value of the APIKey entity.
|
||||
// If the APIKey object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *APIKeyMutation) OldQuota(ctx context.Context) (v float64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldQuota is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldQuota requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldQuota: %w", err)
|
||||
}
|
||||
return oldValue.Quota, nil
|
||||
}
|
||||
|
||||
// AddQuota adds f to the "quota" field.
|
||||
func (m *APIKeyMutation) AddQuota(f float64) {
|
||||
if m.addquota != nil {
|
||||
*m.addquota += f
|
||||
} else {
|
||||
m.addquota = &f
|
||||
}
|
||||
}
|
||||
|
||||
// AddedQuota returns the value that was added to the "quota" field in this mutation.
|
||||
func (m *APIKeyMutation) AddedQuota() (r float64, exists bool) {
|
||||
v := m.addquota
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetQuota resets all changes to the "quota" field.
|
||||
func (m *APIKeyMutation) ResetQuota() {
|
||||
m.quota = nil
|
||||
m.addquota = nil
|
||||
}
|
||||
|
||||
// SetQuotaUsed sets the "quota_used" field.
|
||||
func (m *APIKeyMutation) SetQuotaUsed(f float64) {
|
||||
m.quota_used = &f
|
||||
m.addquota_used = nil
|
||||
}
|
||||
|
||||
// QuotaUsed returns the value of the "quota_used" field in the mutation.
|
||||
func (m *APIKeyMutation) QuotaUsed() (r float64, exists bool) {
|
||||
v := m.quota_used
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldQuotaUsed returns the old "quota_used" field's value of the APIKey entity.
|
||||
// If the APIKey object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *APIKeyMutation) OldQuotaUsed(ctx context.Context) (v float64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldQuotaUsed is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldQuotaUsed requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldQuotaUsed: %w", err)
|
||||
}
|
||||
return oldValue.QuotaUsed, nil
|
||||
}
|
||||
|
||||
// AddQuotaUsed adds f to the "quota_used" field.
|
||||
func (m *APIKeyMutation) AddQuotaUsed(f float64) {
|
||||
if m.addquota_used != nil {
|
||||
*m.addquota_used += f
|
||||
} else {
|
||||
m.addquota_used = &f
|
||||
}
|
||||
}
|
||||
|
||||
// AddedQuotaUsed returns the value that was added to the "quota_used" field in this mutation.
|
||||
func (m *APIKeyMutation) AddedQuotaUsed() (r float64, exists bool) {
|
||||
v := m.addquota_used
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetQuotaUsed resets all changes to the "quota_used" field.
|
||||
func (m *APIKeyMutation) ResetQuotaUsed() {
|
||||
m.quota_used = nil
|
||||
m.addquota_used = nil
|
||||
}
|
||||
|
||||
// SetExpiresAt sets the "expires_at" field.
|
||||
func (m *APIKeyMutation) SetExpiresAt(t time.Time) {
|
||||
m.expires_at = &t
|
||||
}
|
||||
|
||||
// ExpiresAt returns the value of the "expires_at" field in the mutation.
|
||||
func (m *APIKeyMutation) ExpiresAt() (r time.Time, exists bool) {
|
||||
v := m.expires_at
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldExpiresAt returns the old "expires_at" field's value of the APIKey entity.
|
||||
// If the APIKey object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *APIKeyMutation) OldExpiresAt(ctx context.Context) (v *time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldExpiresAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldExpiresAt requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldExpiresAt: %w", err)
|
||||
}
|
||||
return oldValue.ExpiresAt, nil
|
||||
}
|
||||
|
||||
// ClearExpiresAt clears the value of the "expires_at" field.
|
||||
func (m *APIKeyMutation) ClearExpiresAt() {
|
||||
m.expires_at = nil
|
||||
m.clearedFields[apikey.FieldExpiresAt] = struct{}{}
|
||||
}
|
||||
|
||||
// ExpiresAtCleared returns if the "expires_at" field was cleared in this mutation.
|
||||
func (m *APIKeyMutation) ExpiresAtCleared() bool {
|
||||
_, ok := m.clearedFields[apikey.FieldExpiresAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetExpiresAt resets all changes to the "expires_at" field.
|
||||
func (m *APIKeyMutation) ResetExpiresAt() {
|
||||
m.expires_at = nil
|
||||
delete(m.clearedFields, apikey.FieldExpiresAt)
|
||||
}
|
||||
|
||||
// ClearUser clears the "user" edge to the User entity.
|
||||
func (m *APIKeyMutation) ClearUser() {
|
||||
m.cleareduser = true
|
||||
@@ -776,7 +942,7 @@ func (m *APIKeyMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *APIKeyMutation) Fields() []string {
|
||||
fields := make([]string, 0, 10)
|
||||
fields := make([]string, 0, 13)
|
||||
if m.created_at != nil {
|
||||
fields = append(fields, apikey.FieldCreatedAt)
|
||||
}
|
||||
@@ -807,6 +973,15 @@ func (m *APIKeyMutation) Fields() []string {
|
||||
if m.ip_blacklist != nil {
|
||||
fields = append(fields, apikey.FieldIPBlacklist)
|
||||
}
|
||||
if m.quota != nil {
|
||||
fields = append(fields, apikey.FieldQuota)
|
||||
}
|
||||
if m.quota_used != nil {
|
||||
fields = append(fields, apikey.FieldQuotaUsed)
|
||||
}
|
||||
if m.expires_at != nil {
|
||||
fields = append(fields, apikey.FieldExpiresAt)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -835,6 +1010,12 @@ func (m *APIKeyMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.IPWhitelist()
|
||||
case apikey.FieldIPBlacklist:
|
||||
return m.IPBlacklist()
|
||||
case apikey.FieldQuota:
|
||||
return m.Quota()
|
||||
case apikey.FieldQuotaUsed:
|
||||
return m.QuotaUsed()
|
||||
case apikey.FieldExpiresAt:
|
||||
return m.ExpiresAt()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -864,6 +1045,12 @@ func (m *APIKeyMutation) OldField(ctx context.Context, name string) (ent.Value,
|
||||
return m.OldIPWhitelist(ctx)
|
||||
case apikey.FieldIPBlacklist:
|
||||
return m.OldIPBlacklist(ctx)
|
||||
case apikey.FieldQuota:
|
||||
return m.OldQuota(ctx)
|
||||
case apikey.FieldQuotaUsed:
|
||||
return m.OldQuotaUsed(ctx)
|
||||
case apikey.FieldExpiresAt:
|
||||
return m.OldExpiresAt(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown APIKey field %s", name)
|
||||
}
|
||||
@@ -943,6 +1130,27 @@ func (m *APIKeyMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetIPBlacklist(v)
|
||||
return nil
|
||||
case apikey.FieldQuota:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetQuota(v)
|
||||
return nil
|
||||
case apikey.FieldQuotaUsed:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetQuotaUsed(v)
|
||||
return nil
|
||||
case apikey.FieldExpiresAt:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetExpiresAt(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown APIKey field %s", name)
|
||||
}
|
||||
@@ -951,6 +1159,12 @@ func (m *APIKeyMutation) SetField(name string, value ent.Value) error {
|
||||
// this mutation.
|
||||
func (m *APIKeyMutation) AddedFields() []string {
|
||||
var fields []string
|
||||
if m.addquota != nil {
|
||||
fields = append(fields, apikey.FieldQuota)
|
||||
}
|
||||
if m.addquota_used != nil {
|
||||
fields = append(fields, apikey.FieldQuotaUsed)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -959,6 +1173,10 @@ func (m *APIKeyMutation) AddedFields() []string {
|
||||
// was not set, or was not defined in the schema.
|
||||
func (m *APIKeyMutation) AddedField(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case apikey.FieldQuota:
|
||||
return m.AddedQuota()
|
||||
case apikey.FieldQuotaUsed:
|
||||
return m.AddedQuotaUsed()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -968,6 +1186,20 @@ func (m *APIKeyMutation) AddedField(name string) (ent.Value, bool) {
|
||||
// type.
|
||||
func (m *APIKeyMutation) AddField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case apikey.FieldQuota:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddQuota(v)
|
||||
return nil
|
||||
case apikey.FieldQuotaUsed:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddQuotaUsed(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown APIKey numeric field %s", name)
|
||||
}
|
||||
@@ -988,6 +1220,9 @@ func (m *APIKeyMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(apikey.FieldIPBlacklist) {
|
||||
fields = append(fields, apikey.FieldIPBlacklist)
|
||||
}
|
||||
if m.FieldCleared(apikey.FieldExpiresAt) {
|
||||
fields = append(fields, apikey.FieldExpiresAt)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -1014,6 +1249,9 @@ func (m *APIKeyMutation) ClearField(name string) error {
|
||||
case apikey.FieldIPBlacklist:
|
||||
m.ClearIPBlacklist()
|
||||
return nil
|
||||
case apikey.FieldExpiresAt:
|
||||
m.ClearExpiresAt()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown APIKey nullable field %s", name)
|
||||
}
|
||||
@@ -1052,6 +1290,15 @@ func (m *APIKeyMutation) ResetField(name string) error {
|
||||
case apikey.FieldIPBlacklist:
|
||||
m.ResetIPBlacklist()
|
||||
return nil
|
||||
case apikey.FieldQuota:
|
||||
m.ResetQuota()
|
||||
return nil
|
||||
case apikey.FieldQuotaUsed:
|
||||
m.ResetQuotaUsed()
|
||||
return nil
|
||||
case apikey.FieldExpiresAt:
|
||||
m.ResetExpiresAt()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown APIKey field %s", name)
|
||||
}
|
||||
@@ -5506,69 +5753,74 @@ func (m *AnnouncementReadMutation) ResetEdge(name string) error {
|
||||
// GroupMutation represents an operation that mutates the Group nodes in the graph.
|
||||
type GroupMutation struct {
|
||||
config
|
||||
op Op
|
||||
typ string
|
||||
id *int64
|
||||
created_at *time.Time
|
||||
updated_at *time.Time
|
||||
deleted_at *time.Time
|
||||
name *string
|
||||
description *string
|
||||
rate_multiplier *float64
|
||||
addrate_multiplier *float64
|
||||
is_exclusive *bool
|
||||
status *string
|
||||
platform *string
|
||||
subscription_type *string
|
||||
daily_limit_usd *float64
|
||||
adddaily_limit_usd *float64
|
||||
weekly_limit_usd *float64
|
||||
addweekly_limit_usd *float64
|
||||
monthly_limit_usd *float64
|
||||
addmonthly_limit_usd *float64
|
||||
default_validity_days *int
|
||||
adddefault_validity_days *int
|
||||
image_price_1k *float64
|
||||
addimage_price_1k *float64
|
||||
image_price_2k *float64
|
||||
addimage_price_2k *float64
|
||||
image_price_4k *float64
|
||||
addimage_price_4k *float64
|
||||
sora_image_price_360 *float64
|
||||
addsora_image_price_360 *float64
|
||||
sora_image_price_540 *float64
|
||||
addsora_image_price_540 *float64
|
||||
sora_video_price_per_request *float64
|
||||
addsora_video_price_per_request *float64
|
||||
sora_video_price_per_request_hd *float64
|
||||
addsora_video_price_per_request_hd *float64
|
||||
claude_code_only *bool
|
||||
fallback_group_id *int64
|
||||
addfallback_group_id *int64
|
||||
model_routing *map[string][]int64
|
||||
model_routing_enabled *bool
|
||||
clearedFields map[string]struct{}
|
||||
api_keys map[int64]struct{}
|
||||
removedapi_keys map[int64]struct{}
|
||||
clearedapi_keys bool
|
||||
redeem_codes map[int64]struct{}
|
||||
removedredeem_codes map[int64]struct{}
|
||||
clearedredeem_codes bool
|
||||
subscriptions map[int64]struct{}
|
||||
removedsubscriptions map[int64]struct{}
|
||||
clearedsubscriptions bool
|
||||
usage_logs map[int64]struct{}
|
||||
removedusage_logs map[int64]struct{}
|
||||
clearedusage_logs bool
|
||||
accounts map[int64]struct{}
|
||||
removedaccounts map[int64]struct{}
|
||||
clearedaccounts bool
|
||||
allowed_users map[int64]struct{}
|
||||
removedallowed_users map[int64]struct{}
|
||||
clearedallowed_users bool
|
||||
done bool
|
||||
oldValue func(context.Context) (*Group, error)
|
||||
predicates []predicate.Group
|
||||
op Op
|
||||
typ string
|
||||
id *int64
|
||||
created_at *time.Time
|
||||
updated_at *time.Time
|
||||
deleted_at *time.Time
|
||||
name *string
|
||||
description *string
|
||||
rate_multiplier *float64
|
||||
addrate_multiplier *float64
|
||||
is_exclusive *bool
|
||||
status *string
|
||||
platform *string
|
||||
subscription_type *string
|
||||
daily_limit_usd *float64
|
||||
adddaily_limit_usd *float64
|
||||
weekly_limit_usd *float64
|
||||
addweekly_limit_usd *float64
|
||||
monthly_limit_usd *float64
|
||||
addmonthly_limit_usd *float64
|
||||
default_validity_days *int
|
||||
adddefault_validity_days *int
|
||||
image_price_1k *float64
|
||||
addimage_price_1k *float64
|
||||
image_price_2k *float64
|
||||
addimage_price_2k *float64
|
||||
image_price_4k *float64
|
||||
addimage_price_4k *float64
|
||||
sora_image_price_360 *float64
|
||||
addsora_image_price_360 *float64
|
||||
sora_image_price_540 *float64
|
||||
addsora_image_price_540 *float64
|
||||
sora_video_price_per_request *float64
|
||||
addsora_video_price_per_request *float64
|
||||
sora_video_price_per_request_hd *float64
|
||||
addsora_video_price_per_request_hd *float64
|
||||
claude_code_only *bool
|
||||
fallback_group_id *int64
|
||||
addfallback_group_id *int64
|
||||
fallback_group_id_on_invalid_request *int64
|
||||
addfallback_group_id_on_invalid_request *int64
|
||||
model_routing *map[string][]int64
|
||||
model_routing_enabled *bool
|
||||
mcp_xml_inject *bool
|
||||
supported_model_scopes *[]string
|
||||
appendsupported_model_scopes []string
|
||||
clearedFields map[string]struct{}
|
||||
api_keys map[int64]struct{}
|
||||
removedapi_keys map[int64]struct{}
|
||||
clearedapi_keys bool
|
||||
redeem_codes map[int64]struct{}
|
||||
removedredeem_codes map[int64]struct{}
|
||||
clearedredeem_codes bool
|
||||
subscriptions map[int64]struct{}
|
||||
removedsubscriptions map[int64]struct{}
|
||||
clearedsubscriptions bool
|
||||
usage_logs map[int64]struct{}
|
||||
removedusage_logs map[int64]struct{}
|
||||
clearedusage_logs bool
|
||||
accounts map[int64]struct{}
|
||||
removedaccounts map[int64]struct{}
|
||||
clearedaccounts bool
|
||||
allowed_users map[int64]struct{}
|
||||
removedallowed_users map[int64]struct{}
|
||||
clearedallowed_users bool
|
||||
done bool
|
||||
oldValue func(context.Context) (*Group, error)
|
||||
predicates []predicate.Group
|
||||
}
|
||||
|
||||
var _ ent.Mutation = (*GroupMutation)(nil)
|
||||
@@ -6937,6 +7189,76 @@ func (m *GroupMutation) ResetFallbackGroupID() {
|
||||
delete(m.clearedFields, group.FieldFallbackGroupID)
|
||||
}
|
||||
|
||||
// SetFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field.
|
||||
func (m *GroupMutation) SetFallbackGroupIDOnInvalidRequest(i int64) {
|
||||
m.fallback_group_id_on_invalid_request = &i
|
||||
m.addfallback_group_id_on_invalid_request = nil
|
||||
}
|
||||
|
||||
// FallbackGroupIDOnInvalidRequest returns the value of the "fallback_group_id_on_invalid_request" field in the mutation.
|
||||
func (m *GroupMutation) FallbackGroupIDOnInvalidRequest() (r int64, exists bool) {
|
||||
v := m.fallback_group_id_on_invalid_request
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldFallbackGroupIDOnInvalidRequest returns the old "fallback_group_id_on_invalid_request" field's value of the Group entity.
|
||||
// If the Group object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *GroupMutation) OldFallbackGroupIDOnInvalidRequest(ctx context.Context) (v *int64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldFallbackGroupIDOnInvalidRequest is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldFallbackGroupIDOnInvalidRequest requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldFallbackGroupIDOnInvalidRequest: %w", err)
|
||||
}
|
||||
return oldValue.FallbackGroupIDOnInvalidRequest, nil
|
||||
}
|
||||
|
||||
// AddFallbackGroupIDOnInvalidRequest adds i to the "fallback_group_id_on_invalid_request" field.
|
||||
func (m *GroupMutation) AddFallbackGroupIDOnInvalidRequest(i int64) {
|
||||
if m.addfallback_group_id_on_invalid_request != nil {
|
||||
*m.addfallback_group_id_on_invalid_request += i
|
||||
} else {
|
||||
m.addfallback_group_id_on_invalid_request = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedFallbackGroupIDOnInvalidRequest returns the value that was added to the "fallback_group_id_on_invalid_request" field in this mutation.
|
||||
func (m *GroupMutation) AddedFallbackGroupIDOnInvalidRequest() (r int64, exists bool) {
|
||||
v := m.addfallback_group_id_on_invalid_request
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearFallbackGroupIDOnInvalidRequest clears the value of the "fallback_group_id_on_invalid_request" field.
|
||||
func (m *GroupMutation) ClearFallbackGroupIDOnInvalidRequest() {
|
||||
m.fallback_group_id_on_invalid_request = nil
|
||||
m.addfallback_group_id_on_invalid_request = nil
|
||||
m.clearedFields[group.FieldFallbackGroupIDOnInvalidRequest] = struct{}{}
|
||||
}
|
||||
|
||||
// FallbackGroupIDOnInvalidRequestCleared returns if the "fallback_group_id_on_invalid_request" field was cleared in this mutation.
|
||||
func (m *GroupMutation) FallbackGroupIDOnInvalidRequestCleared() bool {
|
||||
_, ok := m.clearedFields[group.FieldFallbackGroupIDOnInvalidRequest]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetFallbackGroupIDOnInvalidRequest resets all changes to the "fallback_group_id_on_invalid_request" field.
|
||||
func (m *GroupMutation) ResetFallbackGroupIDOnInvalidRequest() {
|
||||
m.fallback_group_id_on_invalid_request = nil
|
||||
m.addfallback_group_id_on_invalid_request = nil
|
||||
delete(m.clearedFields, group.FieldFallbackGroupIDOnInvalidRequest)
|
||||
}
|
||||
|
||||
// SetModelRouting sets the "model_routing" field.
|
||||
func (m *GroupMutation) SetModelRouting(value map[string][]int64) {
|
||||
m.model_routing = &value
|
||||
@@ -7022,6 +7344,93 @@ func (m *GroupMutation) ResetModelRoutingEnabled() {
|
||||
m.model_routing_enabled = nil
|
||||
}
|
||||
|
||||
// SetMcpXMLInject sets the "mcp_xml_inject" field.
|
||||
func (m *GroupMutation) SetMcpXMLInject(b bool) {
|
||||
m.mcp_xml_inject = &b
|
||||
}
|
||||
|
||||
// McpXMLInject returns the value of the "mcp_xml_inject" field in the mutation.
|
||||
func (m *GroupMutation) McpXMLInject() (r bool, exists bool) {
|
||||
v := m.mcp_xml_inject
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldMcpXMLInject returns the old "mcp_xml_inject" field's value of the Group entity.
|
||||
// If the Group object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *GroupMutation) OldMcpXMLInject(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldMcpXMLInject is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldMcpXMLInject requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldMcpXMLInject: %w", err)
|
||||
}
|
||||
return oldValue.McpXMLInject, nil
|
||||
}
|
||||
|
||||
// ResetMcpXMLInject resets all changes to the "mcp_xml_inject" field.
|
||||
func (m *GroupMutation) ResetMcpXMLInject() {
|
||||
m.mcp_xml_inject = nil
|
||||
}
|
||||
|
||||
// SetSupportedModelScopes sets the "supported_model_scopes" field.
|
||||
func (m *GroupMutation) SetSupportedModelScopes(s []string) {
|
||||
m.supported_model_scopes = &s
|
||||
m.appendsupported_model_scopes = nil
|
||||
}
|
||||
|
||||
// SupportedModelScopes returns the value of the "supported_model_scopes" field in the mutation.
|
||||
func (m *GroupMutation) SupportedModelScopes() (r []string, exists bool) {
|
||||
v := m.supported_model_scopes
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldSupportedModelScopes returns the old "supported_model_scopes" field's value of the Group entity.
|
||||
// If the Group object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *GroupMutation) OldSupportedModelScopes(ctx context.Context) (v []string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldSupportedModelScopes is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldSupportedModelScopes requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldSupportedModelScopes: %w", err)
|
||||
}
|
||||
return oldValue.SupportedModelScopes, nil
|
||||
}
|
||||
|
||||
// AppendSupportedModelScopes adds s to the "supported_model_scopes" field.
|
||||
func (m *GroupMutation) AppendSupportedModelScopes(s []string) {
|
||||
m.appendsupported_model_scopes = append(m.appendsupported_model_scopes, s...)
|
||||
}
|
||||
|
||||
// AppendedSupportedModelScopes returns the list of values that were appended to the "supported_model_scopes" field in this mutation.
|
||||
func (m *GroupMutation) AppendedSupportedModelScopes() ([]string, bool) {
|
||||
if len(m.appendsupported_model_scopes) == 0 {
|
||||
return nil, false
|
||||
}
|
||||
return m.appendsupported_model_scopes, true
|
||||
}
|
||||
|
||||
// ResetSupportedModelScopes resets all changes to the "supported_model_scopes" field.
|
||||
func (m *GroupMutation) ResetSupportedModelScopes() {
|
||||
m.supported_model_scopes = nil
|
||||
m.appendsupported_model_scopes = nil
|
||||
}
|
||||
|
||||
// AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by ids.
|
||||
func (m *GroupMutation) AddAPIKeyIDs(ids ...int64) {
|
||||
if m.api_keys == nil {
|
||||
@@ -7450,12 +7859,21 @@ func (m *GroupMutation) Fields() []string {
|
||||
if m.fallback_group_id != nil {
|
||||
fields = append(fields, group.FieldFallbackGroupID)
|
||||
}
|
||||
if m.fallback_group_id_on_invalid_request != nil {
|
||||
fields = append(fields, group.FieldFallbackGroupIDOnInvalidRequest)
|
||||
}
|
||||
if m.model_routing != nil {
|
||||
fields = append(fields, group.FieldModelRouting)
|
||||
}
|
||||
if m.model_routing_enabled != nil {
|
||||
fields = append(fields, group.FieldModelRoutingEnabled)
|
||||
}
|
||||
if m.mcp_xml_inject != nil {
|
||||
fields = append(fields, group.FieldMcpXMLInject)
|
||||
}
|
||||
if m.supported_model_scopes != nil {
|
||||
fields = append(fields, group.FieldSupportedModelScopes)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -7510,10 +7928,16 @@ func (m *GroupMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.ClaudeCodeOnly()
|
||||
case group.FieldFallbackGroupID:
|
||||
return m.FallbackGroupID()
|
||||
case group.FieldFallbackGroupIDOnInvalidRequest:
|
||||
return m.FallbackGroupIDOnInvalidRequest()
|
||||
case group.FieldModelRouting:
|
||||
return m.ModelRouting()
|
||||
case group.FieldModelRoutingEnabled:
|
||||
return m.ModelRoutingEnabled()
|
||||
case group.FieldMcpXMLInject:
|
||||
return m.McpXMLInject()
|
||||
case group.FieldSupportedModelScopes:
|
||||
return m.SupportedModelScopes()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -7569,10 +7993,16 @@ func (m *GroupMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
||||
return m.OldClaudeCodeOnly(ctx)
|
||||
case group.FieldFallbackGroupID:
|
||||
return m.OldFallbackGroupID(ctx)
|
||||
case group.FieldFallbackGroupIDOnInvalidRequest:
|
||||
return m.OldFallbackGroupIDOnInvalidRequest(ctx)
|
||||
case group.FieldModelRouting:
|
||||
return m.OldModelRouting(ctx)
|
||||
case group.FieldModelRoutingEnabled:
|
||||
return m.OldModelRoutingEnabled(ctx)
|
||||
case group.FieldMcpXMLInject:
|
||||
return m.OldMcpXMLInject(ctx)
|
||||
case group.FieldSupportedModelScopes:
|
||||
return m.OldSupportedModelScopes(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Group field %s", name)
|
||||
}
|
||||
@@ -7743,6 +8173,13 @@ func (m *GroupMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetFallbackGroupID(v)
|
||||
return nil
|
||||
case group.FieldFallbackGroupIDOnInvalidRequest:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetFallbackGroupIDOnInvalidRequest(v)
|
||||
return nil
|
||||
case group.FieldModelRouting:
|
||||
v, ok := value.(map[string][]int64)
|
||||
if !ok {
|
||||
@@ -7757,6 +8194,20 @@ func (m *GroupMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetModelRoutingEnabled(v)
|
||||
return nil
|
||||
case group.FieldMcpXMLInject:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetMcpXMLInject(v)
|
||||
return nil
|
||||
case group.FieldSupportedModelScopes:
|
||||
v, ok := value.([]string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetSupportedModelScopes(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group field %s", name)
|
||||
}
|
||||
@@ -7804,6 +8255,9 @@ func (m *GroupMutation) AddedFields() []string {
|
||||
if m.addfallback_group_id != nil {
|
||||
fields = append(fields, group.FieldFallbackGroupID)
|
||||
}
|
||||
if m.addfallback_group_id_on_invalid_request != nil {
|
||||
fields = append(fields, group.FieldFallbackGroupIDOnInvalidRequest)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -7838,6 +8292,8 @@ func (m *GroupMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return m.AddedSoraVideoPricePerRequestHd()
|
||||
case group.FieldFallbackGroupID:
|
||||
return m.AddedFallbackGroupID()
|
||||
case group.FieldFallbackGroupIDOnInvalidRequest:
|
||||
return m.AddedFallbackGroupIDOnInvalidRequest()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -7938,6 +8394,13 @@ func (m *GroupMutation) AddField(name string, value ent.Value) error {
|
||||
}
|
||||
m.AddFallbackGroupID(v)
|
||||
return nil
|
||||
case group.FieldFallbackGroupIDOnInvalidRequest:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddFallbackGroupIDOnInvalidRequest(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group numeric field %s", name)
|
||||
}
|
||||
@@ -7985,6 +8448,9 @@ func (m *GroupMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(group.FieldFallbackGroupID) {
|
||||
fields = append(fields, group.FieldFallbackGroupID)
|
||||
}
|
||||
if m.FieldCleared(group.FieldFallbackGroupIDOnInvalidRequest) {
|
||||
fields = append(fields, group.FieldFallbackGroupIDOnInvalidRequest)
|
||||
}
|
||||
if m.FieldCleared(group.FieldModelRouting) {
|
||||
fields = append(fields, group.FieldModelRouting)
|
||||
}
|
||||
@@ -8041,6 +8507,9 @@ func (m *GroupMutation) ClearField(name string) error {
|
||||
case group.FieldFallbackGroupID:
|
||||
m.ClearFallbackGroupID()
|
||||
return nil
|
||||
case group.FieldFallbackGroupIDOnInvalidRequest:
|
||||
m.ClearFallbackGroupIDOnInvalidRequest()
|
||||
return nil
|
||||
case group.FieldModelRouting:
|
||||
m.ClearModelRouting()
|
||||
return nil
|
||||
@@ -8121,12 +8590,21 @@ func (m *GroupMutation) ResetField(name string) error {
|
||||
case group.FieldFallbackGroupID:
|
||||
m.ResetFallbackGroupID()
|
||||
return nil
|
||||
case group.FieldFallbackGroupIDOnInvalidRequest:
|
||||
m.ResetFallbackGroupIDOnInvalidRequest()
|
||||
return nil
|
||||
case group.FieldModelRouting:
|
||||
m.ResetModelRouting()
|
||||
return nil
|
||||
case group.FieldModelRoutingEnabled:
|
||||
m.ResetModelRoutingEnabled()
|
||||
return nil
|
||||
case group.FieldMcpXMLInject:
|
||||
m.ResetMcpXMLInject()
|
||||
return nil
|
||||
case group.FieldSupportedModelScopes:
|
||||
m.ResetSupportedModelScopes()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group field %s", name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user