// Code generated by ent, DO NOT EDIT. package ent import ( "context" "encoding/json" "errors" "fmt" "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/dialect/sql/sqljson" "entgo.io/ent/schema/field" "github.com/Wei-Shaw/sub2api/ent/account" "github.com/Wei-Shaw/sub2api/ent/apikey" "github.com/Wei-Shaw/sub2api/ent/group" "github.com/Wei-Shaw/sub2api/ent/predicate" "github.com/Wei-Shaw/sub2api/ent/redeemcode" "github.com/Wei-Shaw/sub2api/ent/usagelog" "github.com/Wei-Shaw/sub2api/ent/user" "github.com/Wei-Shaw/sub2api/ent/usersubscription" "github.com/Wei-Shaw/sub2api/internal/domain" ) // GroupUpdate is the builder for updating Group entities. type GroupUpdate struct { config hooks []Hook mutation *GroupMutation } // Where appends a list predicates to the GroupUpdate builder. func (_u *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate { _u.mutation.Where(ps...) return _u } // SetUpdatedAt sets the "updated_at" field. func (_u *GroupUpdate) SetUpdatedAt(v time.Time) *GroupUpdate { _u.mutation.SetUpdatedAt(v) return _u } // SetDeletedAt sets the "deleted_at" field. func (_u *GroupUpdate) SetDeletedAt(v time.Time) *GroupUpdate { _u.mutation.SetDeletedAt(v) return _u } // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. func (_u *GroupUpdate) SetNillableDeletedAt(v *time.Time) *GroupUpdate { if v != nil { _u.SetDeletedAt(*v) } return _u } // ClearDeletedAt clears the value of the "deleted_at" field. func (_u *GroupUpdate) ClearDeletedAt() *GroupUpdate { _u.mutation.ClearDeletedAt() return _u } // SetName sets the "name" field. func (_u *GroupUpdate) SetName(v string) *GroupUpdate { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *GroupUpdate) SetNillableName(v *string) *GroupUpdate { if v != nil { _u.SetName(*v) } return _u } // SetDescription sets the "description" field. func (_u *GroupUpdate) SetDescription(v string) *GroupUpdate { _u.mutation.SetDescription(v) return _u } // SetNillableDescription sets the "description" field if the given value is not nil. func (_u *GroupUpdate) SetNillableDescription(v *string) *GroupUpdate { if v != nil { _u.SetDescription(*v) } return _u } // ClearDescription clears the value of the "description" field. func (_u *GroupUpdate) ClearDescription() *GroupUpdate { _u.mutation.ClearDescription() return _u } // SetRateMultiplier sets the "rate_multiplier" field. func (_u *GroupUpdate) SetRateMultiplier(v float64) *GroupUpdate { _u.mutation.ResetRateMultiplier() _u.mutation.SetRateMultiplier(v) return _u } // SetNillableRateMultiplier sets the "rate_multiplier" field if the given value is not nil. func (_u *GroupUpdate) SetNillableRateMultiplier(v *float64) *GroupUpdate { if v != nil { _u.SetRateMultiplier(*v) } return _u } // AddRateMultiplier adds value to the "rate_multiplier" field. func (_u *GroupUpdate) AddRateMultiplier(v float64) *GroupUpdate { _u.mutation.AddRateMultiplier(v) return _u } // SetPeakRateEnabled sets the "peak_rate_enabled" field. func (_u *GroupUpdate) SetPeakRateEnabled(v bool) *GroupUpdate { _u.mutation.SetPeakRateEnabled(v) return _u } // SetNillablePeakRateEnabled sets the "peak_rate_enabled" field if the given value is not nil. func (_u *GroupUpdate) SetNillablePeakRateEnabled(v *bool) *GroupUpdate { if v != nil { _u.SetPeakRateEnabled(*v) } return _u } // SetPeakStart sets the "peak_start" field. func (_u *GroupUpdate) SetPeakStart(v string) *GroupUpdate { _u.mutation.SetPeakStart(v) return _u } // SetNillablePeakStart sets the "peak_start" field if the given value is not nil. func (_u *GroupUpdate) SetNillablePeakStart(v *string) *GroupUpdate { if v != nil { _u.SetPeakStart(*v) } return _u } // SetPeakEnd sets the "peak_end" field. func (_u *GroupUpdate) SetPeakEnd(v string) *GroupUpdate { _u.mutation.SetPeakEnd(v) return _u } // SetNillablePeakEnd sets the "peak_end" field if the given value is not nil. func (_u *GroupUpdate) SetNillablePeakEnd(v *string) *GroupUpdate { if v != nil { _u.SetPeakEnd(*v) } return _u } // SetPeakRateMultiplier sets the "peak_rate_multiplier" field. func (_u *GroupUpdate) SetPeakRateMultiplier(v float64) *GroupUpdate { _u.mutation.ResetPeakRateMultiplier() _u.mutation.SetPeakRateMultiplier(v) return _u } // SetNillablePeakRateMultiplier sets the "peak_rate_multiplier" field if the given value is not nil. func (_u *GroupUpdate) SetNillablePeakRateMultiplier(v *float64) *GroupUpdate { if v != nil { _u.SetPeakRateMultiplier(*v) } return _u } // AddPeakRateMultiplier adds value to the "peak_rate_multiplier" field. func (_u *GroupUpdate) AddPeakRateMultiplier(v float64) *GroupUpdate { _u.mutation.AddPeakRateMultiplier(v) return _u } // SetIsExclusive sets the "is_exclusive" field. func (_u *GroupUpdate) SetIsExclusive(v bool) *GroupUpdate { _u.mutation.SetIsExclusive(v) return _u } // SetNillableIsExclusive sets the "is_exclusive" field if the given value is not nil. func (_u *GroupUpdate) SetNillableIsExclusive(v *bool) *GroupUpdate { if v != nil { _u.SetIsExclusive(*v) } return _u } // SetStatus sets the "status" field. func (_u *GroupUpdate) SetStatus(v string) *GroupUpdate { _u.mutation.SetStatus(v) return _u } // SetNillableStatus sets the "status" field if the given value is not nil. func (_u *GroupUpdate) SetNillableStatus(v *string) *GroupUpdate { if v != nil { _u.SetStatus(*v) } return _u } // SetPlatform sets the "platform" field. func (_u *GroupUpdate) SetPlatform(v string) *GroupUpdate { _u.mutation.SetPlatform(v) return _u } // SetNillablePlatform sets the "platform" field if the given value is not nil. func (_u *GroupUpdate) SetNillablePlatform(v *string) *GroupUpdate { if v != nil { _u.SetPlatform(*v) } return _u } // SetSubscriptionType sets the "subscription_type" field. func (_u *GroupUpdate) SetSubscriptionType(v string) *GroupUpdate { _u.mutation.SetSubscriptionType(v) return _u } // SetNillableSubscriptionType sets the "subscription_type" field if the given value is not nil. func (_u *GroupUpdate) SetNillableSubscriptionType(v *string) *GroupUpdate { if v != nil { _u.SetSubscriptionType(*v) } return _u } // SetDailyLimitUsd sets the "daily_limit_usd" field. func (_u *GroupUpdate) SetDailyLimitUsd(v float64) *GroupUpdate { _u.mutation.ResetDailyLimitUsd() _u.mutation.SetDailyLimitUsd(v) return _u } // SetNillableDailyLimitUsd sets the "daily_limit_usd" field if the given value is not nil. func (_u *GroupUpdate) SetNillableDailyLimitUsd(v *float64) *GroupUpdate { if v != nil { _u.SetDailyLimitUsd(*v) } return _u } // AddDailyLimitUsd adds value to the "daily_limit_usd" field. func (_u *GroupUpdate) AddDailyLimitUsd(v float64) *GroupUpdate { _u.mutation.AddDailyLimitUsd(v) return _u } // ClearDailyLimitUsd clears the value of the "daily_limit_usd" field. func (_u *GroupUpdate) ClearDailyLimitUsd() *GroupUpdate { _u.mutation.ClearDailyLimitUsd() return _u } // SetWeeklyLimitUsd sets the "weekly_limit_usd" field. func (_u *GroupUpdate) SetWeeklyLimitUsd(v float64) *GroupUpdate { _u.mutation.ResetWeeklyLimitUsd() _u.mutation.SetWeeklyLimitUsd(v) return _u } // SetNillableWeeklyLimitUsd sets the "weekly_limit_usd" field if the given value is not nil. func (_u *GroupUpdate) SetNillableWeeklyLimitUsd(v *float64) *GroupUpdate { if v != nil { _u.SetWeeklyLimitUsd(*v) } return _u } // AddWeeklyLimitUsd adds value to the "weekly_limit_usd" field. func (_u *GroupUpdate) AddWeeklyLimitUsd(v float64) *GroupUpdate { _u.mutation.AddWeeklyLimitUsd(v) return _u } // ClearWeeklyLimitUsd clears the value of the "weekly_limit_usd" field. func (_u *GroupUpdate) ClearWeeklyLimitUsd() *GroupUpdate { _u.mutation.ClearWeeklyLimitUsd() return _u } // SetMonthlyLimitUsd sets the "monthly_limit_usd" field. func (_u *GroupUpdate) SetMonthlyLimitUsd(v float64) *GroupUpdate { _u.mutation.ResetMonthlyLimitUsd() _u.mutation.SetMonthlyLimitUsd(v) return _u } // SetNillableMonthlyLimitUsd sets the "monthly_limit_usd" field if the given value is not nil. func (_u *GroupUpdate) SetNillableMonthlyLimitUsd(v *float64) *GroupUpdate { if v != nil { _u.SetMonthlyLimitUsd(*v) } return _u } // AddMonthlyLimitUsd adds value to the "monthly_limit_usd" field. func (_u *GroupUpdate) AddMonthlyLimitUsd(v float64) *GroupUpdate { _u.mutation.AddMonthlyLimitUsd(v) return _u } // ClearMonthlyLimitUsd clears the value of the "monthly_limit_usd" field. func (_u *GroupUpdate) ClearMonthlyLimitUsd() *GroupUpdate { _u.mutation.ClearMonthlyLimitUsd() return _u } // SetDefaultValidityDays sets the "default_validity_days" field. func (_u *GroupUpdate) SetDefaultValidityDays(v int) *GroupUpdate { _u.mutation.ResetDefaultValidityDays() _u.mutation.SetDefaultValidityDays(v) return _u } // SetNillableDefaultValidityDays sets the "default_validity_days" field if the given value is not nil. func (_u *GroupUpdate) SetNillableDefaultValidityDays(v *int) *GroupUpdate { if v != nil { _u.SetDefaultValidityDays(*v) } return _u } // AddDefaultValidityDays adds value to the "default_validity_days" field. func (_u *GroupUpdate) AddDefaultValidityDays(v int) *GroupUpdate { _u.mutation.AddDefaultValidityDays(v) return _u } // SetAllowImageGeneration sets the "allow_image_generation" field. func (_u *GroupUpdate) SetAllowImageGeneration(v bool) *GroupUpdate { _u.mutation.SetAllowImageGeneration(v) return _u } // SetNillableAllowImageGeneration sets the "allow_image_generation" field if the given value is not nil. func (_u *GroupUpdate) SetNillableAllowImageGeneration(v *bool) *GroupUpdate { if v != nil { _u.SetAllowImageGeneration(*v) } return _u } // SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field. func (_u *GroupUpdate) SetAllowBatchImageGeneration(v bool) *GroupUpdate { _u.mutation.SetAllowBatchImageGeneration(v) return _u } // SetNillableAllowBatchImageGeneration sets the "allow_batch_image_generation" field if the given value is not nil. func (_u *GroupUpdate) SetNillableAllowBatchImageGeneration(v *bool) *GroupUpdate { if v != nil { _u.SetAllowBatchImageGeneration(*v) } return _u } // SetImageRateIndependent sets the "image_rate_independent" field. func (_u *GroupUpdate) SetImageRateIndependent(v bool) *GroupUpdate { _u.mutation.SetImageRateIndependent(v) return _u } // SetNillableImageRateIndependent sets the "image_rate_independent" field if the given value is not nil. func (_u *GroupUpdate) SetNillableImageRateIndependent(v *bool) *GroupUpdate { if v != nil { _u.SetImageRateIndependent(*v) } return _u } // SetImageRateMultiplier sets the "image_rate_multiplier" field. func (_u *GroupUpdate) SetImageRateMultiplier(v float64) *GroupUpdate { _u.mutation.ResetImageRateMultiplier() _u.mutation.SetImageRateMultiplier(v) return _u } // SetNillableImageRateMultiplier sets the "image_rate_multiplier" field if the given value is not nil. func (_u *GroupUpdate) SetNillableImageRateMultiplier(v *float64) *GroupUpdate { if v != nil { _u.SetImageRateMultiplier(*v) } return _u } // AddImageRateMultiplier adds value to the "image_rate_multiplier" field. func (_u *GroupUpdate) AddImageRateMultiplier(v float64) *GroupUpdate { _u.mutation.AddImageRateMultiplier(v) return _u } // SetImagePrice1k sets the "image_price_1k" field. func (_u *GroupUpdate) SetImagePrice1k(v float64) *GroupUpdate { _u.mutation.ResetImagePrice1k() _u.mutation.SetImagePrice1k(v) return _u } // SetNillableImagePrice1k sets the "image_price_1k" field if the given value is not nil. func (_u *GroupUpdate) SetNillableImagePrice1k(v *float64) *GroupUpdate { if v != nil { _u.SetImagePrice1k(*v) } return _u } // AddImagePrice1k adds value to the "image_price_1k" field. func (_u *GroupUpdate) AddImagePrice1k(v float64) *GroupUpdate { _u.mutation.AddImagePrice1k(v) return _u } // ClearImagePrice1k clears the value of the "image_price_1k" field. func (_u *GroupUpdate) ClearImagePrice1k() *GroupUpdate { _u.mutation.ClearImagePrice1k() return _u } // SetImagePrice2k sets the "image_price_2k" field. func (_u *GroupUpdate) SetImagePrice2k(v float64) *GroupUpdate { _u.mutation.ResetImagePrice2k() _u.mutation.SetImagePrice2k(v) return _u } // SetNillableImagePrice2k sets the "image_price_2k" field if the given value is not nil. func (_u *GroupUpdate) SetNillableImagePrice2k(v *float64) *GroupUpdate { if v != nil { _u.SetImagePrice2k(*v) } return _u } // AddImagePrice2k adds value to the "image_price_2k" field. func (_u *GroupUpdate) AddImagePrice2k(v float64) *GroupUpdate { _u.mutation.AddImagePrice2k(v) return _u } // ClearImagePrice2k clears the value of the "image_price_2k" field. func (_u *GroupUpdate) ClearImagePrice2k() *GroupUpdate { _u.mutation.ClearImagePrice2k() return _u } // SetImagePrice4k sets the "image_price_4k" field. func (_u *GroupUpdate) SetImagePrice4k(v float64) *GroupUpdate { _u.mutation.ResetImagePrice4k() _u.mutation.SetImagePrice4k(v) return _u } // SetNillableImagePrice4k sets the "image_price_4k" field if the given value is not nil. func (_u *GroupUpdate) SetNillableImagePrice4k(v *float64) *GroupUpdate { if v != nil { _u.SetImagePrice4k(*v) } return _u } // AddImagePrice4k adds value to the "image_price_4k" field. func (_u *GroupUpdate) AddImagePrice4k(v float64) *GroupUpdate { _u.mutation.AddImagePrice4k(v) return _u } // ClearImagePrice4k clears the value of the "image_price_4k" field. func (_u *GroupUpdate) ClearImagePrice4k() *GroupUpdate { _u.mutation.ClearImagePrice4k() return _u } // SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field. func (_u *GroupUpdate) SetBatchImageDiscountMultiplier(v float64) *GroupUpdate { _u.mutation.ResetBatchImageDiscountMultiplier() _u.mutation.SetBatchImageDiscountMultiplier(v) return _u } // SetNillableBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field if the given value is not nil. func (_u *GroupUpdate) SetNillableBatchImageDiscountMultiplier(v *float64) *GroupUpdate { if v != nil { _u.SetBatchImageDiscountMultiplier(*v) } return _u } // AddBatchImageDiscountMultiplier adds value to the "batch_image_discount_multiplier" field. func (_u *GroupUpdate) AddBatchImageDiscountMultiplier(v float64) *GroupUpdate { _u.mutation.AddBatchImageDiscountMultiplier(v) return _u } // SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field. func (_u *GroupUpdate) SetBatchImageHoldMultiplier(v float64) *GroupUpdate { _u.mutation.ResetBatchImageHoldMultiplier() _u.mutation.SetBatchImageHoldMultiplier(v) return _u } // SetNillableBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field if the given value is not nil. func (_u *GroupUpdate) SetNillableBatchImageHoldMultiplier(v *float64) *GroupUpdate { if v != nil { _u.SetBatchImageHoldMultiplier(*v) } return _u } // AddBatchImageHoldMultiplier adds value to the "batch_image_hold_multiplier" field. func (_u *GroupUpdate) AddBatchImageHoldMultiplier(v float64) *GroupUpdate { _u.mutation.AddBatchImageHoldMultiplier(v) return _u } // SetVideoRateIndependent sets the "video_rate_independent" field. func (_u *GroupUpdate) SetVideoRateIndependent(v bool) *GroupUpdate { _u.mutation.SetVideoRateIndependent(v) return _u } // SetNillableVideoRateIndependent sets the "video_rate_independent" field if the given value is not nil. func (_u *GroupUpdate) SetNillableVideoRateIndependent(v *bool) *GroupUpdate { if v != nil { _u.SetVideoRateIndependent(*v) } return _u } // SetVideoRateMultiplier sets the "video_rate_multiplier" field. func (_u *GroupUpdate) SetVideoRateMultiplier(v float64) *GroupUpdate { _u.mutation.ResetVideoRateMultiplier() _u.mutation.SetVideoRateMultiplier(v) return _u } // SetNillableVideoRateMultiplier sets the "video_rate_multiplier" field if the given value is not nil. func (_u *GroupUpdate) SetNillableVideoRateMultiplier(v *float64) *GroupUpdate { if v != nil { _u.SetVideoRateMultiplier(*v) } return _u } // AddVideoRateMultiplier adds value to the "video_rate_multiplier" field. func (_u *GroupUpdate) AddVideoRateMultiplier(v float64) *GroupUpdate { _u.mutation.AddVideoRateMultiplier(v) return _u } // SetVideoPrice480p sets the "video_price_480p" field. func (_u *GroupUpdate) SetVideoPrice480p(v float64) *GroupUpdate { _u.mutation.ResetVideoPrice480p() _u.mutation.SetVideoPrice480p(v) return _u } // SetNillableVideoPrice480p sets the "video_price_480p" field if the given value is not nil. func (_u *GroupUpdate) SetNillableVideoPrice480p(v *float64) *GroupUpdate { if v != nil { _u.SetVideoPrice480p(*v) } return _u } // AddVideoPrice480p adds value to the "video_price_480p" field. func (_u *GroupUpdate) AddVideoPrice480p(v float64) *GroupUpdate { _u.mutation.AddVideoPrice480p(v) return _u } // ClearVideoPrice480p clears the value of the "video_price_480p" field. func (_u *GroupUpdate) ClearVideoPrice480p() *GroupUpdate { _u.mutation.ClearVideoPrice480p() return _u } // SetVideoPrice720p sets the "video_price_720p" field. func (_u *GroupUpdate) SetVideoPrice720p(v float64) *GroupUpdate { _u.mutation.ResetVideoPrice720p() _u.mutation.SetVideoPrice720p(v) return _u } // SetNillableVideoPrice720p sets the "video_price_720p" field if the given value is not nil. func (_u *GroupUpdate) SetNillableVideoPrice720p(v *float64) *GroupUpdate { if v != nil { _u.SetVideoPrice720p(*v) } return _u } // AddVideoPrice720p adds value to the "video_price_720p" field. func (_u *GroupUpdate) AddVideoPrice720p(v float64) *GroupUpdate { _u.mutation.AddVideoPrice720p(v) return _u } // ClearVideoPrice720p clears the value of the "video_price_720p" field. func (_u *GroupUpdate) ClearVideoPrice720p() *GroupUpdate { _u.mutation.ClearVideoPrice720p() return _u } // SetVideoPrice1080p sets the "video_price_1080p" field. func (_u *GroupUpdate) SetVideoPrice1080p(v float64) *GroupUpdate { _u.mutation.ResetVideoPrice1080p() _u.mutation.SetVideoPrice1080p(v) return _u } // SetNillableVideoPrice1080p sets the "video_price_1080p" field if the given value is not nil. func (_u *GroupUpdate) SetNillableVideoPrice1080p(v *float64) *GroupUpdate { if v != nil { _u.SetVideoPrice1080p(*v) } return _u } // AddVideoPrice1080p adds value to the "video_price_1080p" field. func (_u *GroupUpdate) AddVideoPrice1080p(v float64) *GroupUpdate { _u.mutation.AddVideoPrice1080p(v) return _u } // ClearVideoPrice1080p clears the value of the "video_price_1080p" field. func (_u *GroupUpdate) ClearVideoPrice1080p() *GroupUpdate { _u.mutation.ClearVideoPrice1080p() return _u } // SetVideoModelPrices sets the "video_model_prices" field. func (_u *GroupUpdate) SetVideoModelPrices(v map[string]map[string]float64) *GroupUpdate { _u.mutation.SetVideoModelPrices(v) return _u } // ClearVideoModelPrices clears the value of the "video_model_prices" field. func (_u *GroupUpdate) ClearVideoModelPrices() *GroupUpdate { _u.mutation.ClearVideoModelPrices() return _u } // SetWebSearchPricePerCall sets the "web_search_price_per_call" field. func (_u *GroupUpdate) SetWebSearchPricePerCall(v float64) *GroupUpdate { _u.mutation.ResetWebSearchPricePerCall() _u.mutation.SetWebSearchPricePerCall(v) return _u } // SetNillableWebSearchPricePerCall sets the "web_search_price_per_call" field if the given value is not nil. func (_u *GroupUpdate) SetNillableWebSearchPricePerCall(v *float64) *GroupUpdate { if v != nil { _u.SetWebSearchPricePerCall(*v) } return _u } // AddWebSearchPricePerCall adds value to the "web_search_price_per_call" field. func (_u *GroupUpdate) AddWebSearchPricePerCall(v float64) *GroupUpdate { _u.mutation.AddWebSearchPricePerCall(v) return _u } // ClearWebSearchPricePerCall clears the value of the "web_search_price_per_call" field. func (_u *GroupUpdate) ClearWebSearchPricePerCall() *GroupUpdate { _u.mutation.ClearWebSearchPricePerCall() return _u } // SetSearchPricePer1k sets the "search_price_per_1k" field. func (_u *GroupUpdate) SetSearchPricePer1k(v float64) *GroupUpdate { _u.mutation.ResetSearchPricePer1k() _u.mutation.SetSearchPricePer1k(v) return _u } // SetNillableSearchPricePer1k sets the "search_price_per_1k" field if the given value is not nil. func (_u *GroupUpdate) SetNillableSearchPricePer1k(v *float64) *GroupUpdate { if v != nil { _u.SetSearchPricePer1k(*v) } return _u } // AddSearchPricePer1k adds value to the "search_price_per_1k" field. func (_u *GroupUpdate) AddSearchPricePer1k(v float64) *GroupUpdate { _u.mutation.AddSearchPricePer1k(v) return _u } // ClearSearchPricePer1k clears the value of the "search_price_per_1k" field. func (_u *GroupUpdate) ClearSearchPricePer1k() *GroupUpdate { _u.mutation.ClearSearchPricePer1k() return _u } // SetAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field. func (_u *GroupUpdate) SetAudioRealtimePricePerMin(v float64) *GroupUpdate { _u.mutation.ResetAudioRealtimePricePerMin() _u.mutation.SetAudioRealtimePricePerMin(v) return _u } // SetNillableAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field if the given value is not nil. func (_u *GroupUpdate) SetNillableAudioRealtimePricePerMin(v *float64) *GroupUpdate { if v != nil { _u.SetAudioRealtimePricePerMin(*v) } return _u } // AddAudioRealtimePricePerMin adds value to the "audio_realtime_price_per_min" field. func (_u *GroupUpdate) AddAudioRealtimePricePerMin(v float64) *GroupUpdate { _u.mutation.AddAudioRealtimePricePerMin(v) return _u } // ClearAudioRealtimePricePerMin clears the value of the "audio_realtime_price_per_min" field. func (_u *GroupUpdate) ClearAudioRealtimePricePerMin() *GroupUpdate { _u.mutation.ClearAudioRealtimePricePerMin() return _u } // SetAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field. func (_u *GroupUpdate) SetAudioTtsPricePerMillionChars(v float64) *GroupUpdate { _u.mutation.ResetAudioTtsPricePerMillionChars() _u.mutation.SetAudioTtsPricePerMillionChars(v) return _u } // SetNillableAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field if the given value is not nil. func (_u *GroupUpdate) SetNillableAudioTtsPricePerMillionChars(v *float64) *GroupUpdate { if v != nil { _u.SetAudioTtsPricePerMillionChars(*v) } return _u } // AddAudioTtsPricePerMillionChars adds value to the "audio_tts_price_per_million_chars" field. func (_u *GroupUpdate) AddAudioTtsPricePerMillionChars(v float64) *GroupUpdate { _u.mutation.AddAudioTtsPricePerMillionChars(v) return _u } // ClearAudioTtsPricePerMillionChars clears the value of the "audio_tts_price_per_million_chars" field. func (_u *GroupUpdate) ClearAudioTtsPricePerMillionChars() *GroupUpdate { _u.mutation.ClearAudioTtsPricePerMillionChars() return _u } // SetAudioSttPricePerHour sets the "audio_stt_price_per_hour" field. func (_u *GroupUpdate) SetAudioSttPricePerHour(v float64) *GroupUpdate { _u.mutation.ResetAudioSttPricePerHour() _u.mutation.SetAudioSttPricePerHour(v) return _u } // SetNillableAudioSttPricePerHour sets the "audio_stt_price_per_hour" field if the given value is not nil. func (_u *GroupUpdate) SetNillableAudioSttPricePerHour(v *float64) *GroupUpdate { if v != nil { _u.SetAudioSttPricePerHour(*v) } return _u } // AddAudioSttPricePerHour adds value to the "audio_stt_price_per_hour" field. func (_u *GroupUpdate) AddAudioSttPricePerHour(v float64) *GroupUpdate { _u.mutation.AddAudioSttPricePerHour(v) return _u } // ClearAudioSttPricePerHour clears the value of the "audio_stt_price_per_hour" field. func (_u *GroupUpdate) ClearAudioSttPricePerHour() *GroupUpdate { _u.mutation.ClearAudioSttPricePerHour() return _u } // SetLongContextPricingEnabled sets the "long_context_pricing_enabled" field. func (_u *GroupUpdate) SetLongContextPricingEnabled(v bool) *GroupUpdate { _u.mutation.SetLongContextPricingEnabled(v) return _u } // SetNillableLongContextPricingEnabled sets the "long_context_pricing_enabled" field if the given value is not nil. func (_u *GroupUpdate) SetNillableLongContextPricingEnabled(v *bool) *GroupUpdate { if v != nil { _u.SetLongContextPricingEnabled(*v) } return _u } // SetModelPricing sets the "model_pricing" field. func (_u *GroupUpdate) SetModelPricing(v json.RawMessage) *GroupUpdate { _u.mutation.SetModelPricing(v) return _u } // AppendModelPricing appends value to the "model_pricing" field. func (_u *GroupUpdate) AppendModelPricing(v json.RawMessage) *GroupUpdate { _u.mutation.AppendModelPricing(v) return _u } // ClearModelPricing clears the value of the "model_pricing" field. func (_u *GroupUpdate) ClearModelPricing() *GroupUpdate { _u.mutation.ClearModelPricing() return _u } // SetClaudeCodeOnly sets the "claude_code_only" field. func (_u *GroupUpdate) SetClaudeCodeOnly(v bool) *GroupUpdate { _u.mutation.SetClaudeCodeOnly(v) return _u } // SetNillableClaudeCodeOnly sets the "claude_code_only" field if the given value is not nil. func (_u *GroupUpdate) SetNillableClaudeCodeOnly(v *bool) *GroupUpdate { if v != nil { _u.SetClaudeCodeOnly(*v) } return _u } // SetFallbackGroupID sets the "fallback_group_id" field. func (_u *GroupUpdate) SetFallbackGroupID(v int64) *GroupUpdate { _u.mutation.ResetFallbackGroupID() _u.mutation.SetFallbackGroupID(v) return _u } // SetNillableFallbackGroupID sets the "fallback_group_id" field if the given value is not nil. func (_u *GroupUpdate) SetNillableFallbackGroupID(v *int64) *GroupUpdate { if v != nil { _u.SetFallbackGroupID(*v) } return _u } // AddFallbackGroupID adds value to the "fallback_group_id" field. func (_u *GroupUpdate) AddFallbackGroupID(v int64) *GroupUpdate { _u.mutation.AddFallbackGroupID(v) return _u } // ClearFallbackGroupID clears the value of the "fallback_group_id" field. func (_u *GroupUpdate) ClearFallbackGroupID() *GroupUpdate { _u.mutation.ClearFallbackGroupID() return _u } // SetFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field. func (_u *GroupUpdate) SetFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdate { _u.mutation.ResetFallbackGroupIDOnInvalidRequest() _u.mutation.SetFallbackGroupIDOnInvalidRequest(v) return _u } // SetNillableFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field if the given value is not nil. func (_u *GroupUpdate) SetNillableFallbackGroupIDOnInvalidRequest(v *int64) *GroupUpdate { if v != nil { _u.SetFallbackGroupIDOnInvalidRequest(*v) } return _u } // AddFallbackGroupIDOnInvalidRequest adds value to the "fallback_group_id_on_invalid_request" field. func (_u *GroupUpdate) AddFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdate { _u.mutation.AddFallbackGroupIDOnInvalidRequest(v) return _u } // ClearFallbackGroupIDOnInvalidRequest clears the value of the "fallback_group_id_on_invalid_request" field. func (_u *GroupUpdate) ClearFallbackGroupIDOnInvalidRequest() *GroupUpdate { _u.mutation.ClearFallbackGroupIDOnInvalidRequest() return _u } // SetModelRouting sets the "model_routing" field. func (_u *GroupUpdate) SetModelRouting(v map[string][]int64) *GroupUpdate { _u.mutation.SetModelRouting(v) return _u } // ClearModelRouting clears the value of the "model_routing" field. func (_u *GroupUpdate) ClearModelRouting() *GroupUpdate { _u.mutation.ClearModelRouting() return _u } // SetModelRoutingEnabled sets the "model_routing_enabled" field. func (_u *GroupUpdate) SetModelRoutingEnabled(v bool) *GroupUpdate { _u.mutation.SetModelRoutingEnabled(v) return _u } // SetNillableModelRoutingEnabled sets the "model_routing_enabled" field if the given value is not nil. func (_u *GroupUpdate) SetNillableModelRoutingEnabled(v *bool) *GroupUpdate { if v != nil { _u.SetModelRoutingEnabled(*v) } return _u } // SetMcpXMLInject sets the "mcp_xml_inject" field. func (_u *GroupUpdate) SetMcpXMLInject(v bool) *GroupUpdate { _u.mutation.SetMcpXMLInject(v) return _u } // SetNillableMcpXMLInject sets the "mcp_xml_inject" field if the given value is not nil. func (_u *GroupUpdate) SetNillableMcpXMLInject(v *bool) *GroupUpdate { if v != nil { _u.SetMcpXMLInject(*v) } return _u } // SetSupportedModelScopes sets the "supported_model_scopes" field. func (_u *GroupUpdate) SetSupportedModelScopes(v []string) *GroupUpdate { _u.mutation.SetSupportedModelScopes(v) return _u } // AppendSupportedModelScopes appends value to the "supported_model_scopes" field. func (_u *GroupUpdate) AppendSupportedModelScopes(v []string) *GroupUpdate { _u.mutation.AppendSupportedModelScopes(v) return _u } // SetSortOrder sets the "sort_order" field. func (_u *GroupUpdate) SetSortOrder(v int) *GroupUpdate { _u.mutation.ResetSortOrder() _u.mutation.SetSortOrder(v) return _u } // SetNillableSortOrder sets the "sort_order" field if the given value is not nil. func (_u *GroupUpdate) SetNillableSortOrder(v *int) *GroupUpdate { if v != nil { _u.SetSortOrder(*v) } return _u } // AddSortOrder adds value to the "sort_order" field. func (_u *GroupUpdate) AddSortOrder(v int) *GroupUpdate { _u.mutation.AddSortOrder(v) return _u } // SetAllowMessagesDispatch sets the "allow_messages_dispatch" field. func (_u *GroupUpdate) SetAllowMessagesDispatch(v bool) *GroupUpdate { _u.mutation.SetAllowMessagesDispatch(v) return _u } // SetNillableAllowMessagesDispatch sets the "allow_messages_dispatch" field if the given value is not nil. func (_u *GroupUpdate) SetNillableAllowMessagesDispatch(v *bool) *GroupUpdate { if v != nil { _u.SetAllowMessagesDispatch(*v) } return _u } // SetAllowLive sets the "allow_live" field. func (_u *GroupUpdate) SetAllowLive(v bool) *GroupUpdate { _u.mutation.SetAllowLive(v) return _u } // SetNillableAllowLive sets the "allow_live" field if the given value is not nil. func (_u *GroupUpdate) SetNillableAllowLive(v *bool) *GroupUpdate { if v != nil { _u.SetAllowLive(*v) } return _u } // SetRequireOauthOnly sets the "require_oauth_only" field. func (_u *GroupUpdate) SetRequireOauthOnly(v bool) *GroupUpdate { _u.mutation.SetRequireOauthOnly(v) return _u } // SetNillableRequireOauthOnly sets the "require_oauth_only" field if the given value is not nil. func (_u *GroupUpdate) SetNillableRequireOauthOnly(v *bool) *GroupUpdate { if v != nil { _u.SetRequireOauthOnly(*v) } return _u } // SetRequirePrivacySet sets the "require_privacy_set" field. func (_u *GroupUpdate) SetRequirePrivacySet(v bool) *GroupUpdate { _u.mutation.SetRequirePrivacySet(v) return _u } // SetNillableRequirePrivacySet sets the "require_privacy_set" field if the given value is not nil. func (_u *GroupUpdate) SetNillableRequirePrivacySet(v *bool) *GroupUpdate { if v != nil { _u.SetRequirePrivacySet(*v) } return _u } // SetDefaultMappedModel sets the "default_mapped_model" field. func (_u *GroupUpdate) SetDefaultMappedModel(v string) *GroupUpdate { _u.mutation.SetDefaultMappedModel(v) return _u } // SetNillableDefaultMappedModel sets the "default_mapped_model" field if the given value is not nil. func (_u *GroupUpdate) SetNillableDefaultMappedModel(v *string) *GroupUpdate { if v != nil { _u.SetDefaultMappedModel(*v) } return _u } // SetMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field. func (_u *GroupUpdate) SetMessagesDispatchModelConfig(v domain.OpenAIMessagesDispatchModelConfig) *GroupUpdate { _u.mutation.SetMessagesDispatchModelConfig(v) return _u } // SetNillableMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field if the given value is not nil. func (_u *GroupUpdate) SetNillableMessagesDispatchModelConfig(v *domain.OpenAIMessagesDispatchModelConfig) *GroupUpdate { if v != nil { _u.SetMessagesDispatchModelConfig(*v) } return _u } // SetModelsListConfig sets the "models_list_config" field. func (_u *GroupUpdate) SetModelsListConfig(v domain.GroupModelsListConfig) *GroupUpdate { _u.mutation.SetModelsListConfig(v) return _u } // SetNillableModelsListConfig sets the "models_list_config" field if the given value is not nil. func (_u *GroupUpdate) SetNillableModelsListConfig(v *domain.GroupModelsListConfig) *GroupUpdate { if v != nil { _u.SetModelsListConfig(*v) } return _u } // SetRpmLimit sets the "rpm_limit" field. func (_u *GroupUpdate) SetRpmLimit(v int) *GroupUpdate { _u.mutation.ResetRpmLimit() _u.mutation.SetRpmLimit(v) return _u } // SetNillableRpmLimit sets the "rpm_limit" field if the given value is not nil. func (_u *GroupUpdate) SetNillableRpmLimit(v *int) *GroupUpdate { if v != nil { _u.SetRpmLimit(*v) } return _u } // AddRpmLimit adds value to the "rpm_limit" field. func (_u *GroupUpdate) AddRpmLimit(v int) *GroupUpdate { _u.mutation.AddRpmLimit(v) return _u } // SetMaxReasoningEffort sets the "max_reasoning_effort" field. func (_u *GroupUpdate) SetMaxReasoningEffort(v string) *GroupUpdate { _u.mutation.SetMaxReasoningEffort(v) return _u } // SetNillableMaxReasoningEffort sets the "max_reasoning_effort" field if the given value is not nil. func (_u *GroupUpdate) SetNillableMaxReasoningEffort(v *string) *GroupUpdate { if v != nil { _u.SetMaxReasoningEffort(*v) } return _u } // SetReasoningEffortMappings sets the "reasoning_effort_mappings" field. func (_u *GroupUpdate) SetReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdate { _u.mutation.SetReasoningEffortMappings(v) return _u } // AppendReasoningEffortMappings appends value to the "reasoning_effort_mappings" field. func (_u *GroupUpdate) AppendReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdate { _u.mutation.AppendReasoningEffortMappings(v) return _u } // SetProfitControlEnabled sets the "profit_control_enabled" field. func (_u *GroupUpdate) SetProfitControlEnabled(v bool) *GroupUpdate { _u.mutation.SetProfitControlEnabled(v) return _u } // SetNillableProfitControlEnabled sets the "profit_control_enabled" field if the given value is not nil. func (_u *GroupUpdate) SetNillableProfitControlEnabled(v *bool) *GroupUpdate { if v != nil { _u.SetProfitControlEnabled(*v) } return _u } // SetProfitMinMargin sets the "profit_min_margin" field. func (_u *GroupUpdate) SetProfitMinMargin(v float64) *GroupUpdate { _u.mutation.ResetProfitMinMargin() _u.mutation.SetProfitMinMargin(v) return _u } // SetNillableProfitMinMargin sets the "profit_min_margin" field if the given value is not nil. func (_u *GroupUpdate) SetNillableProfitMinMargin(v *float64) *GroupUpdate { if v != nil { _u.SetProfitMinMargin(*v) } return _u } // AddProfitMinMargin adds value to the "profit_min_margin" field. func (_u *GroupUpdate) AddProfitMinMargin(v float64) *GroupUpdate { _u.mutation.AddProfitMinMargin(v) return _u } // SetProfitSafetyBuffer sets the "profit_safety_buffer" field. func (_u *GroupUpdate) SetProfitSafetyBuffer(v float64) *GroupUpdate { _u.mutation.ResetProfitSafetyBuffer() _u.mutation.SetProfitSafetyBuffer(v) return _u } // SetNillableProfitSafetyBuffer sets the "profit_safety_buffer" field if the given value is not nil. func (_u *GroupUpdate) SetNillableProfitSafetyBuffer(v *float64) *GroupUpdate { if v != nil { _u.SetProfitSafetyBuffer(*v) } return _u } // AddProfitSafetyBuffer adds value to the "profit_safety_buffer" field. func (_u *GroupUpdate) AddProfitSafetyBuffer(v float64) *GroupUpdate { _u.mutation.AddProfitSafetyBuffer(v) return _u } // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs. func (_u *GroupUpdate) AddAPIKeyIDs(ids ...int64) *GroupUpdate { _u.mutation.AddAPIKeyIDs(ids...) return _u } // AddAPIKeys adds the "api_keys" edges to the APIKey entity. func (_u *GroupUpdate) AddAPIKeys(v ...*APIKey) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAPIKeyIDs(ids...) } // AddRedeemCodeIDs adds the "redeem_codes" edge to the RedeemCode entity by IDs. func (_u *GroupUpdate) AddRedeemCodeIDs(ids ...int64) *GroupUpdate { _u.mutation.AddRedeemCodeIDs(ids...) return _u } // AddRedeemCodes adds the "redeem_codes" edges to the RedeemCode entity. func (_u *GroupUpdate) AddRedeemCodes(v ...*RedeemCode) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddRedeemCodeIDs(ids...) } // AddSubscriptionIDs adds the "subscriptions" edge to the UserSubscription entity by IDs. func (_u *GroupUpdate) AddSubscriptionIDs(ids ...int64) *GroupUpdate { _u.mutation.AddSubscriptionIDs(ids...) return _u } // AddSubscriptions adds the "subscriptions" edges to the UserSubscription entity. func (_u *GroupUpdate) AddSubscriptions(v ...*UserSubscription) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSubscriptionIDs(ids...) } // AddUsageLogIDs adds the "usage_logs" edge to the UsageLog entity by IDs. func (_u *GroupUpdate) AddUsageLogIDs(ids ...int64) *GroupUpdate { _u.mutation.AddUsageLogIDs(ids...) return _u } // AddUsageLogs adds the "usage_logs" edges to the UsageLog entity. func (_u *GroupUpdate) AddUsageLogs(v ...*UsageLog) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddUsageLogIDs(ids...) } // AddAccountIDs adds the "accounts" edge to the Account entity by IDs. func (_u *GroupUpdate) AddAccountIDs(ids ...int64) *GroupUpdate { _u.mutation.AddAccountIDs(ids...) return _u } // AddAccounts adds the "accounts" edges to the Account entity. func (_u *GroupUpdate) AddAccounts(v ...*Account) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAccountIDs(ids...) } // AddAllowedUserIDs adds the "allowed_users" edge to the User entity by IDs. func (_u *GroupUpdate) AddAllowedUserIDs(ids ...int64) *GroupUpdate { _u.mutation.AddAllowedUserIDs(ids...) return _u } // AddAllowedUsers adds the "allowed_users" edges to the User entity. func (_u *GroupUpdate) AddAllowedUsers(v ...*User) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAllowedUserIDs(ids...) } // Mutation returns the GroupMutation object of the builder. func (_u *GroupUpdate) Mutation() *GroupMutation { return _u.mutation } // ClearAPIKeys clears all "api_keys" edges to the APIKey entity. func (_u *GroupUpdate) ClearAPIKeys() *GroupUpdate { _u.mutation.ClearAPIKeys() return _u } // RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs. func (_u *GroupUpdate) RemoveAPIKeyIDs(ids ...int64) *GroupUpdate { _u.mutation.RemoveAPIKeyIDs(ids...) return _u } // RemoveAPIKeys removes "api_keys" edges to APIKey entities. func (_u *GroupUpdate) RemoveAPIKeys(v ...*APIKey) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAPIKeyIDs(ids...) } // ClearRedeemCodes clears all "redeem_codes" edges to the RedeemCode entity. func (_u *GroupUpdate) ClearRedeemCodes() *GroupUpdate { _u.mutation.ClearRedeemCodes() return _u } // RemoveRedeemCodeIDs removes the "redeem_codes" edge to RedeemCode entities by IDs. func (_u *GroupUpdate) RemoveRedeemCodeIDs(ids ...int64) *GroupUpdate { _u.mutation.RemoveRedeemCodeIDs(ids...) return _u } // RemoveRedeemCodes removes "redeem_codes" edges to RedeemCode entities. func (_u *GroupUpdate) RemoveRedeemCodes(v ...*RedeemCode) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveRedeemCodeIDs(ids...) } // ClearSubscriptions clears all "subscriptions" edges to the UserSubscription entity. func (_u *GroupUpdate) ClearSubscriptions() *GroupUpdate { _u.mutation.ClearSubscriptions() return _u } // RemoveSubscriptionIDs removes the "subscriptions" edge to UserSubscription entities by IDs. func (_u *GroupUpdate) RemoveSubscriptionIDs(ids ...int64) *GroupUpdate { _u.mutation.RemoveSubscriptionIDs(ids...) return _u } // RemoveSubscriptions removes "subscriptions" edges to UserSubscription entities. func (_u *GroupUpdate) RemoveSubscriptions(v ...*UserSubscription) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSubscriptionIDs(ids...) } // ClearUsageLogs clears all "usage_logs" edges to the UsageLog entity. func (_u *GroupUpdate) ClearUsageLogs() *GroupUpdate { _u.mutation.ClearUsageLogs() return _u } // RemoveUsageLogIDs removes the "usage_logs" edge to UsageLog entities by IDs. func (_u *GroupUpdate) RemoveUsageLogIDs(ids ...int64) *GroupUpdate { _u.mutation.RemoveUsageLogIDs(ids...) return _u } // RemoveUsageLogs removes "usage_logs" edges to UsageLog entities. func (_u *GroupUpdate) RemoveUsageLogs(v ...*UsageLog) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveUsageLogIDs(ids...) } // ClearAccounts clears all "accounts" edges to the Account entity. func (_u *GroupUpdate) ClearAccounts() *GroupUpdate { _u.mutation.ClearAccounts() return _u } // RemoveAccountIDs removes the "accounts" edge to Account entities by IDs. func (_u *GroupUpdate) RemoveAccountIDs(ids ...int64) *GroupUpdate { _u.mutation.RemoveAccountIDs(ids...) return _u } // RemoveAccounts removes "accounts" edges to Account entities. func (_u *GroupUpdate) RemoveAccounts(v ...*Account) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAccountIDs(ids...) } // ClearAllowedUsers clears all "allowed_users" edges to the User entity. func (_u *GroupUpdate) ClearAllowedUsers() *GroupUpdate { _u.mutation.ClearAllowedUsers() return _u } // RemoveAllowedUserIDs removes the "allowed_users" edge to User entities by IDs. func (_u *GroupUpdate) RemoveAllowedUserIDs(ids ...int64) *GroupUpdate { _u.mutation.RemoveAllowedUserIDs(ids...) return _u } // RemoveAllowedUsers removes "allowed_users" edges to User entities. func (_u *GroupUpdate) RemoveAllowedUsers(v ...*User) *GroupUpdate { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAllowedUserIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *GroupUpdate) Save(ctx context.Context) (int, error) { if err := _u.defaults(); err != nil { return 0, err } return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *GroupUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *GroupUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *GroupUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_u *GroupUpdate) defaults() error { if _, ok := _u.mutation.UpdatedAt(); !ok { if group.UpdateDefaultUpdatedAt == nil { return fmt.Errorf("ent: uninitialized group.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)") } v := group.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) } return nil } // check runs all checks and user-defined validators on the builder. func (_u *GroupUpdate) check() error { if v, ok := _u.mutation.Name(); ok { if err := group.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Group.name": %w`, err)} } } if v, ok := _u.mutation.PeakStart(); ok { if err := group.PeakStartValidator(v); err != nil { return &ValidationError{Name: "peak_start", err: fmt.Errorf(`ent: validator failed for field "Group.peak_start": %w`, err)} } } if v, ok := _u.mutation.PeakEnd(); ok { if err := group.PeakEndValidator(v); err != nil { return &ValidationError{Name: "peak_end", err: fmt.Errorf(`ent: validator failed for field "Group.peak_end": %w`, err)} } } if v, ok := _u.mutation.Status(); ok { if err := group.StatusValidator(v); err != nil { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Group.status": %w`, err)} } } if v, ok := _u.mutation.Platform(); ok { if err := group.PlatformValidator(v); err != nil { return &ValidationError{Name: "platform", err: fmt.Errorf(`ent: validator failed for field "Group.platform": %w`, err)} } } if v, ok := _u.mutation.SubscriptionType(); ok { if err := group.SubscriptionTypeValidator(v); err != nil { return &ValidationError{Name: "subscription_type", err: fmt.Errorf(`ent: validator failed for field "Group.subscription_type": %w`, err)} } } if v, ok := _u.mutation.SearchPricePer1k(); ok { if err := group.SearchPricePer1kValidator(v); err != nil { return &ValidationError{Name: "search_price_per_1k", err: fmt.Errorf(`ent: validator failed for field "Group.search_price_per_1k": %w`, err)} } } if v, ok := _u.mutation.AudioRealtimePricePerMin(); ok { if err := group.AudioRealtimePricePerMinValidator(v); err != nil { return &ValidationError{Name: "audio_realtime_price_per_min", err: fmt.Errorf(`ent: validator failed for field "Group.audio_realtime_price_per_min": %w`, err)} } } if v, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok { if err := group.AudioTtsPricePerMillionCharsValidator(v); err != nil { return &ValidationError{Name: "audio_tts_price_per_million_chars", err: fmt.Errorf(`ent: validator failed for field "Group.audio_tts_price_per_million_chars": %w`, err)} } } if v, ok := _u.mutation.AudioSttPricePerHour(); ok { if err := group.AudioSttPricePerHourValidator(v); err != nil { return &ValidationError{Name: "audio_stt_price_per_hour", err: fmt.Errorf(`ent: validator failed for field "Group.audio_stt_price_per_hour": %w`, err)} } } if v, ok := _u.mutation.DefaultMappedModel(); ok { if err := group.DefaultMappedModelValidator(v); err != nil { return &ValidationError{Name: "default_mapped_model", err: fmt.Errorf(`ent: validator failed for field "Group.default_mapped_model": %w`, err)} } } if v, ok := _u.mutation.MaxReasoningEffort(); ok { if err := group.MaxReasoningEffortValidator(v); err != nil { return &ValidationError{Name: "max_reasoning_effort", err: fmt.Errorf(`ent: validator failed for field "Group.max_reasoning_effort": %w`, err)} } } return nil } func (_u *GroupUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeInt64)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(group.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(group.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(group.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.Name(); ok { _spec.SetField(group.FieldName, field.TypeString, value) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(group.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(group.FieldDescription, field.TypeString) } if value, ok := _u.mutation.RateMultiplier(); ok { _spec.SetField(group.FieldRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedRateMultiplier(); ok { _spec.AddField(group.FieldRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.PeakRateEnabled(); ok { _spec.SetField(group.FieldPeakRateEnabled, field.TypeBool, value) } if value, ok := _u.mutation.PeakStart(); ok { _spec.SetField(group.FieldPeakStart, field.TypeString, value) } if value, ok := _u.mutation.PeakEnd(); ok { _spec.SetField(group.FieldPeakEnd, field.TypeString, value) } if value, ok := _u.mutation.PeakRateMultiplier(); ok { _spec.SetField(group.FieldPeakRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedPeakRateMultiplier(); ok { _spec.AddField(group.FieldPeakRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.IsExclusive(); ok { _spec.SetField(group.FieldIsExclusive, field.TypeBool, value) } if value, ok := _u.mutation.Status(); ok { _spec.SetField(group.FieldStatus, field.TypeString, value) } if _u.mutation.DuplicateOperationIDCleared() { _spec.ClearField(group.FieldDuplicateOperationID, field.TypeString) } if value, ok := _u.mutation.Platform(); ok { _spec.SetField(group.FieldPlatform, field.TypeString, value) } if value, ok := _u.mutation.SubscriptionType(); ok { _spec.SetField(group.FieldSubscriptionType, field.TypeString, value) } if value, ok := _u.mutation.DailyLimitUsd(); ok { _spec.SetField(group.FieldDailyLimitUsd, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedDailyLimitUsd(); ok { _spec.AddField(group.FieldDailyLimitUsd, field.TypeFloat64, value) } if _u.mutation.DailyLimitUsdCleared() { _spec.ClearField(group.FieldDailyLimitUsd, field.TypeFloat64) } if value, ok := _u.mutation.WeeklyLimitUsd(); ok { _spec.SetField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedWeeklyLimitUsd(); ok { _spec.AddField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value) } if _u.mutation.WeeklyLimitUsdCleared() { _spec.ClearField(group.FieldWeeklyLimitUsd, field.TypeFloat64) } if value, ok := _u.mutation.MonthlyLimitUsd(); ok { _spec.SetField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedMonthlyLimitUsd(); ok { _spec.AddField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value) } if _u.mutation.MonthlyLimitUsdCleared() { _spec.ClearField(group.FieldMonthlyLimitUsd, field.TypeFloat64) } if value, ok := _u.mutation.DefaultValidityDays(); ok { _spec.SetField(group.FieldDefaultValidityDays, field.TypeInt, value) } if value, ok := _u.mutation.AddedDefaultValidityDays(); ok { _spec.AddField(group.FieldDefaultValidityDays, field.TypeInt, value) } if value, ok := _u.mutation.AllowImageGeneration(); ok { _spec.SetField(group.FieldAllowImageGeneration, field.TypeBool, value) } if value, ok := _u.mutation.AllowBatchImageGeneration(); ok { _spec.SetField(group.FieldAllowBatchImageGeneration, field.TypeBool, value) } if value, ok := _u.mutation.ImageRateIndependent(); ok { _spec.SetField(group.FieldImageRateIndependent, field.TypeBool, value) } if value, ok := _u.mutation.ImageRateMultiplier(); ok { _spec.SetField(group.FieldImageRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImageRateMultiplier(); ok { _spec.AddField(group.FieldImageRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.ImagePrice1k(); ok { _spec.SetField(group.FieldImagePrice1k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImagePrice1k(); ok { _spec.AddField(group.FieldImagePrice1k, field.TypeFloat64, value) } if _u.mutation.ImagePrice1kCleared() { _spec.ClearField(group.FieldImagePrice1k, field.TypeFloat64) } if value, ok := _u.mutation.ImagePrice2k(); ok { _spec.SetField(group.FieldImagePrice2k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImagePrice2k(); ok { _spec.AddField(group.FieldImagePrice2k, field.TypeFloat64, value) } if _u.mutation.ImagePrice2kCleared() { _spec.ClearField(group.FieldImagePrice2k, field.TypeFloat64) } if value, ok := _u.mutation.ImagePrice4k(); ok { _spec.SetField(group.FieldImagePrice4k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImagePrice4k(); ok { _spec.AddField(group.FieldImagePrice4k, field.TypeFloat64, value) } if _u.mutation.ImagePrice4kCleared() { _spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64) } if value, ok := _u.mutation.BatchImageDiscountMultiplier(); ok { _spec.SetField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedBatchImageDiscountMultiplier(); ok { _spec.AddField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.BatchImageHoldMultiplier(); ok { _spec.SetField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedBatchImageHoldMultiplier(); ok { _spec.AddField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.VideoRateIndependent(); ok { _spec.SetField(group.FieldVideoRateIndependent, field.TypeBool, value) } if value, ok := _u.mutation.VideoRateMultiplier(); ok { _spec.SetField(group.FieldVideoRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoRateMultiplier(); ok { _spec.AddField(group.FieldVideoRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.VideoPrice480p(); ok { _spec.SetField(group.FieldVideoPrice480p, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoPrice480p(); ok { _spec.AddField(group.FieldVideoPrice480p, field.TypeFloat64, value) } if _u.mutation.VideoPrice480pCleared() { _spec.ClearField(group.FieldVideoPrice480p, field.TypeFloat64) } if value, ok := _u.mutation.VideoPrice720p(); ok { _spec.SetField(group.FieldVideoPrice720p, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoPrice720p(); ok { _spec.AddField(group.FieldVideoPrice720p, field.TypeFloat64, value) } if _u.mutation.VideoPrice720pCleared() { _spec.ClearField(group.FieldVideoPrice720p, field.TypeFloat64) } if value, ok := _u.mutation.VideoPrice1080p(); ok { _spec.SetField(group.FieldVideoPrice1080p, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoPrice1080p(); ok { _spec.AddField(group.FieldVideoPrice1080p, field.TypeFloat64, value) } if _u.mutation.VideoPrice1080pCleared() { _spec.ClearField(group.FieldVideoPrice1080p, field.TypeFloat64) } if value, ok := _u.mutation.VideoModelPrices(); ok { _spec.SetField(group.FieldVideoModelPrices, field.TypeJSON, value) } if _u.mutation.VideoModelPricesCleared() { _spec.ClearField(group.FieldVideoModelPrices, field.TypeJSON) } if value, ok := _u.mutation.WebSearchPricePerCall(); ok { _spec.SetField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedWebSearchPricePerCall(); ok { _spec.AddField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value) } if _u.mutation.WebSearchPricePerCallCleared() { _spec.ClearField(group.FieldWebSearchPricePerCall, field.TypeFloat64) } if value, ok := _u.mutation.SearchPricePer1k(); ok { _spec.SetField(group.FieldSearchPricePer1k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedSearchPricePer1k(); ok { _spec.AddField(group.FieldSearchPricePer1k, field.TypeFloat64, value) } if _u.mutation.SearchPricePer1kCleared() { _spec.ClearField(group.FieldSearchPricePer1k, field.TypeFloat64) } if value, ok := _u.mutation.AudioRealtimePricePerMin(); ok { _spec.SetField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedAudioRealtimePricePerMin(); ok { _spec.AddField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value) } if _u.mutation.AudioRealtimePricePerMinCleared() { _spec.ClearField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64) } if value, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok { _spec.SetField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedAudioTtsPricePerMillionChars(); ok { _spec.AddField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value) } if _u.mutation.AudioTtsPricePerMillionCharsCleared() { _spec.ClearField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64) } if value, ok := _u.mutation.AudioSttPricePerHour(); ok { _spec.SetField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedAudioSttPricePerHour(); ok { _spec.AddField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value) } if _u.mutation.AudioSttPricePerHourCleared() { _spec.ClearField(group.FieldAudioSttPricePerHour, field.TypeFloat64) } if value, ok := _u.mutation.LongContextPricingEnabled(); ok { _spec.SetField(group.FieldLongContextPricingEnabled, field.TypeBool, value) } if value, ok := _u.mutation.ModelPricing(); ok { _spec.SetField(group.FieldModelPricing, field.TypeJSON, value) } if value, ok := _u.mutation.AppendedModelPricing(); ok { _spec.AddModifier(func(u *sql.UpdateBuilder) { sqljson.Append(u, group.FieldModelPricing, value) }) } if _u.mutation.ModelPricingCleared() { _spec.ClearField(group.FieldModelPricing, field.TypeJSON) } if value, ok := _u.mutation.ClaudeCodeOnly(); ok { _spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value) } if value, ok := _u.mutation.FallbackGroupID(); ok { _spec.SetField(group.FieldFallbackGroupID, field.TypeInt64, value) } if value, ok := _u.mutation.AddedFallbackGroupID(); ok { _spec.AddField(group.FieldFallbackGroupID, field.TypeInt64, value) } if _u.mutation.FallbackGroupIDCleared() { _spec.ClearField(group.FieldFallbackGroupID, field.TypeInt64) } if value, ok := _u.mutation.FallbackGroupIDOnInvalidRequest(); ok { _spec.SetField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value) } if value, ok := _u.mutation.AddedFallbackGroupIDOnInvalidRequest(); ok { _spec.AddField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value) } if _u.mutation.FallbackGroupIDOnInvalidRequestCleared() { _spec.ClearField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64) } if value, ok := _u.mutation.ModelRouting(); ok { _spec.SetField(group.FieldModelRouting, field.TypeJSON, value) } if _u.mutation.ModelRoutingCleared() { _spec.ClearField(group.FieldModelRouting, field.TypeJSON) } if value, ok := _u.mutation.ModelRoutingEnabled(); ok { _spec.SetField(group.FieldModelRoutingEnabled, field.TypeBool, value) } if value, ok := _u.mutation.McpXMLInject(); ok { _spec.SetField(group.FieldMcpXMLInject, field.TypeBool, value) } if value, ok := _u.mutation.SupportedModelScopes(); ok { _spec.SetField(group.FieldSupportedModelScopes, field.TypeJSON, value) } if value, ok := _u.mutation.AppendedSupportedModelScopes(); ok { _spec.AddModifier(func(u *sql.UpdateBuilder) { sqljson.Append(u, group.FieldSupportedModelScopes, value) }) } if value, ok := _u.mutation.SortOrder(); ok { _spec.SetField(group.FieldSortOrder, field.TypeInt, value) } if value, ok := _u.mutation.AddedSortOrder(); ok { _spec.AddField(group.FieldSortOrder, field.TypeInt, value) } if value, ok := _u.mutation.AllowMessagesDispatch(); ok { _spec.SetField(group.FieldAllowMessagesDispatch, field.TypeBool, value) } if value, ok := _u.mutation.AllowLive(); ok { _spec.SetField(group.FieldAllowLive, field.TypeBool, value) } if value, ok := _u.mutation.RequireOauthOnly(); ok { _spec.SetField(group.FieldRequireOauthOnly, field.TypeBool, value) } if value, ok := _u.mutation.RequirePrivacySet(); ok { _spec.SetField(group.FieldRequirePrivacySet, field.TypeBool, value) } if value, ok := _u.mutation.DefaultMappedModel(); ok { _spec.SetField(group.FieldDefaultMappedModel, field.TypeString, value) } if value, ok := _u.mutation.MessagesDispatchModelConfig(); ok { _spec.SetField(group.FieldMessagesDispatchModelConfig, field.TypeJSON, value) } if value, ok := _u.mutation.ModelsListConfig(); ok { _spec.SetField(group.FieldModelsListConfig, field.TypeJSON, value) } if value, ok := _u.mutation.RpmLimit(); ok { _spec.SetField(group.FieldRpmLimit, field.TypeInt, value) } if value, ok := _u.mutation.AddedRpmLimit(); ok { _spec.AddField(group.FieldRpmLimit, field.TypeInt, value) } if value, ok := _u.mutation.MaxReasoningEffort(); ok { _spec.SetField(group.FieldMaxReasoningEffort, field.TypeString, value) } if value, ok := _u.mutation.ReasoningEffortMappings(); ok { _spec.SetField(group.FieldReasoningEffortMappings, field.TypeJSON, value) } if value, ok := _u.mutation.AppendedReasoningEffortMappings(); ok { _spec.AddModifier(func(u *sql.UpdateBuilder) { sqljson.Append(u, group.FieldReasoningEffortMappings, value) }) } if value, ok := _u.mutation.ProfitControlEnabled(); ok { _spec.SetField(group.FieldProfitControlEnabled, field.TypeBool, value) } if value, ok := _u.mutation.ProfitMinMargin(); ok { _spec.SetField(group.FieldProfitMinMargin, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedProfitMinMargin(); ok { _spec.AddField(group.FieldProfitMinMargin, field.TypeFloat64, value) } if value, ok := _u.mutation.ProfitSafetyBuffer(); ok { _spec.SetField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedProfitSafetyBuffer(); ok { _spec.AddField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value) } if _u.mutation.APIKeysCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.APIKeysTable, Columns: []string{group.APIKeysColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAPIKeysIDs(); len(nodes) > 0 && !_u.mutation.APIKeysCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.APIKeysTable, Columns: []string{group.APIKeysColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.APIKeysIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.APIKeysTable, Columns: []string{group.APIKeysColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.RedeemCodesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.RedeemCodesTable, Columns: []string{group.RedeemCodesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedRedeemCodesIDs(); len(nodes) > 0 && !_u.mutation.RedeemCodesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.RedeemCodesTable, Columns: []string{group.RedeemCodesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RedeemCodesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.RedeemCodesTable, Columns: []string{group.RedeemCodesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.SubscriptionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.SubscriptionsTable, Columns: []string{group.SubscriptionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSubscriptionsIDs(); len(nodes) > 0 && !_u.mutation.SubscriptionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.SubscriptionsTable, Columns: []string{group.SubscriptionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubscriptionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.SubscriptionsTable, Columns: []string{group.SubscriptionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.UsageLogsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.UsageLogsTable, Columns: []string{group.UsageLogsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedUsageLogsIDs(); len(nodes) > 0 && !_u.mutation.UsageLogsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.UsageLogsTable, Columns: []string{group.UsageLogsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UsageLogsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.UsageLogsTable, Columns: []string{group.UsageLogsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.AccountsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AccountsTable, Columns: group.AccountsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64), }, } createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAccountsIDs(); len(nodes) > 0 && !_u.mutation.AccountsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AccountsTable, Columns: group.AccountsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AccountsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AccountsTable, Columns: group.AccountsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.AllowedUsersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AllowedUsersTable, Columns: group.AllowedUsersPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64), }, } createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAllowedUsersIDs(); len(nodes) > 0 && !_u.mutation.AllowedUsersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AllowedUsersTable, Columns: group.AllowedUsersPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AllowedUsersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AllowedUsersTable, Columns: group.AllowedUsersPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config fields []string hooks []Hook mutation *GroupMutation } // SetUpdatedAt sets the "updated_at" field. func (_u *GroupUpdateOne) SetUpdatedAt(v time.Time) *GroupUpdateOne { _u.mutation.SetUpdatedAt(v) return _u } // SetDeletedAt sets the "deleted_at" field. func (_u *GroupUpdateOne) SetDeletedAt(v time.Time) *GroupUpdateOne { _u.mutation.SetDeletedAt(v) return _u } // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableDeletedAt(v *time.Time) *GroupUpdateOne { if v != nil { _u.SetDeletedAt(*v) } return _u } // ClearDeletedAt clears the value of the "deleted_at" field. func (_u *GroupUpdateOne) ClearDeletedAt() *GroupUpdateOne { _u.mutation.ClearDeletedAt() return _u } // SetName sets the "name" field. func (_u *GroupUpdateOne) SetName(v string) *GroupUpdateOne { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableName(v *string) *GroupUpdateOne { if v != nil { _u.SetName(*v) } return _u } // SetDescription sets the "description" field. func (_u *GroupUpdateOne) SetDescription(v string) *GroupUpdateOne { _u.mutation.SetDescription(v) return _u } // SetNillableDescription sets the "description" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableDescription(v *string) *GroupUpdateOne { if v != nil { _u.SetDescription(*v) } return _u } // ClearDescription clears the value of the "description" field. func (_u *GroupUpdateOne) ClearDescription() *GroupUpdateOne { _u.mutation.ClearDescription() return _u } // SetRateMultiplier sets the "rate_multiplier" field. func (_u *GroupUpdateOne) SetRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.ResetRateMultiplier() _u.mutation.SetRateMultiplier(v) return _u } // SetNillableRateMultiplier sets the "rate_multiplier" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableRateMultiplier(v *float64) *GroupUpdateOne { if v != nil { _u.SetRateMultiplier(*v) } return _u } // AddRateMultiplier adds value to the "rate_multiplier" field. func (_u *GroupUpdateOne) AddRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.AddRateMultiplier(v) return _u } // SetPeakRateEnabled sets the "peak_rate_enabled" field. func (_u *GroupUpdateOne) SetPeakRateEnabled(v bool) *GroupUpdateOne { _u.mutation.SetPeakRateEnabled(v) return _u } // SetNillablePeakRateEnabled sets the "peak_rate_enabled" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillablePeakRateEnabled(v *bool) *GroupUpdateOne { if v != nil { _u.SetPeakRateEnabled(*v) } return _u } // SetPeakStart sets the "peak_start" field. func (_u *GroupUpdateOne) SetPeakStart(v string) *GroupUpdateOne { _u.mutation.SetPeakStart(v) return _u } // SetNillablePeakStart sets the "peak_start" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillablePeakStart(v *string) *GroupUpdateOne { if v != nil { _u.SetPeakStart(*v) } return _u } // SetPeakEnd sets the "peak_end" field. func (_u *GroupUpdateOne) SetPeakEnd(v string) *GroupUpdateOne { _u.mutation.SetPeakEnd(v) return _u } // SetNillablePeakEnd sets the "peak_end" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillablePeakEnd(v *string) *GroupUpdateOne { if v != nil { _u.SetPeakEnd(*v) } return _u } // SetPeakRateMultiplier sets the "peak_rate_multiplier" field. func (_u *GroupUpdateOne) SetPeakRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.ResetPeakRateMultiplier() _u.mutation.SetPeakRateMultiplier(v) return _u } // SetNillablePeakRateMultiplier sets the "peak_rate_multiplier" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillablePeakRateMultiplier(v *float64) *GroupUpdateOne { if v != nil { _u.SetPeakRateMultiplier(*v) } return _u } // AddPeakRateMultiplier adds value to the "peak_rate_multiplier" field. func (_u *GroupUpdateOne) AddPeakRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.AddPeakRateMultiplier(v) return _u } // SetIsExclusive sets the "is_exclusive" field. func (_u *GroupUpdateOne) SetIsExclusive(v bool) *GroupUpdateOne { _u.mutation.SetIsExclusive(v) return _u } // SetNillableIsExclusive sets the "is_exclusive" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableIsExclusive(v *bool) *GroupUpdateOne { if v != nil { _u.SetIsExclusive(*v) } return _u } // SetStatus sets the "status" field. func (_u *GroupUpdateOne) SetStatus(v string) *GroupUpdateOne { _u.mutation.SetStatus(v) return _u } // SetNillableStatus sets the "status" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableStatus(v *string) *GroupUpdateOne { if v != nil { _u.SetStatus(*v) } return _u } // SetPlatform sets the "platform" field. func (_u *GroupUpdateOne) SetPlatform(v string) *GroupUpdateOne { _u.mutation.SetPlatform(v) return _u } // SetNillablePlatform sets the "platform" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillablePlatform(v *string) *GroupUpdateOne { if v != nil { _u.SetPlatform(*v) } return _u } // SetSubscriptionType sets the "subscription_type" field. func (_u *GroupUpdateOne) SetSubscriptionType(v string) *GroupUpdateOne { _u.mutation.SetSubscriptionType(v) return _u } // SetNillableSubscriptionType sets the "subscription_type" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableSubscriptionType(v *string) *GroupUpdateOne { if v != nil { _u.SetSubscriptionType(*v) } return _u } // SetDailyLimitUsd sets the "daily_limit_usd" field. func (_u *GroupUpdateOne) SetDailyLimitUsd(v float64) *GroupUpdateOne { _u.mutation.ResetDailyLimitUsd() _u.mutation.SetDailyLimitUsd(v) return _u } // SetNillableDailyLimitUsd sets the "daily_limit_usd" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableDailyLimitUsd(v *float64) *GroupUpdateOne { if v != nil { _u.SetDailyLimitUsd(*v) } return _u } // AddDailyLimitUsd adds value to the "daily_limit_usd" field. func (_u *GroupUpdateOne) AddDailyLimitUsd(v float64) *GroupUpdateOne { _u.mutation.AddDailyLimitUsd(v) return _u } // ClearDailyLimitUsd clears the value of the "daily_limit_usd" field. func (_u *GroupUpdateOne) ClearDailyLimitUsd() *GroupUpdateOne { _u.mutation.ClearDailyLimitUsd() return _u } // SetWeeklyLimitUsd sets the "weekly_limit_usd" field. func (_u *GroupUpdateOne) SetWeeklyLimitUsd(v float64) *GroupUpdateOne { _u.mutation.ResetWeeklyLimitUsd() _u.mutation.SetWeeklyLimitUsd(v) return _u } // SetNillableWeeklyLimitUsd sets the "weekly_limit_usd" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableWeeklyLimitUsd(v *float64) *GroupUpdateOne { if v != nil { _u.SetWeeklyLimitUsd(*v) } return _u } // AddWeeklyLimitUsd adds value to the "weekly_limit_usd" field. func (_u *GroupUpdateOne) AddWeeklyLimitUsd(v float64) *GroupUpdateOne { _u.mutation.AddWeeklyLimitUsd(v) return _u } // ClearWeeklyLimitUsd clears the value of the "weekly_limit_usd" field. func (_u *GroupUpdateOne) ClearWeeklyLimitUsd() *GroupUpdateOne { _u.mutation.ClearWeeklyLimitUsd() return _u } // SetMonthlyLimitUsd sets the "monthly_limit_usd" field. func (_u *GroupUpdateOne) SetMonthlyLimitUsd(v float64) *GroupUpdateOne { _u.mutation.ResetMonthlyLimitUsd() _u.mutation.SetMonthlyLimitUsd(v) return _u } // SetNillableMonthlyLimitUsd sets the "monthly_limit_usd" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableMonthlyLimitUsd(v *float64) *GroupUpdateOne { if v != nil { _u.SetMonthlyLimitUsd(*v) } return _u } // AddMonthlyLimitUsd adds value to the "monthly_limit_usd" field. func (_u *GroupUpdateOne) AddMonthlyLimitUsd(v float64) *GroupUpdateOne { _u.mutation.AddMonthlyLimitUsd(v) return _u } // ClearMonthlyLimitUsd clears the value of the "monthly_limit_usd" field. func (_u *GroupUpdateOne) ClearMonthlyLimitUsd() *GroupUpdateOne { _u.mutation.ClearMonthlyLimitUsd() return _u } // SetDefaultValidityDays sets the "default_validity_days" field. func (_u *GroupUpdateOne) SetDefaultValidityDays(v int) *GroupUpdateOne { _u.mutation.ResetDefaultValidityDays() _u.mutation.SetDefaultValidityDays(v) return _u } // SetNillableDefaultValidityDays sets the "default_validity_days" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableDefaultValidityDays(v *int) *GroupUpdateOne { if v != nil { _u.SetDefaultValidityDays(*v) } return _u } // AddDefaultValidityDays adds value to the "default_validity_days" field. func (_u *GroupUpdateOne) AddDefaultValidityDays(v int) *GroupUpdateOne { _u.mutation.AddDefaultValidityDays(v) return _u } // SetAllowImageGeneration sets the "allow_image_generation" field. func (_u *GroupUpdateOne) SetAllowImageGeneration(v bool) *GroupUpdateOne { _u.mutation.SetAllowImageGeneration(v) return _u } // SetNillableAllowImageGeneration sets the "allow_image_generation" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableAllowImageGeneration(v *bool) *GroupUpdateOne { if v != nil { _u.SetAllowImageGeneration(*v) } return _u } // SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field. func (_u *GroupUpdateOne) SetAllowBatchImageGeneration(v bool) *GroupUpdateOne { _u.mutation.SetAllowBatchImageGeneration(v) return _u } // SetNillableAllowBatchImageGeneration sets the "allow_batch_image_generation" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableAllowBatchImageGeneration(v *bool) *GroupUpdateOne { if v != nil { _u.SetAllowBatchImageGeneration(*v) } return _u } // SetImageRateIndependent sets the "image_rate_independent" field. func (_u *GroupUpdateOne) SetImageRateIndependent(v bool) *GroupUpdateOne { _u.mutation.SetImageRateIndependent(v) return _u } // SetNillableImageRateIndependent sets the "image_rate_independent" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableImageRateIndependent(v *bool) *GroupUpdateOne { if v != nil { _u.SetImageRateIndependent(*v) } return _u } // SetImageRateMultiplier sets the "image_rate_multiplier" field. func (_u *GroupUpdateOne) SetImageRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.ResetImageRateMultiplier() _u.mutation.SetImageRateMultiplier(v) return _u } // SetNillableImageRateMultiplier sets the "image_rate_multiplier" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableImageRateMultiplier(v *float64) *GroupUpdateOne { if v != nil { _u.SetImageRateMultiplier(*v) } return _u } // AddImageRateMultiplier adds value to the "image_rate_multiplier" field. func (_u *GroupUpdateOne) AddImageRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.AddImageRateMultiplier(v) return _u } // SetImagePrice1k sets the "image_price_1k" field. func (_u *GroupUpdateOne) SetImagePrice1k(v float64) *GroupUpdateOne { _u.mutation.ResetImagePrice1k() _u.mutation.SetImagePrice1k(v) return _u } // SetNillableImagePrice1k sets the "image_price_1k" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableImagePrice1k(v *float64) *GroupUpdateOne { if v != nil { _u.SetImagePrice1k(*v) } return _u } // AddImagePrice1k adds value to the "image_price_1k" field. func (_u *GroupUpdateOne) AddImagePrice1k(v float64) *GroupUpdateOne { _u.mutation.AddImagePrice1k(v) return _u } // ClearImagePrice1k clears the value of the "image_price_1k" field. func (_u *GroupUpdateOne) ClearImagePrice1k() *GroupUpdateOne { _u.mutation.ClearImagePrice1k() return _u } // SetImagePrice2k sets the "image_price_2k" field. func (_u *GroupUpdateOne) SetImagePrice2k(v float64) *GroupUpdateOne { _u.mutation.ResetImagePrice2k() _u.mutation.SetImagePrice2k(v) return _u } // SetNillableImagePrice2k sets the "image_price_2k" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableImagePrice2k(v *float64) *GroupUpdateOne { if v != nil { _u.SetImagePrice2k(*v) } return _u } // AddImagePrice2k adds value to the "image_price_2k" field. func (_u *GroupUpdateOne) AddImagePrice2k(v float64) *GroupUpdateOne { _u.mutation.AddImagePrice2k(v) return _u } // ClearImagePrice2k clears the value of the "image_price_2k" field. func (_u *GroupUpdateOne) ClearImagePrice2k() *GroupUpdateOne { _u.mutation.ClearImagePrice2k() return _u } // SetImagePrice4k sets the "image_price_4k" field. func (_u *GroupUpdateOne) SetImagePrice4k(v float64) *GroupUpdateOne { _u.mutation.ResetImagePrice4k() _u.mutation.SetImagePrice4k(v) return _u } // SetNillableImagePrice4k sets the "image_price_4k" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableImagePrice4k(v *float64) *GroupUpdateOne { if v != nil { _u.SetImagePrice4k(*v) } return _u } // AddImagePrice4k adds value to the "image_price_4k" field. func (_u *GroupUpdateOne) AddImagePrice4k(v float64) *GroupUpdateOne { _u.mutation.AddImagePrice4k(v) return _u } // ClearImagePrice4k clears the value of the "image_price_4k" field. func (_u *GroupUpdateOne) ClearImagePrice4k() *GroupUpdateOne { _u.mutation.ClearImagePrice4k() return _u } // SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field. func (_u *GroupUpdateOne) SetBatchImageDiscountMultiplier(v float64) *GroupUpdateOne { _u.mutation.ResetBatchImageDiscountMultiplier() _u.mutation.SetBatchImageDiscountMultiplier(v) return _u } // SetNillableBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableBatchImageDiscountMultiplier(v *float64) *GroupUpdateOne { if v != nil { _u.SetBatchImageDiscountMultiplier(*v) } return _u } // AddBatchImageDiscountMultiplier adds value to the "batch_image_discount_multiplier" field. func (_u *GroupUpdateOne) AddBatchImageDiscountMultiplier(v float64) *GroupUpdateOne { _u.mutation.AddBatchImageDiscountMultiplier(v) return _u } // SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field. func (_u *GroupUpdateOne) SetBatchImageHoldMultiplier(v float64) *GroupUpdateOne { _u.mutation.ResetBatchImageHoldMultiplier() _u.mutation.SetBatchImageHoldMultiplier(v) return _u } // SetNillableBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableBatchImageHoldMultiplier(v *float64) *GroupUpdateOne { if v != nil { _u.SetBatchImageHoldMultiplier(*v) } return _u } // AddBatchImageHoldMultiplier adds value to the "batch_image_hold_multiplier" field. func (_u *GroupUpdateOne) AddBatchImageHoldMultiplier(v float64) *GroupUpdateOne { _u.mutation.AddBatchImageHoldMultiplier(v) return _u } // SetVideoRateIndependent sets the "video_rate_independent" field. func (_u *GroupUpdateOne) SetVideoRateIndependent(v bool) *GroupUpdateOne { _u.mutation.SetVideoRateIndependent(v) return _u } // SetNillableVideoRateIndependent sets the "video_rate_independent" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableVideoRateIndependent(v *bool) *GroupUpdateOne { if v != nil { _u.SetVideoRateIndependent(*v) } return _u } // SetVideoRateMultiplier sets the "video_rate_multiplier" field. func (_u *GroupUpdateOne) SetVideoRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.ResetVideoRateMultiplier() _u.mutation.SetVideoRateMultiplier(v) return _u } // SetNillableVideoRateMultiplier sets the "video_rate_multiplier" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableVideoRateMultiplier(v *float64) *GroupUpdateOne { if v != nil { _u.SetVideoRateMultiplier(*v) } return _u } // AddVideoRateMultiplier adds value to the "video_rate_multiplier" field. func (_u *GroupUpdateOne) AddVideoRateMultiplier(v float64) *GroupUpdateOne { _u.mutation.AddVideoRateMultiplier(v) return _u } // SetVideoPrice480p sets the "video_price_480p" field. func (_u *GroupUpdateOne) SetVideoPrice480p(v float64) *GroupUpdateOne { _u.mutation.ResetVideoPrice480p() _u.mutation.SetVideoPrice480p(v) return _u } // SetNillableVideoPrice480p sets the "video_price_480p" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableVideoPrice480p(v *float64) *GroupUpdateOne { if v != nil { _u.SetVideoPrice480p(*v) } return _u } // AddVideoPrice480p adds value to the "video_price_480p" field. func (_u *GroupUpdateOne) AddVideoPrice480p(v float64) *GroupUpdateOne { _u.mutation.AddVideoPrice480p(v) return _u } // ClearVideoPrice480p clears the value of the "video_price_480p" field. func (_u *GroupUpdateOne) ClearVideoPrice480p() *GroupUpdateOne { _u.mutation.ClearVideoPrice480p() return _u } // SetVideoPrice720p sets the "video_price_720p" field. func (_u *GroupUpdateOne) SetVideoPrice720p(v float64) *GroupUpdateOne { _u.mutation.ResetVideoPrice720p() _u.mutation.SetVideoPrice720p(v) return _u } // SetNillableVideoPrice720p sets the "video_price_720p" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableVideoPrice720p(v *float64) *GroupUpdateOne { if v != nil { _u.SetVideoPrice720p(*v) } return _u } // AddVideoPrice720p adds value to the "video_price_720p" field. func (_u *GroupUpdateOne) AddVideoPrice720p(v float64) *GroupUpdateOne { _u.mutation.AddVideoPrice720p(v) return _u } // ClearVideoPrice720p clears the value of the "video_price_720p" field. func (_u *GroupUpdateOne) ClearVideoPrice720p() *GroupUpdateOne { _u.mutation.ClearVideoPrice720p() return _u } // SetVideoPrice1080p sets the "video_price_1080p" field. func (_u *GroupUpdateOne) SetVideoPrice1080p(v float64) *GroupUpdateOne { _u.mutation.ResetVideoPrice1080p() _u.mutation.SetVideoPrice1080p(v) return _u } // SetNillableVideoPrice1080p sets the "video_price_1080p" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableVideoPrice1080p(v *float64) *GroupUpdateOne { if v != nil { _u.SetVideoPrice1080p(*v) } return _u } // AddVideoPrice1080p adds value to the "video_price_1080p" field. func (_u *GroupUpdateOne) AddVideoPrice1080p(v float64) *GroupUpdateOne { _u.mutation.AddVideoPrice1080p(v) return _u } // ClearVideoPrice1080p clears the value of the "video_price_1080p" field. func (_u *GroupUpdateOne) ClearVideoPrice1080p() *GroupUpdateOne { _u.mutation.ClearVideoPrice1080p() return _u } // SetVideoModelPrices sets the "video_model_prices" field. func (_u *GroupUpdateOne) SetVideoModelPrices(v map[string]map[string]float64) *GroupUpdateOne { _u.mutation.SetVideoModelPrices(v) return _u } // ClearVideoModelPrices clears the value of the "video_model_prices" field. func (_u *GroupUpdateOne) ClearVideoModelPrices() *GroupUpdateOne { _u.mutation.ClearVideoModelPrices() return _u } // SetWebSearchPricePerCall sets the "web_search_price_per_call" field. func (_u *GroupUpdateOne) SetWebSearchPricePerCall(v float64) *GroupUpdateOne { _u.mutation.ResetWebSearchPricePerCall() _u.mutation.SetWebSearchPricePerCall(v) return _u } // SetNillableWebSearchPricePerCall sets the "web_search_price_per_call" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableWebSearchPricePerCall(v *float64) *GroupUpdateOne { if v != nil { _u.SetWebSearchPricePerCall(*v) } return _u } // AddWebSearchPricePerCall adds value to the "web_search_price_per_call" field. func (_u *GroupUpdateOne) AddWebSearchPricePerCall(v float64) *GroupUpdateOne { _u.mutation.AddWebSearchPricePerCall(v) return _u } // ClearWebSearchPricePerCall clears the value of the "web_search_price_per_call" field. func (_u *GroupUpdateOne) ClearWebSearchPricePerCall() *GroupUpdateOne { _u.mutation.ClearWebSearchPricePerCall() return _u } // SetSearchPricePer1k sets the "search_price_per_1k" field. func (_u *GroupUpdateOne) SetSearchPricePer1k(v float64) *GroupUpdateOne { _u.mutation.ResetSearchPricePer1k() _u.mutation.SetSearchPricePer1k(v) return _u } // SetNillableSearchPricePer1k sets the "search_price_per_1k" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableSearchPricePer1k(v *float64) *GroupUpdateOne { if v != nil { _u.SetSearchPricePer1k(*v) } return _u } // AddSearchPricePer1k adds value to the "search_price_per_1k" field. func (_u *GroupUpdateOne) AddSearchPricePer1k(v float64) *GroupUpdateOne { _u.mutation.AddSearchPricePer1k(v) return _u } // ClearSearchPricePer1k clears the value of the "search_price_per_1k" field. func (_u *GroupUpdateOne) ClearSearchPricePer1k() *GroupUpdateOne { _u.mutation.ClearSearchPricePer1k() return _u } // SetAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field. func (_u *GroupUpdateOne) SetAudioRealtimePricePerMin(v float64) *GroupUpdateOne { _u.mutation.ResetAudioRealtimePricePerMin() _u.mutation.SetAudioRealtimePricePerMin(v) return _u } // SetNillableAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableAudioRealtimePricePerMin(v *float64) *GroupUpdateOne { if v != nil { _u.SetAudioRealtimePricePerMin(*v) } return _u } // AddAudioRealtimePricePerMin adds value to the "audio_realtime_price_per_min" field. func (_u *GroupUpdateOne) AddAudioRealtimePricePerMin(v float64) *GroupUpdateOne { _u.mutation.AddAudioRealtimePricePerMin(v) return _u } // ClearAudioRealtimePricePerMin clears the value of the "audio_realtime_price_per_min" field. func (_u *GroupUpdateOne) ClearAudioRealtimePricePerMin() *GroupUpdateOne { _u.mutation.ClearAudioRealtimePricePerMin() return _u } // SetAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field. func (_u *GroupUpdateOne) SetAudioTtsPricePerMillionChars(v float64) *GroupUpdateOne { _u.mutation.ResetAudioTtsPricePerMillionChars() _u.mutation.SetAudioTtsPricePerMillionChars(v) return _u } // SetNillableAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableAudioTtsPricePerMillionChars(v *float64) *GroupUpdateOne { if v != nil { _u.SetAudioTtsPricePerMillionChars(*v) } return _u } // AddAudioTtsPricePerMillionChars adds value to the "audio_tts_price_per_million_chars" field. func (_u *GroupUpdateOne) AddAudioTtsPricePerMillionChars(v float64) *GroupUpdateOne { _u.mutation.AddAudioTtsPricePerMillionChars(v) return _u } // ClearAudioTtsPricePerMillionChars clears the value of the "audio_tts_price_per_million_chars" field. func (_u *GroupUpdateOne) ClearAudioTtsPricePerMillionChars() *GroupUpdateOne { _u.mutation.ClearAudioTtsPricePerMillionChars() return _u } // SetAudioSttPricePerHour sets the "audio_stt_price_per_hour" field. func (_u *GroupUpdateOne) SetAudioSttPricePerHour(v float64) *GroupUpdateOne { _u.mutation.ResetAudioSttPricePerHour() _u.mutation.SetAudioSttPricePerHour(v) return _u } // SetNillableAudioSttPricePerHour sets the "audio_stt_price_per_hour" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableAudioSttPricePerHour(v *float64) *GroupUpdateOne { if v != nil { _u.SetAudioSttPricePerHour(*v) } return _u } // AddAudioSttPricePerHour adds value to the "audio_stt_price_per_hour" field. func (_u *GroupUpdateOne) AddAudioSttPricePerHour(v float64) *GroupUpdateOne { _u.mutation.AddAudioSttPricePerHour(v) return _u } // ClearAudioSttPricePerHour clears the value of the "audio_stt_price_per_hour" field. func (_u *GroupUpdateOne) ClearAudioSttPricePerHour() *GroupUpdateOne { _u.mutation.ClearAudioSttPricePerHour() return _u } // SetLongContextPricingEnabled sets the "long_context_pricing_enabled" field. func (_u *GroupUpdateOne) SetLongContextPricingEnabled(v bool) *GroupUpdateOne { _u.mutation.SetLongContextPricingEnabled(v) return _u } // SetNillableLongContextPricingEnabled sets the "long_context_pricing_enabled" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableLongContextPricingEnabled(v *bool) *GroupUpdateOne { if v != nil { _u.SetLongContextPricingEnabled(*v) } return _u } // SetModelPricing sets the "model_pricing" field. func (_u *GroupUpdateOne) SetModelPricing(v json.RawMessage) *GroupUpdateOne { _u.mutation.SetModelPricing(v) return _u } // AppendModelPricing appends value to the "model_pricing" field. func (_u *GroupUpdateOne) AppendModelPricing(v json.RawMessage) *GroupUpdateOne { _u.mutation.AppendModelPricing(v) return _u } // ClearModelPricing clears the value of the "model_pricing" field. func (_u *GroupUpdateOne) ClearModelPricing() *GroupUpdateOne { _u.mutation.ClearModelPricing() return _u } // SetClaudeCodeOnly sets the "claude_code_only" field. func (_u *GroupUpdateOne) SetClaudeCodeOnly(v bool) *GroupUpdateOne { _u.mutation.SetClaudeCodeOnly(v) return _u } // SetNillableClaudeCodeOnly sets the "claude_code_only" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableClaudeCodeOnly(v *bool) *GroupUpdateOne { if v != nil { _u.SetClaudeCodeOnly(*v) } return _u } // SetFallbackGroupID sets the "fallback_group_id" field. func (_u *GroupUpdateOne) SetFallbackGroupID(v int64) *GroupUpdateOne { _u.mutation.ResetFallbackGroupID() _u.mutation.SetFallbackGroupID(v) return _u } // SetNillableFallbackGroupID sets the "fallback_group_id" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableFallbackGroupID(v *int64) *GroupUpdateOne { if v != nil { _u.SetFallbackGroupID(*v) } return _u } // AddFallbackGroupID adds value to the "fallback_group_id" field. func (_u *GroupUpdateOne) AddFallbackGroupID(v int64) *GroupUpdateOne { _u.mutation.AddFallbackGroupID(v) return _u } // ClearFallbackGroupID clears the value of the "fallback_group_id" field. func (_u *GroupUpdateOne) ClearFallbackGroupID() *GroupUpdateOne { _u.mutation.ClearFallbackGroupID() return _u } // SetFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field. func (_u *GroupUpdateOne) SetFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdateOne { _u.mutation.ResetFallbackGroupIDOnInvalidRequest() _u.mutation.SetFallbackGroupIDOnInvalidRequest(v) return _u } // SetNillableFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableFallbackGroupIDOnInvalidRequest(v *int64) *GroupUpdateOne { if v != nil { _u.SetFallbackGroupIDOnInvalidRequest(*v) } return _u } // AddFallbackGroupIDOnInvalidRequest adds value to the "fallback_group_id_on_invalid_request" field. func (_u *GroupUpdateOne) AddFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdateOne { _u.mutation.AddFallbackGroupIDOnInvalidRequest(v) return _u } // ClearFallbackGroupIDOnInvalidRequest clears the value of the "fallback_group_id_on_invalid_request" field. func (_u *GroupUpdateOne) ClearFallbackGroupIDOnInvalidRequest() *GroupUpdateOne { _u.mutation.ClearFallbackGroupIDOnInvalidRequest() return _u } // SetModelRouting sets the "model_routing" field. func (_u *GroupUpdateOne) SetModelRouting(v map[string][]int64) *GroupUpdateOne { _u.mutation.SetModelRouting(v) return _u } // ClearModelRouting clears the value of the "model_routing" field. func (_u *GroupUpdateOne) ClearModelRouting() *GroupUpdateOne { _u.mutation.ClearModelRouting() return _u } // SetModelRoutingEnabled sets the "model_routing_enabled" field. func (_u *GroupUpdateOne) SetModelRoutingEnabled(v bool) *GroupUpdateOne { _u.mutation.SetModelRoutingEnabled(v) return _u } // SetNillableModelRoutingEnabled sets the "model_routing_enabled" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableModelRoutingEnabled(v *bool) *GroupUpdateOne { if v != nil { _u.SetModelRoutingEnabled(*v) } return _u } // SetMcpXMLInject sets the "mcp_xml_inject" field. func (_u *GroupUpdateOne) SetMcpXMLInject(v bool) *GroupUpdateOne { _u.mutation.SetMcpXMLInject(v) return _u } // SetNillableMcpXMLInject sets the "mcp_xml_inject" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableMcpXMLInject(v *bool) *GroupUpdateOne { if v != nil { _u.SetMcpXMLInject(*v) } return _u } // SetSupportedModelScopes sets the "supported_model_scopes" field. func (_u *GroupUpdateOne) SetSupportedModelScopes(v []string) *GroupUpdateOne { _u.mutation.SetSupportedModelScopes(v) return _u } // AppendSupportedModelScopes appends value to the "supported_model_scopes" field. func (_u *GroupUpdateOne) AppendSupportedModelScopes(v []string) *GroupUpdateOne { _u.mutation.AppendSupportedModelScopes(v) return _u } // SetSortOrder sets the "sort_order" field. func (_u *GroupUpdateOne) SetSortOrder(v int) *GroupUpdateOne { _u.mutation.ResetSortOrder() _u.mutation.SetSortOrder(v) return _u } // SetNillableSortOrder sets the "sort_order" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableSortOrder(v *int) *GroupUpdateOne { if v != nil { _u.SetSortOrder(*v) } return _u } // AddSortOrder adds value to the "sort_order" field. func (_u *GroupUpdateOne) AddSortOrder(v int) *GroupUpdateOne { _u.mutation.AddSortOrder(v) return _u } // SetAllowMessagesDispatch sets the "allow_messages_dispatch" field. func (_u *GroupUpdateOne) SetAllowMessagesDispatch(v bool) *GroupUpdateOne { _u.mutation.SetAllowMessagesDispatch(v) return _u } // SetNillableAllowMessagesDispatch sets the "allow_messages_dispatch" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableAllowMessagesDispatch(v *bool) *GroupUpdateOne { if v != nil { _u.SetAllowMessagesDispatch(*v) } return _u } // SetAllowLive sets the "allow_live" field. func (_u *GroupUpdateOne) SetAllowLive(v bool) *GroupUpdateOne { _u.mutation.SetAllowLive(v) return _u } // SetNillableAllowLive sets the "allow_live" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableAllowLive(v *bool) *GroupUpdateOne { if v != nil { _u.SetAllowLive(*v) } return _u } // SetRequireOauthOnly sets the "require_oauth_only" field. func (_u *GroupUpdateOne) SetRequireOauthOnly(v bool) *GroupUpdateOne { _u.mutation.SetRequireOauthOnly(v) return _u } // SetNillableRequireOauthOnly sets the "require_oauth_only" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableRequireOauthOnly(v *bool) *GroupUpdateOne { if v != nil { _u.SetRequireOauthOnly(*v) } return _u } // SetRequirePrivacySet sets the "require_privacy_set" field. func (_u *GroupUpdateOne) SetRequirePrivacySet(v bool) *GroupUpdateOne { _u.mutation.SetRequirePrivacySet(v) return _u } // SetNillableRequirePrivacySet sets the "require_privacy_set" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableRequirePrivacySet(v *bool) *GroupUpdateOne { if v != nil { _u.SetRequirePrivacySet(*v) } return _u } // SetDefaultMappedModel sets the "default_mapped_model" field. func (_u *GroupUpdateOne) SetDefaultMappedModel(v string) *GroupUpdateOne { _u.mutation.SetDefaultMappedModel(v) return _u } // SetNillableDefaultMappedModel sets the "default_mapped_model" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableDefaultMappedModel(v *string) *GroupUpdateOne { if v != nil { _u.SetDefaultMappedModel(*v) } return _u } // SetMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field. func (_u *GroupUpdateOne) SetMessagesDispatchModelConfig(v domain.OpenAIMessagesDispatchModelConfig) *GroupUpdateOne { _u.mutation.SetMessagesDispatchModelConfig(v) return _u } // SetNillableMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableMessagesDispatchModelConfig(v *domain.OpenAIMessagesDispatchModelConfig) *GroupUpdateOne { if v != nil { _u.SetMessagesDispatchModelConfig(*v) } return _u } // SetModelsListConfig sets the "models_list_config" field. func (_u *GroupUpdateOne) SetModelsListConfig(v domain.GroupModelsListConfig) *GroupUpdateOne { _u.mutation.SetModelsListConfig(v) return _u } // SetNillableModelsListConfig sets the "models_list_config" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableModelsListConfig(v *domain.GroupModelsListConfig) *GroupUpdateOne { if v != nil { _u.SetModelsListConfig(*v) } return _u } // SetRpmLimit sets the "rpm_limit" field. func (_u *GroupUpdateOne) SetRpmLimit(v int) *GroupUpdateOne { _u.mutation.ResetRpmLimit() _u.mutation.SetRpmLimit(v) return _u } // SetNillableRpmLimit sets the "rpm_limit" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableRpmLimit(v *int) *GroupUpdateOne { if v != nil { _u.SetRpmLimit(*v) } return _u } // AddRpmLimit adds value to the "rpm_limit" field. func (_u *GroupUpdateOne) AddRpmLimit(v int) *GroupUpdateOne { _u.mutation.AddRpmLimit(v) return _u } // SetMaxReasoningEffort sets the "max_reasoning_effort" field. func (_u *GroupUpdateOne) SetMaxReasoningEffort(v string) *GroupUpdateOne { _u.mutation.SetMaxReasoningEffort(v) return _u } // SetNillableMaxReasoningEffort sets the "max_reasoning_effort" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableMaxReasoningEffort(v *string) *GroupUpdateOne { if v != nil { _u.SetMaxReasoningEffort(*v) } return _u } // SetReasoningEffortMappings sets the "reasoning_effort_mappings" field. func (_u *GroupUpdateOne) SetReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdateOne { _u.mutation.SetReasoningEffortMappings(v) return _u } // AppendReasoningEffortMappings appends value to the "reasoning_effort_mappings" field. func (_u *GroupUpdateOne) AppendReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdateOne { _u.mutation.AppendReasoningEffortMappings(v) return _u } // SetProfitControlEnabled sets the "profit_control_enabled" field. func (_u *GroupUpdateOne) SetProfitControlEnabled(v bool) *GroupUpdateOne { _u.mutation.SetProfitControlEnabled(v) return _u } // SetNillableProfitControlEnabled sets the "profit_control_enabled" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableProfitControlEnabled(v *bool) *GroupUpdateOne { if v != nil { _u.SetProfitControlEnabled(*v) } return _u } // SetProfitMinMargin sets the "profit_min_margin" field. func (_u *GroupUpdateOne) SetProfitMinMargin(v float64) *GroupUpdateOne { _u.mutation.ResetProfitMinMargin() _u.mutation.SetProfitMinMargin(v) return _u } // SetNillableProfitMinMargin sets the "profit_min_margin" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableProfitMinMargin(v *float64) *GroupUpdateOne { if v != nil { _u.SetProfitMinMargin(*v) } return _u } // AddProfitMinMargin adds value to the "profit_min_margin" field. func (_u *GroupUpdateOne) AddProfitMinMargin(v float64) *GroupUpdateOne { _u.mutation.AddProfitMinMargin(v) return _u } // SetProfitSafetyBuffer sets the "profit_safety_buffer" field. func (_u *GroupUpdateOne) SetProfitSafetyBuffer(v float64) *GroupUpdateOne { _u.mutation.ResetProfitSafetyBuffer() _u.mutation.SetProfitSafetyBuffer(v) return _u } // SetNillableProfitSafetyBuffer sets the "profit_safety_buffer" field if the given value is not nil. func (_u *GroupUpdateOne) SetNillableProfitSafetyBuffer(v *float64) *GroupUpdateOne { if v != nil { _u.SetProfitSafetyBuffer(*v) } return _u } // AddProfitSafetyBuffer adds value to the "profit_safety_buffer" field. func (_u *GroupUpdateOne) AddProfitSafetyBuffer(v float64) *GroupUpdateOne { _u.mutation.AddProfitSafetyBuffer(v) return _u } // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs. func (_u *GroupUpdateOne) AddAPIKeyIDs(ids ...int64) *GroupUpdateOne { _u.mutation.AddAPIKeyIDs(ids...) return _u } // AddAPIKeys adds the "api_keys" edges to the APIKey entity. func (_u *GroupUpdateOne) AddAPIKeys(v ...*APIKey) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAPIKeyIDs(ids...) } // AddRedeemCodeIDs adds the "redeem_codes" edge to the RedeemCode entity by IDs. func (_u *GroupUpdateOne) AddRedeemCodeIDs(ids ...int64) *GroupUpdateOne { _u.mutation.AddRedeemCodeIDs(ids...) return _u } // AddRedeemCodes adds the "redeem_codes" edges to the RedeemCode entity. func (_u *GroupUpdateOne) AddRedeemCodes(v ...*RedeemCode) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddRedeemCodeIDs(ids...) } // AddSubscriptionIDs adds the "subscriptions" edge to the UserSubscription entity by IDs. func (_u *GroupUpdateOne) AddSubscriptionIDs(ids ...int64) *GroupUpdateOne { _u.mutation.AddSubscriptionIDs(ids...) return _u } // AddSubscriptions adds the "subscriptions" edges to the UserSubscription entity. func (_u *GroupUpdateOne) AddSubscriptions(v ...*UserSubscription) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSubscriptionIDs(ids...) } // AddUsageLogIDs adds the "usage_logs" edge to the UsageLog entity by IDs. func (_u *GroupUpdateOne) AddUsageLogIDs(ids ...int64) *GroupUpdateOne { _u.mutation.AddUsageLogIDs(ids...) return _u } // AddUsageLogs adds the "usage_logs" edges to the UsageLog entity. func (_u *GroupUpdateOne) AddUsageLogs(v ...*UsageLog) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddUsageLogIDs(ids...) } // AddAccountIDs adds the "accounts" edge to the Account entity by IDs. func (_u *GroupUpdateOne) AddAccountIDs(ids ...int64) *GroupUpdateOne { _u.mutation.AddAccountIDs(ids...) return _u } // AddAccounts adds the "accounts" edges to the Account entity. func (_u *GroupUpdateOne) AddAccounts(v ...*Account) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAccountIDs(ids...) } // AddAllowedUserIDs adds the "allowed_users" edge to the User entity by IDs. func (_u *GroupUpdateOne) AddAllowedUserIDs(ids ...int64) *GroupUpdateOne { _u.mutation.AddAllowedUserIDs(ids...) return _u } // AddAllowedUsers adds the "allowed_users" edges to the User entity. func (_u *GroupUpdateOne) AddAllowedUsers(v ...*User) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAllowedUserIDs(ids...) } // Mutation returns the GroupMutation object of the builder. func (_u *GroupUpdateOne) Mutation() *GroupMutation { return _u.mutation } // ClearAPIKeys clears all "api_keys" edges to the APIKey entity. func (_u *GroupUpdateOne) ClearAPIKeys() *GroupUpdateOne { _u.mutation.ClearAPIKeys() return _u } // RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs. func (_u *GroupUpdateOne) RemoveAPIKeyIDs(ids ...int64) *GroupUpdateOne { _u.mutation.RemoveAPIKeyIDs(ids...) return _u } // RemoveAPIKeys removes "api_keys" edges to APIKey entities. func (_u *GroupUpdateOne) RemoveAPIKeys(v ...*APIKey) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAPIKeyIDs(ids...) } // ClearRedeemCodes clears all "redeem_codes" edges to the RedeemCode entity. func (_u *GroupUpdateOne) ClearRedeemCodes() *GroupUpdateOne { _u.mutation.ClearRedeemCodes() return _u } // RemoveRedeemCodeIDs removes the "redeem_codes" edge to RedeemCode entities by IDs. func (_u *GroupUpdateOne) RemoveRedeemCodeIDs(ids ...int64) *GroupUpdateOne { _u.mutation.RemoveRedeemCodeIDs(ids...) return _u } // RemoveRedeemCodes removes "redeem_codes" edges to RedeemCode entities. func (_u *GroupUpdateOne) RemoveRedeemCodes(v ...*RedeemCode) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveRedeemCodeIDs(ids...) } // ClearSubscriptions clears all "subscriptions" edges to the UserSubscription entity. func (_u *GroupUpdateOne) ClearSubscriptions() *GroupUpdateOne { _u.mutation.ClearSubscriptions() return _u } // RemoveSubscriptionIDs removes the "subscriptions" edge to UserSubscription entities by IDs. func (_u *GroupUpdateOne) RemoveSubscriptionIDs(ids ...int64) *GroupUpdateOne { _u.mutation.RemoveSubscriptionIDs(ids...) return _u } // RemoveSubscriptions removes "subscriptions" edges to UserSubscription entities. func (_u *GroupUpdateOne) RemoveSubscriptions(v ...*UserSubscription) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSubscriptionIDs(ids...) } // ClearUsageLogs clears all "usage_logs" edges to the UsageLog entity. func (_u *GroupUpdateOne) ClearUsageLogs() *GroupUpdateOne { _u.mutation.ClearUsageLogs() return _u } // RemoveUsageLogIDs removes the "usage_logs" edge to UsageLog entities by IDs. func (_u *GroupUpdateOne) RemoveUsageLogIDs(ids ...int64) *GroupUpdateOne { _u.mutation.RemoveUsageLogIDs(ids...) return _u } // RemoveUsageLogs removes "usage_logs" edges to UsageLog entities. func (_u *GroupUpdateOne) RemoveUsageLogs(v ...*UsageLog) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveUsageLogIDs(ids...) } // ClearAccounts clears all "accounts" edges to the Account entity. func (_u *GroupUpdateOne) ClearAccounts() *GroupUpdateOne { _u.mutation.ClearAccounts() return _u } // RemoveAccountIDs removes the "accounts" edge to Account entities by IDs. func (_u *GroupUpdateOne) RemoveAccountIDs(ids ...int64) *GroupUpdateOne { _u.mutation.RemoveAccountIDs(ids...) return _u } // RemoveAccounts removes "accounts" edges to Account entities. func (_u *GroupUpdateOne) RemoveAccounts(v ...*Account) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAccountIDs(ids...) } // ClearAllowedUsers clears all "allowed_users" edges to the User entity. func (_u *GroupUpdateOne) ClearAllowedUsers() *GroupUpdateOne { _u.mutation.ClearAllowedUsers() return _u } // RemoveAllowedUserIDs removes the "allowed_users" edge to User entities by IDs. func (_u *GroupUpdateOne) RemoveAllowedUserIDs(ids ...int64) *GroupUpdateOne { _u.mutation.RemoveAllowedUserIDs(ids...) return _u } // RemoveAllowedUsers removes "allowed_users" edges to User entities. func (_u *GroupUpdateOne) RemoveAllowedUsers(v ...*User) *GroupUpdateOne { ids := make([]int64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAllowedUserIDs(ids...) } // Where appends a list predicates to the GroupUpdate builder. func (_u *GroupUpdateOne) Where(ps ...predicate.Group) *GroupUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Group entity. func (_u *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { if err := _u.defaults(); err != nil { return nil, err } return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *GroupUpdateOne) SaveX(ctx context.Context) *Group { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *GroupUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *GroupUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_u *GroupUpdateOne) defaults() error { if _, ok := _u.mutation.UpdatedAt(); !ok { if group.UpdateDefaultUpdatedAt == nil { return fmt.Errorf("ent: uninitialized group.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)") } v := group.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) } return nil } // check runs all checks and user-defined validators on the builder. func (_u *GroupUpdateOne) check() error { if v, ok := _u.mutation.Name(); ok { if err := group.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Group.name": %w`, err)} } } if v, ok := _u.mutation.PeakStart(); ok { if err := group.PeakStartValidator(v); err != nil { return &ValidationError{Name: "peak_start", err: fmt.Errorf(`ent: validator failed for field "Group.peak_start": %w`, err)} } } if v, ok := _u.mutation.PeakEnd(); ok { if err := group.PeakEndValidator(v); err != nil { return &ValidationError{Name: "peak_end", err: fmt.Errorf(`ent: validator failed for field "Group.peak_end": %w`, err)} } } if v, ok := _u.mutation.Status(); ok { if err := group.StatusValidator(v); err != nil { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Group.status": %w`, err)} } } if v, ok := _u.mutation.Platform(); ok { if err := group.PlatformValidator(v); err != nil { return &ValidationError{Name: "platform", err: fmt.Errorf(`ent: validator failed for field "Group.platform": %w`, err)} } } if v, ok := _u.mutation.SubscriptionType(); ok { if err := group.SubscriptionTypeValidator(v); err != nil { return &ValidationError{Name: "subscription_type", err: fmt.Errorf(`ent: validator failed for field "Group.subscription_type": %w`, err)} } } if v, ok := _u.mutation.SearchPricePer1k(); ok { if err := group.SearchPricePer1kValidator(v); err != nil { return &ValidationError{Name: "search_price_per_1k", err: fmt.Errorf(`ent: validator failed for field "Group.search_price_per_1k": %w`, err)} } } if v, ok := _u.mutation.AudioRealtimePricePerMin(); ok { if err := group.AudioRealtimePricePerMinValidator(v); err != nil { return &ValidationError{Name: "audio_realtime_price_per_min", err: fmt.Errorf(`ent: validator failed for field "Group.audio_realtime_price_per_min": %w`, err)} } } if v, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok { if err := group.AudioTtsPricePerMillionCharsValidator(v); err != nil { return &ValidationError{Name: "audio_tts_price_per_million_chars", err: fmt.Errorf(`ent: validator failed for field "Group.audio_tts_price_per_million_chars": %w`, err)} } } if v, ok := _u.mutation.AudioSttPricePerHour(); ok { if err := group.AudioSttPricePerHourValidator(v); err != nil { return &ValidationError{Name: "audio_stt_price_per_hour", err: fmt.Errorf(`ent: validator failed for field "Group.audio_stt_price_per_hour": %w`, err)} } } if v, ok := _u.mutation.DefaultMappedModel(); ok { if err := group.DefaultMappedModelValidator(v); err != nil { return &ValidationError{Name: "default_mapped_model", err: fmt.Errorf(`ent: validator failed for field "Group.default_mapped_model": %w`, err)} } } if v, ok := _u.mutation.MaxReasoningEffort(); ok { if err := group.MaxReasoningEffortValidator(v); err != nil { return &ValidationError{Name: "max_reasoning_effort", err: fmt.Errorf(`ent: validator failed for field "Group.max_reasoning_effort": %w`, err)} } } return nil } func (_u *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeInt64)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Group.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) for _, f := range fields { if !group.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != group.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(group.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(group.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(group.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.Name(); ok { _spec.SetField(group.FieldName, field.TypeString, value) } if value, ok := _u.mutation.Description(); ok { _spec.SetField(group.FieldDescription, field.TypeString, value) } if _u.mutation.DescriptionCleared() { _spec.ClearField(group.FieldDescription, field.TypeString) } if value, ok := _u.mutation.RateMultiplier(); ok { _spec.SetField(group.FieldRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedRateMultiplier(); ok { _spec.AddField(group.FieldRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.PeakRateEnabled(); ok { _spec.SetField(group.FieldPeakRateEnabled, field.TypeBool, value) } if value, ok := _u.mutation.PeakStart(); ok { _spec.SetField(group.FieldPeakStart, field.TypeString, value) } if value, ok := _u.mutation.PeakEnd(); ok { _spec.SetField(group.FieldPeakEnd, field.TypeString, value) } if value, ok := _u.mutation.PeakRateMultiplier(); ok { _spec.SetField(group.FieldPeakRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedPeakRateMultiplier(); ok { _spec.AddField(group.FieldPeakRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.IsExclusive(); ok { _spec.SetField(group.FieldIsExclusive, field.TypeBool, value) } if value, ok := _u.mutation.Status(); ok { _spec.SetField(group.FieldStatus, field.TypeString, value) } if _u.mutation.DuplicateOperationIDCleared() { _spec.ClearField(group.FieldDuplicateOperationID, field.TypeString) } if value, ok := _u.mutation.Platform(); ok { _spec.SetField(group.FieldPlatform, field.TypeString, value) } if value, ok := _u.mutation.SubscriptionType(); ok { _spec.SetField(group.FieldSubscriptionType, field.TypeString, value) } if value, ok := _u.mutation.DailyLimitUsd(); ok { _spec.SetField(group.FieldDailyLimitUsd, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedDailyLimitUsd(); ok { _spec.AddField(group.FieldDailyLimitUsd, field.TypeFloat64, value) } if _u.mutation.DailyLimitUsdCleared() { _spec.ClearField(group.FieldDailyLimitUsd, field.TypeFloat64) } if value, ok := _u.mutation.WeeklyLimitUsd(); ok { _spec.SetField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedWeeklyLimitUsd(); ok { _spec.AddField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value) } if _u.mutation.WeeklyLimitUsdCleared() { _spec.ClearField(group.FieldWeeklyLimitUsd, field.TypeFloat64) } if value, ok := _u.mutation.MonthlyLimitUsd(); ok { _spec.SetField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedMonthlyLimitUsd(); ok { _spec.AddField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value) } if _u.mutation.MonthlyLimitUsdCleared() { _spec.ClearField(group.FieldMonthlyLimitUsd, field.TypeFloat64) } if value, ok := _u.mutation.DefaultValidityDays(); ok { _spec.SetField(group.FieldDefaultValidityDays, field.TypeInt, value) } if value, ok := _u.mutation.AddedDefaultValidityDays(); ok { _spec.AddField(group.FieldDefaultValidityDays, field.TypeInt, value) } if value, ok := _u.mutation.AllowImageGeneration(); ok { _spec.SetField(group.FieldAllowImageGeneration, field.TypeBool, value) } if value, ok := _u.mutation.AllowBatchImageGeneration(); ok { _spec.SetField(group.FieldAllowBatchImageGeneration, field.TypeBool, value) } if value, ok := _u.mutation.ImageRateIndependent(); ok { _spec.SetField(group.FieldImageRateIndependent, field.TypeBool, value) } if value, ok := _u.mutation.ImageRateMultiplier(); ok { _spec.SetField(group.FieldImageRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImageRateMultiplier(); ok { _spec.AddField(group.FieldImageRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.ImagePrice1k(); ok { _spec.SetField(group.FieldImagePrice1k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImagePrice1k(); ok { _spec.AddField(group.FieldImagePrice1k, field.TypeFloat64, value) } if _u.mutation.ImagePrice1kCleared() { _spec.ClearField(group.FieldImagePrice1k, field.TypeFloat64) } if value, ok := _u.mutation.ImagePrice2k(); ok { _spec.SetField(group.FieldImagePrice2k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImagePrice2k(); ok { _spec.AddField(group.FieldImagePrice2k, field.TypeFloat64, value) } if _u.mutation.ImagePrice2kCleared() { _spec.ClearField(group.FieldImagePrice2k, field.TypeFloat64) } if value, ok := _u.mutation.ImagePrice4k(); ok { _spec.SetField(group.FieldImagePrice4k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedImagePrice4k(); ok { _spec.AddField(group.FieldImagePrice4k, field.TypeFloat64, value) } if _u.mutation.ImagePrice4kCleared() { _spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64) } if value, ok := _u.mutation.BatchImageDiscountMultiplier(); ok { _spec.SetField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedBatchImageDiscountMultiplier(); ok { _spec.AddField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.BatchImageHoldMultiplier(); ok { _spec.SetField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedBatchImageHoldMultiplier(); ok { _spec.AddField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.VideoRateIndependent(); ok { _spec.SetField(group.FieldVideoRateIndependent, field.TypeBool, value) } if value, ok := _u.mutation.VideoRateMultiplier(); ok { _spec.SetField(group.FieldVideoRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoRateMultiplier(); ok { _spec.AddField(group.FieldVideoRateMultiplier, field.TypeFloat64, value) } if value, ok := _u.mutation.VideoPrice480p(); ok { _spec.SetField(group.FieldVideoPrice480p, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoPrice480p(); ok { _spec.AddField(group.FieldVideoPrice480p, field.TypeFloat64, value) } if _u.mutation.VideoPrice480pCleared() { _spec.ClearField(group.FieldVideoPrice480p, field.TypeFloat64) } if value, ok := _u.mutation.VideoPrice720p(); ok { _spec.SetField(group.FieldVideoPrice720p, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoPrice720p(); ok { _spec.AddField(group.FieldVideoPrice720p, field.TypeFloat64, value) } if _u.mutation.VideoPrice720pCleared() { _spec.ClearField(group.FieldVideoPrice720p, field.TypeFloat64) } if value, ok := _u.mutation.VideoPrice1080p(); ok { _spec.SetField(group.FieldVideoPrice1080p, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedVideoPrice1080p(); ok { _spec.AddField(group.FieldVideoPrice1080p, field.TypeFloat64, value) } if _u.mutation.VideoPrice1080pCleared() { _spec.ClearField(group.FieldVideoPrice1080p, field.TypeFloat64) } if value, ok := _u.mutation.VideoModelPrices(); ok { _spec.SetField(group.FieldVideoModelPrices, field.TypeJSON, value) } if _u.mutation.VideoModelPricesCleared() { _spec.ClearField(group.FieldVideoModelPrices, field.TypeJSON) } if value, ok := _u.mutation.WebSearchPricePerCall(); ok { _spec.SetField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedWebSearchPricePerCall(); ok { _spec.AddField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value) } if _u.mutation.WebSearchPricePerCallCleared() { _spec.ClearField(group.FieldWebSearchPricePerCall, field.TypeFloat64) } if value, ok := _u.mutation.SearchPricePer1k(); ok { _spec.SetField(group.FieldSearchPricePer1k, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedSearchPricePer1k(); ok { _spec.AddField(group.FieldSearchPricePer1k, field.TypeFloat64, value) } if _u.mutation.SearchPricePer1kCleared() { _spec.ClearField(group.FieldSearchPricePer1k, field.TypeFloat64) } if value, ok := _u.mutation.AudioRealtimePricePerMin(); ok { _spec.SetField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedAudioRealtimePricePerMin(); ok { _spec.AddField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value) } if _u.mutation.AudioRealtimePricePerMinCleared() { _spec.ClearField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64) } if value, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok { _spec.SetField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedAudioTtsPricePerMillionChars(); ok { _spec.AddField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value) } if _u.mutation.AudioTtsPricePerMillionCharsCleared() { _spec.ClearField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64) } if value, ok := _u.mutation.AudioSttPricePerHour(); ok { _spec.SetField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedAudioSttPricePerHour(); ok { _spec.AddField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value) } if _u.mutation.AudioSttPricePerHourCleared() { _spec.ClearField(group.FieldAudioSttPricePerHour, field.TypeFloat64) } if value, ok := _u.mutation.LongContextPricingEnabled(); ok { _spec.SetField(group.FieldLongContextPricingEnabled, field.TypeBool, value) } if value, ok := _u.mutation.ModelPricing(); ok { _spec.SetField(group.FieldModelPricing, field.TypeJSON, value) } if value, ok := _u.mutation.AppendedModelPricing(); ok { _spec.AddModifier(func(u *sql.UpdateBuilder) { sqljson.Append(u, group.FieldModelPricing, value) }) } if _u.mutation.ModelPricingCleared() { _spec.ClearField(group.FieldModelPricing, field.TypeJSON) } if value, ok := _u.mutation.ClaudeCodeOnly(); ok { _spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value) } if value, ok := _u.mutation.FallbackGroupID(); ok { _spec.SetField(group.FieldFallbackGroupID, field.TypeInt64, value) } if value, ok := _u.mutation.AddedFallbackGroupID(); ok { _spec.AddField(group.FieldFallbackGroupID, field.TypeInt64, value) } if _u.mutation.FallbackGroupIDCleared() { _spec.ClearField(group.FieldFallbackGroupID, field.TypeInt64) } if value, ok := _u.mutation.FallbackGroupIDOnInvalidRequest(); ok { _spec.SetField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value) } if value, ok := _u.mutation.AddedFallbackGroupIDOnInvalidRequest(); ok { _spec.AddField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value) } if _u.mutation.FallbackGroupIDOnInvalidRequestCleared() { _spec.ClearField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64) } if value, ok := _u.mutation.ModelRouting(); ok { _spec.SetField(group.FieldModelRouting, field.TypeJSON, value) } if _u.mutation.ModelRoutingCleared() { _spec.ClearField(group.FieldModelRouting, field.TypeJSON) } if value, ok := _u.mutation.ModelRoutingEnabled(); ok { _spec.SetField(group.FieldModelRoutingEnabled, field.TypeBool, value) } if value, ok := _u.mutation.McpXMLInject(); ok { _spec.SetField(group.FieldMcpXMLInject, field.TypeBool, value) } if value, ok := _u.mutation.SupportedModelScopes(); ok { _spec.SetField(group.FieldSupportedModelScopes, field.TypeJSON, value) } if value, ok := _u.mutation.AppendedSupportedModelScopes(); ok { _spec.AddModifier(func(u *sql.UpdateBuilder) { sqljson.Append(u, group.FieldSupportedModelScopes, value) }) } if value, ok := _u.mutation.SortOrder(); ok { _spec.SetField(group.FieldSortOrder, field.TypeInt, value) } if value, ok := _u.mutation.AddedSortOrder(); ok { _spec.AddField(group.FieldSortOrder, field.TypeInt, value) } if value, ok := _u.mutation.AllowMessagesDispatch(); ok { _spec.SetField(group.FieldAllowMessagesDispatch, field.TypeBool, value) } if value, ok := _u.mutation.AllowLive(); ok { _spec.SetField(group.FieldAllowLive, field.TypeBool, value) } if value, ok := _u.mutation.RequireOauthOnly(); ok { _spec.SetField(group.FieldRequireOauthOnly, field.TypeBool, value) } if value, ok := _u.mutation.RequirePrivacySet(); ok { _spec.SetField(group.FieldRequirePrivacySet, field.TypeBool, value) } if value, ok := _u.mutation.DefaultMappedModel(); ok { _spec.SetField(group.FieldDefaultMappedModel, field.TypeString, value) } if value, ok := _u.mutation.MessagesDispatchModelConfig(); ok { _spec.SetField(group.FieldMessagesDispatchModelConfig, field.TypeJSON, value) } if value, ok := _u.mutation.ModelsListConfig(); ok { _spec.SetField(group.FieldModelsListConfig, field.TypeJSON, value) } if value, ok := _u.mutation.RpmLimit(); ok { _spec.SetField(group.FieldRpmLimit, field.TypeInt, value) } if value, ok := _u.mutation.AddedRpmLimit(); ok { _spec.AddField(group.FieldRpmLimit, field.TypeInt, value) } if value, ok := _u.mutation.MaxReasoningEffort(); ok { _spec.SetField(group.FieldMaxReasoningEffort, field.TypeString, value) } if value, ok := _u.mutation.ReasoningEffortMappings(); ok { _spec.SetField(group.FieldReasoningEffortMappings, field.TypeJSON, value) } if value, ok := _u.mutation.AppendedReasoningEffortMappings(); ok { _spec.AddModifier(func(u *sql.UpdateBuilder) { sqljson.Append(u, group.FieldReasoningEffortMappings, value) }) } if value, ok := _u.mutation.ProfitControlEnabled(); ok { _spec.SetField(group.FieldProfitControlEnabled, field.TypeBool, value) } if value, ok := _u.mutation.ProfitMinMargin(); ok { _spec.SetField(group.FieldProfitMinMargin, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedProfitMinMargin(); ok { _spec.AddField(group.FieldProfitMinMargin, field.TypeFloat64, value) } if value, ok := _u.mutation.ProfitSafetyBuffer(); ok { _spec.SetField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value) } if value, ok := _u.mutation.AddedProfitSafetyBuffer(); ok { _spec.AddField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value) } if _u.mutation.APIKeysCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.APIKeysTable, Columns: []string{group.APIKeysColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAPIKeysIDs(); len(nodes) > 0 && !_u.mutation.APIKeysCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.APIKeysTable, Columns: []string{group.APIKeysColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.APIKeysIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.APIKeysTable, Columns: []string{group.APIKeysColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.RedeemCodesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.RedeemCodesTable, Columns: []string{group.RedeemCodesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedRedeemCodesIDs(); len(nodes) > 0 && !_u.mutation.RedeemCodesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.RedeemCodesTable, Columns: []string{group.RedeemCodesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RedeemCodesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.RedeemCodesTable, Columns: []string{group.RedeemCodesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.SubscriptionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.SubscriptionsTable, Columns: []string{group.SubscriptionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSubscriptionsIDs(); len(nodes) > 0 && !_u.mutation.SubscriptionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.SubscriptionsTable, Columns: []string{group.SubscriptionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubscriptionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.SubscriptionsTable, Columns: []string{group.SubscriptionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.UsageLogsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.UsageLogsTable, Columns: []string{group.UsageLogsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedUsageLogsIDs(); len(nodes) > 0 && !_u.mutation.UsageLogsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.UsageLogsTable, Columns: []string{group.UsageLogsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UsageLogsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: group.UsageLogsTable, Columns: []string{group.UsageLogsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.AccountsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AccountsTable, Columns: group.AccountsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64), }, } createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAccountsIDs(); len(nodes) > 0 && !_u.mutation.AccountsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AccountsTable, Columns: group.AccountsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AccountsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AccountsTable, Columns: group.AccountsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.AllowedUsersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AllowedUsersTable, Columns: group.AllowedUsersPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64), }, } createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAllowedUsersIDs(); len(nodes) > 0 && !_u.mutation.AllowedUsersCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AllowedUsersTable, Columns: group.AllowedUsersPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AllowedUsersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, Table: group.AllowedUsersTable, Columns: group.AllowedUsersPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)} createE.defaults() _, specE := createE.createSpec() edge.Target.Fields = specE.Fields _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &Group{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil }