group_update.go 150 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563
  1. // Code generated by ent, DO NOT EDIT.
  2. package ent
  3. import (
  4. "context"
  5. "encoding/json/jsontext"
  6. "errors"
  7. "fmt"
  8. "time"
  9. "entgo.io/ent/dialect/sql"
  10. "entgo.io/ent/dialect/sql/sqlgraph"
  11. "entgo.io/ent/dialect/sql/sqljson"
  12. "entgo.io/ent/schema/field"
  13. "github.com/Wei-Shaw/sub2api/ent/account"
  14. "github.com/Wei-Shaw/sub2api/ent/apikey"
  15. "github.com/Wei-Shaw/sub2api/ent/group"
  16. "github.com/Wei-Shaw/sub2api/ent/predicate"
  17. "github.com/Wei-Shaw/sub2api/ent/redeemcode"
  18. "github.com/Wei-Shaw/sub2api/ent/usagelog"
  19. "github.com/Wei-Shaw/sub2api/ent/user"
  20. "github.com/Wei-Shaw/sub2api/ent/usersubscription"
  21. "github.com/Wei-Shaw/sub2api/internal/domain"
  22. )
  23. // GroupUpdate is the builder for updating Group entities.
  24. type GroupUpdate struct {
  25. config
  26. hooks []Hook
  27. mutation *GroupMutation
  28. }
  29. // Where appends a list predicates to the GroupUpdate builder.
  30. func (_u *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate {
  31. _u.mutation.Where(ps...)
  32. return _u
  33. }
  34. // SetUpdatedAt sets the "updated_at" field.
  35. func (_u *GroupUpdate) SetUpdatedAt(v time.Time) *GroupUpdate {
  36. _u.mutation.SetUpdatedAt(v)
  37. return _u
  38. }
  39. // SetDeletedAt sets the "deleted_at" field.
  40. func (_u *GroupUpdate) SetDeletedAt(v time.Time) *GroupUpdate {
  41. _u.mutation.SetDeletedAt(v)
  42. return _u
  43. }
  44. // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
  45. func (_u *GroupUpdate) SetNillableDeletedAt(v *time.Time) *GroupUpdate {
  46. if v != nil {
  47. _u.SetDeletedAt(*v)
  48. }
  49. return _u
  50. }
  51. // ClearDeletedAt clears the value of the "deleted_at" field.
  52. func (_u *GroupUpdate) ClearDeletedAt() *GroupUpdate {
  53. _u.mutation.ClearDeletedAt()
  54. return _u
  55. }
  56. // SetName sets the "name" field.
  57. func (_u *GroupUpdate) SetName(v string) *GroupUpdate {
  58. _u.mutation.SetName(v)
  59. return _u
  60. }
  61. // SetNillableName sets the "name" field if the given value is not nil.
  62. func (_u *GroupUpdate) SetNillableName(v *string) *GroupUpdate {
  63. if v != nil {
  64. _u.SetName(*v)
  65. }
  66. return _u
  67. }
  68. // SetDescription sets the "description" field.
  69. func (_u *GroupUpdate) SetDescription(v string) *GroupUpdate {
  70. _u.mutation.SetDescription(v)
  71. return _u
  72. }
  73. // SetNillableDescription sets the "description" field if the given value is not nil.
  74. func (_u *GroupUpdate) SetNillableDescription(v *string) *GroupUpdate {
  75. if v != nil {
  76. _u.SetDescription(*v)
  77. }
  78. return _u
  79. }
  80. // ClearDescription clears the value of the "description" field.
  81. func (_u *GroupUpdate) ClearDescription() *GroupUpdate {
  82. _u.mutation.ClearDescription()
  83. return _u
  84. }
  85. // SetRateMultiplier sets the "rate_multiplier" field.
  86. func (_u *GroupUpdate) SetRateMultiplier(v float64) *GroupUpdate {
  87. _u.mutation.ResetRateMultiplier()
  88. _u.mutation.SetRateMultiplier(v)
  89. return _u
  90. }
  91. // SetNillableRateMultiplier sets the "rate_multiplier" field if the given value is not nil.
  92. func (_u *GroupUpdate) SetNillableRateMultiplier(v *float64) *GroupUpdate {
  93. if v != nil {
  94. _u.SetRateMultiplier(*v)
  95. }
  96. return _u
  97. }
  98. // AddRateMultiplier adds value to the "rate_multiplier" field.
  99. func (_u *GroupUpdate) AddRateMultiplier(v float64) *GroupUpdate {
  100. _u.mutation.AddRateMultiplier(v)
  101. return _u
  102. }
  103. // SetPeakRateEnabled sets the "peak_rate_enabled" field.
  104. func (_u *GroupUpdate) SetPeakRateEnabled(v bool) *GroupUpdate {
  105. _u.mutation.SetPeakRateEnabled(v)
  106. return _u
  107. }
  108. // SetNillablePeakRateEnabled sets the "peak_rate_enabled" field if the given value is not nil.
  109. func (_u *GroupUpdate) SetNillablePeakRateEnabled(v *bool) *GroupUpdate {
  110. if v != nil {
  111. _u.SetPeakRateEnabled(*v)
  112. }
  113. return _u
  114. }
  115. // SetPeakStart sets the "peak_start" field.
  116. func (_u *GroupUpdate) SetPeakStart(v string) *GroupUpdate {
  117. _u.mutation.SetPeakStart(v)
  118. return _u
  119. }
  120. // SetNillablePeakStart sets the "peak_start" field if the given value is not nil.
  121. func (_u *GroupUpdate) SetNillablePeakStart(v *string) *GroupUpdate {
  122. if v != nil {
  123. _u.SetPeakStart(*v)
  124. }
  125. return _u
  126. }
  127. // SetPeakEnd sets the "peak_end" field.
  128. func (_u *GroupUpdate) SetPeakEnd(v string) *GroupUpdate {
  129. _u.mutation.SetPeakEnd(v)
  130. return _u
  131. }
  132. // SetNillablePeakEnd sets the "peak_end" field if the given value is not nil.
  133. func (_u *GroupUpdate) SetNillablePeakEnd(v *string) *GroupUpdate {
  134. if v != nil {
  135. _u.SetPeakEnd(*v)
  136. }
  137. return _u
  138. }
  139. // SetPeakRateMultiplier sets the "peak_rate_multiplier" field.
  140. func (_u *GroupUpdate) SetPeakRateMultiplier(v float64) *GroupUpdate {
  141. _u.mutation.ResetPeakRateMultiplier()
  142. _u.mutation.SetPeakRateMultiplier(v)
  143. return _u
  144. }
  145. // SetNillablePeakRateMultiplier sets the "peak_rate_multiplier" field if the given value is not nil.
  146. func (_u *GroupUpdate) SetNillablePeakRateMultiplier(v *float64) *GroupUpdate {
  147. if v != nil {
  148. _u.SetPeakRateMultiplier(*v)
  149. }
  150. return _u
  151. }
  152. // AddPeakRateMultiplier adds value to the "peak_rate_multiplier" field.
  153. func (_u *GroupUpdate) AddPeakRateMultiplier(v float64) *GroupUpdate {
  154. _u.mutation.AddPeakRateMultiplier(v)
  155. return _u
  156. }
  157. // SetIsExclusive sets the "is_exclusive" field.
  158. func (_u *GroupUpdate) SetIsExclusive(v bool) *GroupUpdate {
  159. _u.mutation.SetIsExclusive(v)
  160. return _u
  161. }
  162. // SetNillableIsExclusive sets the "is_exclusive" field if the given value is not nil.
  163. func (_u *GroupUpdate) SetNillableIsExclusive(v *bool) *GroupUpdate {
  164. if v != nil {
  165. _u.SetIsExclusive(*v)
  166. }
  167. return _u
  168. }
  169. // SetSecurityPolicyEnabled sets the "security_policy_enabled" field.
  170. func (_u *GroupUpdate) SetSecurityPolicyEnabled(v bool) *GroupUpdate {
  171. _u.mutation.SetSecurityPolicyEnabled(v)
  172. return _u
  173. }
  174. // SetNillableSecurityPolicyEnabled sets the "security_policy_enabled" field if the given value is not nil.
  175. func (_u *GroupUpdate) SetNillableSecurityPolicyEnabled(v *bool) *GroupUpdate {
  176. if v != nil {
  177. _u.SetSecurityPolicyEnabled(*v)
  178. }
  179. return _u
  180. }
  181. // SetSecurityPolicyMode sets the "security_policy_mode" field.
  182. func (_u *GroupUpdate) SetSecurityPolicyMode(v string) *GroupUpdate {
  183. _u.mutation.SetSecurityPolicyMode(v)
  184. return _u
  185. }
  186. // SetNillableSecurityPolicyMode sets the "security_policy_mode" field if the given value is not nil.
  187. func (_u *GroupUpdate) SetNillableSecurityPolicyMode(v *string) *GroupUpdate {
  188. if v != nil {
  189. _u.SetSecurityPolicyMode(*v)
  190. }
  191. return _u
  192. }
  193. // SetSecurityPolicyEmailEnabled sets the "security_policy_email_enabled" field.
  194. func (_u *GroupUpdate) SetSecurityPolicyEmailEnabled(v bool) *GroupUpdate {
  195. _u.mutation.SetSecurityPolicyEmailEnabled(v)
  196. return _u
  197. }
  198. // SetNillableSecurityPolicyEmailEnabled sets the "security_policy_email_enabled" field if the given value is not nil.
  199. func (_u *GroupUpdate) SetNillableSecurityPolicyEmailEnabled(v *bool) *GroupUpdate {
  200. if v != nil {
  201. _u.SetSecurityPolicyEmailEnabled(*v)
  202. }
  203. return _u
  204. }
  205. // SetStatus sets the "status" field.
  206. func (_u *GroupUpdate) SetStatus(v string) *GroupUpdate {
  207. _u.mutation.SetStatus(v)
  208. return _u
  209. }
  210. // SetNillableStatus sets the "status" field if the given value is not nil.
  211. func (_u *GroupUpdate) SetNillableStatus(v *string) *GroupUpdate {
  212. if v != nil {
  213. _u.SetStatus(*v)
  214. }
  215. return _u
  216. }
  217. // SetPlatform sets the "platform" field.
  218. func (_u *GroupUpdate) SetPlatform(v string) *GroupUpdate {
  219. _u.mutation.SetPlatform(v)
  220. return _u
  221. }
  222. // SetNillablePlatform sets the "platform" field if the given value is not nil.
  223. func (_u *GroupUpdate) SetNillablePlatform(v *string) *GroupUpdate {
  224. if v != nil {
  225. _u.SetPlatform(*v)
  226. }
  227. return _u
  228. }
  229. // SetSubscriptionType sets the "subscription_type" field.
  230. func (_u *GroupUpdate) SetSubscriptionType(v string) *GroupUpdate {
  231. _u.mutation.SetSubscriptionType(v)
  232. return _u
  233. }
  234. // SetNillableSubscriptionType sets the "subscription_type" field if the given value is not nil.
  235. func (_u *GroupUpdate) SetNillableSubscriptionType(v *string) *GroupUpdate {
  236. if v != nil {
  237. _u.SetSubscriptionType(*v)
  238. }
  239. return _u
  240. }
  241. // SetDailyLimitUsd sets the "daily_limit_usd" field.
  242. func (_u *GroupUpdate) SetDailyLimitUsd(v float64) *GroupUpdate {
  243. _u.mutation.ResetDailyLimitUsd()
  244. _u.mutation.SetDailyLimitUsd(v)
  245. return _u
  246. }
  247. // SetNillableDailyLimitUsd sets the "daily_limit_usd" field if the given value is not nil.
  248. func (_u *GroupUpdate) SetNillableDailyLimitUsd(v *float64) *GroupUpdate {
  249. if v != nil {
  250. _u.SetDailyLimitUsd(*v)
  251. }
  252. return _u
  253. }
  254. // AddDailyLimitUsd adds value to the "daily_limit_usd" field.
  255. func (_u *GroupUpdate) AddDailyLimitUsd(v float64) *GroupUpdate {
  256. _u.mutation.AddDailyLimitUsd(v)
  257. return _u
  258. }
  259. // ClearDailyLimitUsd clears the value of the "daily_limit_usd" field.
  260. func (_u *GroupUpdate) ClearDailyLimitUsd() *GroupUpdate {
  261. _u.mutation.ClearDailyLimitUsd()
  262. return _u
  263. }
  264. // SetWeeklyLimitUsd sets the "weekly_limit_usd" field.
  265. func (_u *GroupUpdate) SetWeeklyLimitUsd(v float64) *GroupUpdate {
  266. _u.mutation.ResetWeeklyLimitUsd()
  267. _u.mutation.SetWeeklyLimitUsd(v)
  268. return _u
  269. }
  270. // SetNillableWeeklyLimitUsd sets the "weekly_limit_usd" field if the given value is not nil.
  271. func (_u *GroupUpdate) SetNillableWeeklyLimitUsd(v *float64) *GroupUpdate {
  272. if v != nil {
  273. _u.SetWeeklyLimitUsd(*v)
  274. }
  275. return _u
  276. }
  277. // AddWeeklyLimitUsd adds value to the "weekly_limit_usd" field.
  278. func (_u *GroupUpdate) AddWeeklyLimitUsd(v float64) *GroupUpdate {
  279. _u.mutation.AddWeeklyLimitUsd(v)
  280. return _u
  281. }
  282. // ClearWeeklyLimitUsd clears the value of the "weekly_limit_usd" field.
  283. func (_u *GroupUpdate) ClearWeeklyLimitUsd() *GroupUpdate {
  284. _u.mutation.ClearWeeklyLimitUsd()
  285. return _u
  286. }
  287. // SetMonthlyLimitUsd sets the "monthly_limit_usd" field.
  288. func (_u *GroupUpdate) SetMonthlyLimitUsd(v float64) *GroupUpdate {
  289. _u.mutation.ResetMonthlyLimitUsd()
  290. _u.mutation.SetMonthlyLimitUsd(v)
  291. return _u
  292. }
  293. // SetNillableMonthlyLimitUsd sets the "monthly_limit_usd" field if the given value is not nil.
  294. func (_u *GroupUpdate) SetNillableMonthlyLimitUsd(v *float64) *GroupUpdate {
  295. if v != nil {
  296. _u.SetMonthlyLimitUsd(*v)
  297. }
  298. return _u
  299. }
  300. // AddMonthlyLimitUsd adds value to the "monthly_limit_usd" field.
  301. func (_u *GroupUpdate) AddMonthlyLimitUsd(v float64) *GroupUpdate {
  302. _u.mutation.AddMonthlyLimitUsd(v)
  303. return _u
  304. }
  305. // ClearMonthlyLimitUsd clears the value of the "monthly_limit_usd" field.
  306. func (_u *GroupUpdate) ClearMonthlyLimitUsd() *GroupUpdate {
  307. _u.mutation.ClearMonthlyLimitUsd()
  308. return _u
  309. }
  310. // SetDefaultValidityDays sets the "default_validity_days" field.
  311. func (_u *GroupUpdate) SetDefaultValidityDays(v int) *GroupUpdate {
  312. _u.mutation.ResetDefaultValidityDays()
  313. _u.mutation.SetDefaultValidityDays(v)
  314. return _u
  315. }
  316. // SetNillableDefaultValidityDays sets the "default_validity_days" field if the given value is not nil.
  317. func (_u *GroupUpdate) SetNillableDefaultValidityDays(v *int) *GroupUpdate {
  318. if v != nil {
  319. _u.SetDefaultValidityDays(*v)
  320. }
  321. return _u
  322. }
  323. // AddDefaultValidityDays adds value to the "default_validity_days" field.
  324. func (_u *GroupUpdate) AddDefaultValidityDays(v int) *GroupUpdate {
  325. _u.mutation.AddDefaultValidityDays(v)
  326. return _u
  327. }
  328. // SetAllowImageGeneration sets the "allow_image_generation" field.
  329. func (_u *GroupUpdate) SetAllowImageGeneration(v bool) *GroupUpdate {
  330. _u.mutation.SetAllowImageGeneration(v)
  331. return _u
  332. }
  333. // SetNillableAllowImageGeneration sets the "allow_image_generation" field if the given value is not nil.
  334. func (_u *GroupUpdate) SetNillableAllowImageGeneration(v *bool) *GroupUpdate {
  335. if v != nil {
  336. _u.SetAllowImageGeneration(*v)
  337. }
  338. return _u
  339. }
  340. // SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
  341. func (_u *GroupUpdate) SetAllowBatchImageGeneration(v bool) *GroupUpdate {
  342. _u.mutation.SetAllowBatchImageGeneration(v)
  343. return _u
  344. }
  345. // SetNillableAllowBatchImageGeneration sets the "allow_batch_image_generation" field if the given value is not nil.
  346. func (_u *GroupUpdate) SetNillableAllowBatchImageGeneration(v *bool) *GroupUpdate {
  347. if v != nil {
  348. _u.SetAllowBatchImageGeneration(*v)
  349. }
  350. return _u
  351. }
  352. // SetImageRateIndependent sets the "image_rate_independent" field.
  353. func (_u *GroupUpdate) SetImageRateIndependent(v bool) *GroupUpdate {
  354. _u.mutation.SetImageRateIndependent(v)
  355. return _u
  356. }
  357. // SetNillableImageRateIndependent sets the "image_rate_independent" field if the given value is not nil.
  358. func (_u *GroupUpdate) SetNillableImageRateIndependent(v *bool) *GroupUpdate {
  359. if v != nil {
  360. _u.SetImageRateIndependent(*v)
  361. }
  362. return _u
  363. }
  364. // SetImageRateMultiplier sets the "image_rate_multiplier" field.
  365. func (_u *GroupUpdate) SetImageRateMultiplier(v float64) *GroupUpdate {
  366. _u.mutation.ResetImageRateMultiplier()
  367. _u.mutation.SetImageRateMultiplier(v)
  368. return _u
  369. }
  370. // SetNillableImageRateMultiplier sets the "image_rate_multiplier" field if the given value is not nil.
  371. func (_u *GroupUpdate) SetNillableImageRateMultiplier(v *float64) *GroupUpdate {
  372. if v != nil {
  373. _u.SetImageRateMultiplier(*v)
  374. }
  375. return _u
  376. }
  377. // AddImageRateMultiplier adds value to the "image_rate_multiplier" field.
  378. func (_u *GroupUpdate) AddImageRateMultiplier(v float64) *GroupUpdate {
  379. _u.mutation.AddImageRateMultiplier(v)
  380. return _u
  381. }
  382. // SetImagePrice1k sets the "image_price_1k" field.
  383. func (_u *GroupUpdate) SetImagePrice1k(v float64) *GroupUpdate {
  384. _u.mutation.ResetImagePrice1k()
  385. _u.mutation.SetImagePrice1k(v)
  386. return _u
  387. }
  388. // SetNillableImagePrice1k sets the "image_price_1k" field if the given value is not nil.
  389. func (_u *GroupUpdate) SetNillableImagePrice1k(v *float64) *GroupUpdate {
  390. if v != nil {
  391. _u.SetImagePrice1k(*v)
  392. }
  393. return _u
  394. }
  395. // AddImagePrice1k adds value to the "image_price_1k" field.
  396. func (_u *GroupUpdate) AddImagePrice1k(v float64) *GroupUpdate {
  397. _u.mutation.AddImagePrice1k(v)
  398. return _u
  399. }
  400. // ClearImagePrice1k clears the value of the "image_price_1k" field.
  401. func (_u *GroupUpdate) ClearImagePrice1k() *GroupUpdate {
  402. _u.mutation.ClearImagePrice1k()
  403. return _u
  404. }
  405. // SetImagePrice2k sets the "image_price_2k" field.
  406. func (_u *GroupUpdate) SetImagePrice2k(v float64) *GroupUpdate {
  407. _u.mutation.ResetImagePrice2k()
  408. _u.mutation.SetImagePrice2k(v)
  409. return _u
  410. }
  411. // SetNillableImagePrice2k sets the "image_price_2k" field if the given value is not nil.
  412. func (_u *GroupUpdate) SetNillableImagePrice2k(v *float64) *GroupUpdate {
  413. if v != nil {
  414. _u.SetImagePrice2k(*v)
  415. }
  416. return _u
  417. }
  418. // AddImagePrice2k adds value to the "image_price_2k" field.
  419. func (_u *GroupUpdate) AddImagePrice2k(v float64) *GroupUpdate {
  420. _u.mutation.AddImagePrice2k(v)
  421. return _u
  422. }
  423. // ClearImagePrice2k clears the value of the "image_price_2k" field.
  424. func (_u *GroupUpdate) ClearImagePrice2k() *GroupUpdate {
  425. _u.mutation.ClearImagePrice2k()
  426. return _u
  427. }
  428. // SetImagePrice4k sets the "image_price_4k" field.
  429. func (_u *GroupUpdate) SetImagePrice4k(v float64) *GroupUpdate {
  430. _u.mutation.ResetImagePrice4k()
  431. _u.mutation.SetImagePrice4k(v)
  432. return _u
  433. }
  434. // SetNillableImagePrice4k sets the "image_price_4k" field if the given value is not nil.
  435. func (_u *GroupUpdate) SetNillableImagePrice4k(v *float64) *GroupUpdate {
  436. if v != nil {
  437. _u.SetImagePrice4k(*v)
  438. }
  439. return _u
  440. }
  441. // AddImagePrice4k adds value to the "image_price_4k" field.
  442. func (_u *GroupUpdate) AddImagePrice4k(v float64) *GroupUpdate {
  443. _u.mutation.AddImagePrice4k(v)
  444. return _u
  445. }
  446. // ClearImagePrice4k clears the value of the "image_price_4k" field.
  447. func (_u *GroupUpdate) ClearImagePrice4k() *GroupUpdate {
  448. _u.mutation.ClearImagePrice4k()
  449. return _u
  450. }
  451. // SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
  452. func (_u *GroupUpdate) SetBatchImageDiscountMultiplier(v float64) *GroupUpdate {
  453. _u.mutation.ResetBatchImageDiscountMultiplier()
  454. _u.mutation.SetBatchImageDiscountMultiplier(v)
  455. return _u
  456. }
  457. // SetNillableBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field if the given value is not nil.
  458. func (_u *GroupUpdate) SetNillableBatchImageDiscountMultiplier(v *float64) *GroupUpdate {
  459. if v != nil {
  460. _u.SetBatchImageDiscountMultiplier(*v)
  461. }
  462. return _u
  463. }
  464. // AddBatchImageDiscountMultiplier adds value to the "batch_image_discount_multiplier" field.
  465. func (_u *GroupUpdate) AddBatchImageDiscountMultiplier(v float64) *GroupUpdate {
  466. _u.mutation.AddBatchImageDiscountMultiplier(v)
  467. return _u
  468. }
  469. // SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
  470. func (_u *GroupUpdate) SetBatchImageHoldMultiplier(v float64) *GroupUpdate {
  471. _u.mutation.ResetBatchImageHoldMultiplier()
  472. _u.mutation.SetBatchImageHoldMultiplier(v)
  473. return _u
  474. }
  475. // SetNillableBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field if the given value is not nil.
  476. func (_u *GroupUpdate) SetNillableBatchImageHoldMultiplier(v *float64) *GroupUpdate {
  477. if v != nil {
  478. _u.SetBatchImageHoldMultiplier(*v)
  479. }
  480. return _u
  481. }
  482. // AddBatchImageHoldMultiplier adds value to the "batch_image_hold_multiplier" field.
  483. func (_u *GroupUpdate) AddBatchImageHoldMultiplier(v float64) *GroupUpdate {
  484. _u.mutation.AddBatchImageHoldMultiplier(v)
  485. return _u
  486. }
  487. // SetVideoRateIndependent sets the "video_rate_independent" field.
  488. func (_u *GroupUpdate) SetVideoRateIndependent(v bool) *GroupUpdate {
  489. _u.mutation.SetVideoRateIndependent(v)
  490. return _u
  491. }
  492. // SetNillableVideoRateIndependent sets the "video_rate_independent" field if the given value is not nil.
  493. func (_u *GroupUpdate) SetNillableVideoRateIndependent(v *bool) *GroupUpdate {
  494. if v != nil {
  495. _u.SetVideoRateIndependent(*v)
  496. }
  497. return _u
  498. }
  499. // SetVideoRateMultiplier sets the "video_rate_multiplier" field.
  500. func (_u *GroupUpdate) SetVideoRateMultiplier(v float64) *GroupUpdate {
  501. _u.mutation.ResetVideoRateMultiplier()
  502. _u.mutation.SetVideoRateMultiplier(v)
  503. return _u
  504. }
  505. // SetNillableVideoRateMultiplier sets the "video_rate_multiplier" field if the given value is not nil.
  506. func (_u *GroupUpdate) SetNillableVideoRateMultiplier(v *float64) *GroupUpdate {
  507. if v != nil {
  508. _u.SetVideoRateMultiplier(*v)
  509. }
  510. return _u
  511. }
  512. // AddVideoRateMultiplier adds value to the "video_rate_multiplier" field.
  513. func (_u *GroupUpdate) AddVideoRateMultiplier(v float64) *GroupUpdate {
  514. _u.mutation.AddVideoRateMultiplier(v)
  515. return _u
  516. }
  517. // SetVideoPrice480p sets the "video_price_480p" field.
  518. func (_u *GroupUpdate) SetVideoPrice480p(v float64) *GroupUpdate {
  519. _u.mutation.ResetVideoPrice480p()
  520. _u.mutation.SetVideoPrice480p(v)
  521. return _u
  522. }
  523. // SetNillableVideoPrice480p sets the "video_price_480p" field if the given value is not nil.
  524. func (_u *GroupUpdate) SetNillableVideoPrice480p(v *float64) *GroupUpdate {
  525. if v != nil {
  526. _u.SetVideoPrice480p(*v)
  527. }
  528. return _u
  529. }
  530. // AddVideoPrice480p adds value to the "video_price_480p" field.
  531. func (_u *GroupUpdate) AddVideoPrice480p(v float64) *GroupUpdate {
  532. _u.mutation.AddVideoPrice480p(v)
  533. return _u
  534. }
  535. // ClearVideoPrice480p clears the value of the "video_price_480p" field.
  536. func (_u *GroupUpdate) ClearVideoPrice480p() *GroupUpdate {
  537. _u.mutation.ClearVideoPrice480p()
  538. return _u
  539. }
  540. // SetVideoPrice720p sets the "video_price_720p" field.
  541. func (_u *GroupUpdate) SetVideoPrice720p(v float64) *GroupUpdate {
  542. _u.mutation.ResetVideoPrice720p()
  543. _u.mutation.SetVideoPrice720p(v)
  544. return _u
  545. }
  546. // SetNillableVideoPrice720p sets the "video_price_720p" field if the given value is not nil.
  547. func (_u *GroupUpdate) SetNillableVideoPrice720p(v *float64) *GroupUpdate {
  548. if v != nil {
  549. _u.SetVideoPrice720p(*v)
  550. }
  551. return _u
  552. }
  553. // AddVideoPrice720p adds value to the "video_price_720p" field.
  554. func (_u *GroupUpdate) AddVideoPrice720p(v float64) *GroupUpdate {
  555. _u.mutation.AddVideoPrice720p(v)
  556. return _u
  557. }
  558. // ClearVideoPrice720p clears the value of the "video_price_720p" field.
  559. func (_u *GroupUpdate) ClearVideoPrice720p() *GroupUpdate {
  560. _u.mutation.ClearVideoPrice720p()
  561. return _u
  562. }
  563. // SetVideoPrice1080p sets the "video_price_1080p" field.
  564. func (_u *GroupUpdate) SetVideoPrice1080p(v float64) *GroupUpdate {
  565. _u.mutation.ResetVideoPrice1080p()
  566. _u.mutation.SetVideoPrice1080p(v)
  567. return _u
  568. }
  569. // SetNillableVideoPrice1080p sets the "video_price_1080p" field if the given value is not nil.
  570. func (_u *GroupUpdate) SetNillableVideoPrice1080p(v *float64) *GroupUpdate {
  571. if v != nil {
  572. _u.SetVideoPrice1080p(*v)
  573. }
  574. return _u
  575. }
  576. // AddVideoPrice1080p adds value to the "video_price_1080p" field.
  577. func (_u *GroupUpdate) AddVideoPrice1080p(v float64) *GroupUpdate {
  578. _u.mutation.AddVideoPrice1080p(v)
  579. return _u
  580. }
  581. // ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
  582. func (_u *GroupUpdate) ClearVideoPrice1080p() *GroupUpdate {
  583. _u.mutation.ClearVideoPrice1080p()
  584. return _u
  585. }
  586. // SetVideoModelPrices sets the "video_model_prices" field.
  587. func (_u *GroupUpdate) SetVideoModelPrices(v map[string]map[string]float64) *GroupUpdate {
  588. _u.mutation.SetVideoModelPrices(v)
  589. return _u
  590. }
  591. // ClearVideoModelPrices clears the value of the "video_model_prices" field.
  592. func (_u *GroupUpdate) ClearVideoModelPrices() *GroupUpdate {
  593. _u.mutation.ClearVideoModelPrices()
  594. return _u
  595. }
  596. // SetWebSearchPricePerCall sets the "web_search_price_per_call" field.
  597. func (_u *GroupUpdate) SetWebSearchPricePerCall(v float64) *GroupUpdate {
  598. _u.mutation.ResetWebSearchPricePerCall()
  599. _u.mutation.SetWebSearchPricePerCall(v)
  600. return _u
  601. }
  602. // SetNillableWebSearchPricePerCall sets the "web_search_price_per_call" field if the given value is not nil.
  603. func (_u *GroupUpdate) SetNillableWebSearchPricePerCall(v *float64) *GroupUpdate {
  604. if v != nil {
  605. _u.SetWebSearchPricePerCall(*v)
  606. }
  607. return _u
  608. }
  609. // AddWebSearchPricePerCall adds value to the "web_search_price_per_call" field.
  610. func (_u *GroupUpdate) AddWebSearchPricePerCall(v float64) *GroupUpdate {
  611. _u.mutation.AddWebSearchPricePerCall(v)
  612. return _u
  613. }
  614. // ClearWebSearchPricePerCall clears the value of the "web_search_price_per_call" field.
  615. func (_u *GroupUpdate) ClearWebSearchPricePerCall() *GroupUpdate {
  616. _u.mutation.ClearWebSearchPricePerCall()
  617. return _u
  618. }
  619. // SetSearchPricePer1k sets the "search_price_per_1k" field.
  620. func (_u *GroupUpdate) SetSearchPricePer1k(v float64) *GroupUpdate {
  621. _u.mutation.ResetSearchPricePer1k()
  622. _u.mutation.SetSearchPricePer1k(v)
  623. return _u
  624. }
  625. // SetNillableSearchPricePer1k sets the "search_price_per_1k" field if the given value is not nil.
  626. func (_u *GroupUpdate) SetNillableSearchPricePer1k(v *float64) *GroupUpdate {
  627. if v != nil {
  628. _u.SetSearchPricePer1k(*v)
  629. }
  630. return _u
  631. }
  632. // AddSearchPricePer1k adds value to the "search_price_per_1k" field.
  633. func (_u *GroupUpdate) AddSearchPricePer1k(v float64) *GroupUpdate {
  634. _u.mutation.AddSearchPricePer1k(v)
  635. return _u
  636. }
  637. // ClearSearchPricePer1k clears the value of the "search_price_per_1k" field.
  638. func (_u *GroupUpdate) ClearSearchPricePer1k() *GroupUpdate {
  639. _u.mutation.ClearSearchPricePer1k()
  640. return _u
  641. }
  642. // SetAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field.
  643. func (_u *GroupUpdate) SetAudioRealtimePricePerMin(v float64) *GroupUpdate {
  644. _u.mutation.ResetAudioRealtimePricePerMin()
  645. _u.mutation.SetAudioRealtimePricePerMin(v)
  646. return _u
  647. }
  648. // SetNillableAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field if the given value is not nil.
  649. func (_u *GroupUpdate) SetNillableAudioRealtimePricePerMin(v *float64) *GroupUpdate {
  650. if v != nil {
  651. _u.SetAudioRealtimePricePerMin(*v)
  652. }
  653. return _u
  654. }
  655. // AddAudioRealtimePricePerMin adds value to the "audio_realtime_price_per_min" field.
  656. func (_u *GroupUpdate) AddAudioRealtimePricePerMin(v float64) *GroupUpdate {
  657. _u.mutation.AddAudioRealtimePricePerMin(v)
  658. return _u
  659. }
  660. // ClearAudioRealtimePricePerMin clears the value of the "audio_realtime_price_per_min" field.
  661. func (_u *GroupUpdate) ClearAudioRealtimePricePerMin() *GroupUpdate {
  662. _u.mutation.ClearAudioRealtimePricePerMin()
  663. return _u
  664. }
  665. // SetAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field.
  666. func (_u *GroupUpdate) SetAudioTtsPricePerMillionChars(v float64) *GroupUpdate {
  667. _u.mutation.ResetAudioTtsPricePerMillionChars()
  668. _u.mutation.SetAudioTtsPricePerMillionChars(v)
  669. return _u
  670. }
  671. // SetNillableAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field if the given value is not nil.
  672. func (_u *GroupUpdate) SetNillableAudioTtsPricePerMillionChars(v *float64) *GroupUpdate {
  673. if v != nil {
  674. _u.SetAudioTtsPricePerMillionChars(*v)
  675. }
  676. return _u
  677. }
  678. // AddAudioTtsPricePerMillionChars adds value to the "audio_tts_price_per_million_chars" field.
  679. func (_u *GroupUpdate) AddAudioTtsPricePerMillionChars(v float64) *GroupUpdate {
  680. _u.mutation.AddAudioTtsPricePerMillionChars(v)
  681. return _u
  682. }
  683. // ClearAudioTtsPricePerMillionChars clears the value of the "audio_tts_price_per_million_chars" field.
  684. func (_u *GroupUpdate) ClearAudioTtsPricePerMillionChars() *GroupUpdate {
  685. _u.mutation.ClearAudioTtsPricePerMillionChars()
  686. return _u
  687. }
  688. // SetAudioSttPricePerHour sets the "audio_stt_price_per_hour" field.
  689. func (_u *GroupUpdate) SetAudioSttPricePerHour(v float64) *GroupUpdate {
  690. _u.mutation.ResetAudioSttPricePerHour()
  691. _u.mutation.SetAudioSttPricePerHour(v)
  692. return _u
  693. }
  694. // SetNillableAudioSttPricePerHour sets the "audio_stt_price_per_hour" field if the given value is not nil.
  695. func (_u *GroupUpdate) SetNillableAudioSttPricePerHour(v *float64) *GroupUpdate {
  696. if v != nil {
  697. _u.SetAudioSttPricePerHour(*v)
  698. }
  699. return _u
  700. }
  701. // AddAudioSttPricePerHour adds value to the "audio_stt_price_per_hour" field.
  702. func (_u *GroupUpdate) AddAudioSttPricePerHour(v float64) *GroupUpdate {
  703. _u.mutation.AddAudioSttPricePerHour(v)
  704. return _u
  705. }
  706. // ClearAudioSttPricePerHour clears the value of the "audio_stt_price_per_hour" field.
  707. func (_u *GroupUpdate) ClearAudioSttPricePerHour() *GroupUpdate {
  708. _u.mutation.ClearAudioSttPricePerHour()
  709. return _u
  710. }
  711. // SetLongContextPricingEnabled sets the "long_context_pricing_enabled" field.
  712. func (_u *GroupUpdate) SetLongContextPricingEnabled(v bool) *GroupUpdate {
  713. _u.mutation.SetLongContextPricingEnabled(v)
  714. return _u
  715. }
  716. // SetNillableLongContextPricingEnabled sets the "long_context_pricing_enabled" field if the given value is not nil.
  717. func (_u *GroupUpdate) SetNillableLongContextPricingEnabled(v *bool) *GroupUpdate {
  718. if v != nil {
  719. _u.SetLongContextPricingEnabled(*v)
  720. }
  721. return _u
  722. }
  723. // SetModelPricing sets the "model_pricing" field.
  724. func (_u *GroupUpdate) SetModelPricing(v jsontext.Value) *GroupUpdate {
  725. _u.mutation.SetModelPricing(v)
  726. return _u
  727. }
  728. // AppendModelPricing appends value to the "model_pricing" field.
  729. func (_u *GroupUpdate) AppendModelPricing(v jsontext.Value) *GroupUpdate {
  730. _u.mutation.AppendModelPricing(v)
  731. return _u
  732. }
  733. // ClearModelPricing clears the value of the "model_pricing" field.
  734. func (_u *GroupUpdate) ClearModelPricing() *GroupUpdate {
  735. _u.mutation.ClearModelPricing()
  736. return _u
  737. }
  738. // SetClaudeCodeOnly sets the "claude_code_only" field.
  739. func (_u *GroupUpdate) SetClaudeCodeOnly(v bool) *GroupUpdate {
  740. _u.mutation.SetClaudeCodeOnly(v)
  741. return _u
  742. }
  743. // SetNillableClaudeCodeOnly sets the "claude_code_only" field if the given value is not nil.
  744. func (_u *GroupUpdate) SetNillableClaudeCodeOnly(v *bool) *GroupUpdate {
  745. if v != nil {
  746. _u.SetClaudeCodeOnly(*v)
  747. }
  748. return _u
  749. }
  750. // SetFallbackGroupID sets the "fallback_group_id" field.
  751. func (_u *GroupUpdate) SetFallbackGroupID(v int64) *GroupUpdate {
  752. _u.mutation.ResetFallbackGroupID()
  753. _u.mutation.SetFallbackGroupID(v)
  754. return _u
  755. }
  756. // SetNillableFallbackGroupID sets the "fallback_group_id" field if the given value is not nil.
  757. func (_u *GroupUpdate) SetNillableFallbackGroupID(v *int64) *GroupUpdate {
  758. if v != nil {
  759. _u.SetFallbackGroupID(*v)
  760. }
  761. return _u
  762. }
  763. // AddFallbackGroupID adds value to the "fallback_group_id" field.
  764. func (_u *GroupUpdate) AddFallbackGroupID(v int64) *GroupUpdate {
  765. _u.mutation.AddFallbackGroupID(v)
  766. return _u
  767. }
  768. // ClearFallbackGroupID clears the value of the "fallback_group_id" field.
  769. func (_u *GroupUpdate) ClearFallbackGroupID() *GroupUpdate {
  770. _u.mutation.ClearFallbackGroupID()
  771. return _u
  772. }
  773. // SetFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field.
  774. func (_u *GroupUpdate) SetFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdate {
  775. _u.mutation.ResetFallbackGroupIDOnInvalidRequest()
  776. _u.mutation.SetFallbackGroupIDOnInvalidRequest(v)
  777. return _u
  778. }
  779. // SetNillableFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field if the given value is not nil.
  780. func (_u *GroupUpdate) SetNillableFallbackGroupIDOnInvalidRequest(v *int64) *GroupUpdate {
  781. if v != nil {
  782. _u.SetFallbackGroupIDOnInvalidRequest(*v)
  783. }
  784. return _u
  785. }
  786. // AddFallbackGroupIDOnInvalidRequest adds value to the "fallback_group_id_on_invalid_request" field.
  787. func (_u *GroupUpdate) AddFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdate {
  788. _u.mutation.AddFallbackGroupIDOnInvalidRequest(v)
  789. return _u
  790. }
  791. // ClearFallbackGroupIDOnInvalidRequest clears the value of the "fallback_group_id_on_invalid_request" field.
  792. func (_u *GroupUpdate) ClearFallbackGroupIDOnInvalidRequest() *GroupUpdate {
  793. _u.mutation.ClearFallbackGroupIDOnInvalidRequest()
  794. return _u
  795. }
  796. // SetModelRouting sets the "model_routing" field.
  797. func (_u *GroupUpdate) SetModelRouting(v map[string][]int64) *GroupUpdate {
  798. _u.mutation.SetModelRouting(v)
  799. return _u
  800. }
  801. // ClearModelRouting clears the value of the "model_routing" field.
  802. func (_u *GroupUpdate) ClearModelRouting() *GroupUpdate {
  803. _u.mutation.ClearModelRouting()
  804. return _u
  805. }
  806. // SetModelRoutingEnabled sets the "model_routing_enabled" field.
  807. func (_u *GroupUpdate) SetModelRoutingEnabled(v bool) *GroupUpdate {
  808. _u.mutation.SetModelRoutingEnabled(v)
  809. return _u
  810. }
  811. // SetNillableModelRoutingEnabled sets the "model_routing_enabled" field if the given value is not nil.
  812. func (_u *GroupUpdate) SetNillableModelRoutingEnabled(v *bool) *GroupUpdate {
  813. if v != nil {
  814. _u.SetModelRoutingEnabled(*v)
  815. }
  816. return _u
  817. }
  818. // SetMcpXMLInject sets the "mcp_xml_inject" field.
  819. func (_u *GroupUpdate) SetMcpXMLInject(v bool) *GroupUpdate {
  820. _u.mutation.SetMcpXMLInject(v)
  821. return _u
  822. }
  823. // SetNillableMcpXMLInject sets the "mcp_xml_inject" field if the given value is not nil.
  824. func (_u *GroupUpdate) SetNillableMcpXMLInject(v *bool) *GroupUpdate {
  825. if v != nil {
  826. _u.SetMcpXMLInject(*v)
  827. }
  828. return _u
  829. }
  830. // SetSupportedModelScopes sets the "supported_model_scopes" field.
  831. func (_u *GroupUpdate) SetSupportedModelScopes(v []string) *GroupUpdate {
  832. _u.mutation.SetSupportedModelScopes(v)
  833. return _u
  834. }
  835. // AppendSupportedModelScopes appends value to the "supported_model_scopes" field.
  836. func (_u *GroupUpdate) AppendSupportedModelScopes(v []string) *GroupUpdate {
  837. _u.mutation.AppendSupportedModelScopes(v)
  838. return _u
  839. }
  840. // SetSortOrder sets the "sort_order" field.
  841. func (_u *GroupUpdate) SetSortOrder(v int) *GroupUpdate {
  842. _u.mutation.ResetSortOrder()
  843. _u.mutation.SetSortOrder(v)
  844. return _u
  845. }
  846. // SetNillableSortOrder sets the "sort_order" field if the given value is not nil.
  847. func (_u *GroupUpdate) SetNillableSortOrder(v *int) *GroupUpdate {
  848. if v != nil {
  849. _u.SetSortOrder(*v)
  850. }
  851. return _u
  852. }
  853. // AddSortOrder adds value to the "sort_order" field.
  854. func (_u *GroupUpdate) AddSortOrder(v int) *GroupUpdate {
  855. _u.mutation.AddSortOrder(v)
  856. return _u
  857. }
  858. // SetAllowMessagesDispatch sets the "allow_messages_dispatch" field.
  859. func (_u *GroupUpdate) SetAllowMessagesDispatch(v bool) *GroupUpdate {
  860. _u.mutation.SetAllowMessagesDispatch(v)
  861. return _u
  862. }
  863. // SetNillableAllowMessagesDispatch sets the "allow_messages_dispatch" field if the given value is not nil.
  864. func (_u *GroupUpdate) SetNillableAllowMessagesDispatch(v *bool) *GroupUpdate {
  865. if v != nil {
  866. _u.SetAllowMessagesDispatch(*v)
  867. }
  868. return _u
  869. }
  870. // SetAllowLive sets the "allow_live" field.
  871. func (_u *GroupUpdate) SetAllowLive(v bool) *GroupUpdate {
  872. _u.mutation.SetAllowLive(v)
  873. return _u
  874. }
  875. // SetNillableAllowLive sets the "allow_live" field if the given value is not nil.
  876. func (_u *GroupUpdate) SetNillableAllowLive(v *bool) *GroupUpdate {
  877. if v != nil {
  878. _u.SetAllowLive(*v)
  879. }
  880. return _u
  881. }
  882. // SetForceOpenaiFast sets the "force_openai_fast" field.
  883. func (_u *GroupUpdate) SetForceOpenaiFast(v bool) *GroupUpdate {
  884. _u.mutation.SetForceOpenaiFast(v)
  885. return _u
  886. }
  887. // SetNillableForceOpenaiFast sets the "force_openai_fast" field if the given value is not nil.
  888. func (_u *GroupUpdate) SetNillableForceOpenaiFast(v *bool) *GroupUpdate {
  889. if v != nil {
  890. _u.SetForceOpenaiFast(*v)
  891. }
  892. return _u
  893. }
  894. // SetFreeOpenaiFast sets the "free_openai_fast" field.
  895. func (_u *GroupUpdate) SetFreeOpenaiFast(v bool) *GroupUpdate {
  896. _u.mutation.SetFreeOpenaiFast(v)
  897. return _u
  898. }
  899. // SetNillableFreeOpenaiFast sets the "free_openai_fast" field if the given value is not nil.
  900. func (_u *GroupUpdate) SetNillableFreeOpenaiFast(v *bool) *GroupUpdate {
  901. if v != nil {
  902. _u.SetFreeOpenaiFast(*v)
  903. }
  904. return _u
  905. }
  906. // SetRequireOauthOnly sets the "require_oauth_only" field.
  907. func (_u *GroupUpdate) SetRequireOauthOnly(v bool) *GroupUpdate {
  908. _u.mutation.SetRequireOauthOnly(v)
  909. return _u
  910. }
  911. // SetNillableRequireOauthOnly sets the "require_oauth_only" field if the given value is not nil.
  912. func (_u *GroupUpdate) SetNillableRequireOauthOnly(v *bool) *GroupUpdate {
  913. if v != nil {
  914. _u.SetRequireOauthOnly(*v)
  915. }
  916. return _u
  917. }
  918. // SetRequirePrivacySet sets the "require_privacy_set" field.
  919. func (_u *GroupUpdate) SetRequirePrivacySet(v bool) *GroupUpdate {
  920. _u.mutation.SetRequirePrivacySet(v)
  921. return _u
  922. }
  923. // SetNillableRequirePrivacySet sets the "require_privacy_set" field if the given value is not nil.
  924. func (_u *GroupUpdate) SetNillableRequirePrivacySet(v *bool) *GroupUpdate {
  925. if v != nil {
  926. _u.SetRequirePrivacySet(*v)
  927. }
  928. return _u
  929. }
  930. // SetDefaultMappedModel sets the "default_mapped_model" field.
  931. func (_u *GroupUpdate) SetDefaultMappedModel(v string) *GroupUpdate {
  932. _u.mutation.SetDefaultMappedModel(v)
  933. return _u
  934. }
  935. // SetNillableDefaultMappedModel sets the "default_mapped_model" field if the given value is not nil.
  936. func (_u *GroupUpdate) SetNillableDefaultMappedModel(v *string) *GroupUpdate {
  937. if v != nil {
  938. _u.SetDefaultMappedModel(*v)
  939. }
  940. return _u
  941. }
  942. // SetMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field.
  943. func (_u *GroupUpdate) SetMessagesDispatchModelConfig(v domain.OpenAIMessagesDispatchModelConfig) *GroupUpdate {
  944. _u.mutation.SetMessagesDispatchModelConfig(v)
  945. return _u
  946. }
  947. // SetNillableMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field if the given value is not nil.
  948. func (_u *GroupUpdate) SetNillableMessagesDispatchModelConfig(v *domain.OpenAIMessagesDispatchModelConfig) *GroupUpdate {
  949. if v != nil {
  950. _u.SetMessagesDispatchModelConfig(*v)
  951. }
  952. return _u
  953. }
  954. // SetModelAllowlist sets the "model_allowlist" field.
  955. func (_u *GroupUpdate) SetModelAllowlist(v domain.GroupModelAllowlist) *GroupUpdate {
  956. _u.mutation.SetModelAllowlist(v)
  957. return _u
  958. }
  959. // SetNillableModelAllowlist sets the "model_allowlist" field if the given value is not nil.
  960. func (_u *GroupUpdate) SetNillableModelAllowlist(v *domain.GroupModelAllowlist) *GroupUpdate {
  961. if v != nil {
  962. _u.SetModelAllowlist(*v)
  963. }
  964. return _u
  965. }
  966. // SetCodexModelsManifestConfig sets the "codex_models_manifest_config" field.
  967. func (_u *GroupUpdate) SetCodexModelsManifestConfig(v domain.GroupCodexModelsManifestConfig) *GroupUpdate {
  968. _u.mutation.SetCodexModelsManifestConfig(v)
  969. return _u
  970. }
  971. // SetNillableCodexModelsManifestConfig sets the "codex_models_manifest_config" field if the given value is not nil.
  972. func (_u *GroupUpdate) SetNillableCodexModelsManifestConfig(v *domain.GroupCodexModelsManifestConfig) *GroupUpdate {
  973. if v != nil {
  974. _u.SetCodexModelsManifestConfig(*v)
  975. }
  976. return _u
  977. }
  978. // SetRpmLimit sets the "rpm_limit" field.
  979. func (_u *GroupUpdate) SetRpmLimit(v int) *GroupUpdate {
  980. _u.mutation.ResetRpmLimit()
  981. _u.mutation.SetRpmLimit(v)
  982. return _u
  983. }
  984. // SetNillableRpmLimit sets the "rpm_limit" field if the given value is not nil.
  985. func (_u *GroupUpdate) SetNillableRpmLimit(v *int) *GroupUpdate {
  986. if v != nil {
  987. _u.SetRpmLimit(*v)
  988. }
  989. return _u
  990. }
  991. // AddRpmLimit adds value to the "rpm_limit" field.
  992. func (_u *GroupUpdate) AddRpmLimit(v int) *GroupUpdate {
  993. _u.mutation.AddRpmLimit(v)
  994. return _u
  995. }
  996. // SetMaxReasoningEffort sets the "max_reasoning_effort" field.
  997. func (_u *GroupUpdate) SetMaxReasoningEffort(v string) *GroupUpdate {
  998. _u.mutation.SetMaxReasoningEffort(v)
  999. return _u
  1000. }
  1001. // SetNillableMaxReasoningEffort sets the "max_reasoning_effort" field if the given value is not nil.
  1002. func (_u *GroupUpdate) SetNillableMaxReasoningEffort(v *string) *GroupUpdate {
  1003. if v != nil {
  1004. _u.SetMaxReasoningEffort(*v)
  1005. }
  1006. return _u
  1007. }
  1008. // SetMaxReasoningEffortOverLimit sets the "max_reasoning_effort_over_limit" field.
  1009. func (_u *GroupUpdate) SetMaxReasoningEffortOverLimit(v string) *GroupUpdate {
  1010. _u.mutation.SetMaxReasoningEffortOverLimit(v)
  1011. return _u
  1012. }
  1013. // SetNillableMaxReasoningEffortOverLimit sets the "max_reasoning_effort_over_limit" field if the given value is not nil.
  1014. func (_u *GroupUpdate) SetNillableMaxReasoningEffortOverLimit(v *string) *GroupUpdate {
  1015. if v != nil {
  1016. _u.SetMaxReasoningEffortOverLimit(*v)
  1017. }
  1018. return _u
  1019. }
  1020. // SetReasoningEffortMappings sets the "reasoning_effort_mappings" field.
  1021. func (_u *GroupUpdate) SetReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdate {
  1022. _u.mutation.SetReasoningEffortMappings(v)
  1023. return _u
  1024. }
  1025. // AppendReasoningEffortMappings appends value to the "reasoning_effort_mappings" field.
  1026. func (_u *GroupUpdate) AppendReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdate {
  1027. _u.mutation.AppendReasoningEffortMappings(v)
  1028. return _u
  1029. }
  1030. // SetProfitControlEnabled sets the "profit_control_enabled" field.
  1031. func (_u *GroupUpdate) SetProfitControlEnabled(v bool) *GroupUpdate {
  1032. _u.mutation.SetProfitControlEnabled(v)
  1033. return _u
  1034. }
  1035. // SetNillableProfitControlEnabled sets the "profit_control_enabled" field if the given value is not nil.
  1036. func (_u *GroupUpdate) SetNillableProfitControlEnabled(v *bool) *GroupUpdate {
  1037. if v != nil {
  1038. _u.SetProfitControlEnabled(*v)
  1039. }
  1040. return _u
  1041. }
  1042. // SetProfitMinMargin sets the "profit_min_margin" field.
  1043. func (_u *GroupUpdate) SetProfitMinMargin(v float64) *GroupUpdate {
  1044. _u.mutation.ResetProfitMinMargin()
  1045. _u.mutation.SetProfitMinMargin(v)
  1046. return _u
  1047. }
  1048. // SetNillableProfitMinMargin sets the "profit_min_margin" field if the given value is not nil.
  1049. func (_u *GroupUpdate) SetNillableProfitMinMargin(v *float64) *GroupUpdate {
  1050. if v != nil {
  1051. _u.SetProfitMinMargin(*v)
  1052. }
  1053. return _u
  1054. }
  1055. // AddProfitMinMargin adds value to the "profit_min_margin" field.
  1056. func (_u *GroupUpdate) AddProfitMinMargin(v float64) *GroupUpdate {
  1057. _u.mutation.AddProfitMinMargin(v)
  1058. return _u
  1059. }
  1060. // SetProfitSafetyBuffer sets the "profit_safety_buffer" field.
  1061. func (_u *GroupUpdate) SetProfitSafetyBuffer(v float64) *GroupUpdate {
  1062. _u.mutation.ResetProfitSafetyBuffer()
  1063. _u.mutation.SetProfitSafetyBuffer(v)
  1064. return _u
  1065. }
  1066. // SetNillableProfitSafetyBuffer sets the "profit_safety_buffer" field if the given value is not nil.
  1067. func (_u *GroupUpdate) SetNillableProfitSafetyBuffer(v *float64) *GroupUpdate {
  1068. if v != nil {
  1069. _u.SetProfitSafetyBuffer(*v)
  1070. }
  1071. return _u
  1072. }
  1073. // AddProfitSafetyBuffer adds value to the "profit_safety_buffer" field.
  1074. func (_u *GroupUpdate) AddProfitSafetyBuffer(v float64) *GroupUpdate {
  1075. _u.mutation.AddProfitSafetyBuffer(v)
  1076. return _u
  1077. }
  1078. // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.
  1079. func (_u *GroupUpdate) AddAPIKeyIDs(ids ...int64) *GroupUpdate {
  1080. _u.mutation.AddAPIKeyIDs(ids...)
  1081. return _u
  1082. }
  1083. // AddAPIKeys adds the "api_keys" edges to the APIKey entity.
  1084. func (_u *GroupUpdate) AddAPIKeys(v ...*APIKey) *GroupUpdate {
  1085. ids := make([]int64, len(v))
  1086. for i := range v {
  1087. ids[i] = v[i].ID
  1088. }
  1089. return _u.AddAPIKeyIDs(ids...)
  1090. }
  1091. // AddRedeemCodeIDs adds the "redeem_codes" edge to the RedeemCode entity by IDs.
  1092. func (_u *GroupUpdate) AddRedeemCodeIDs(ids ...int64) *GroupUpdate {
  1093. _u.mutation.AddRedeemCodeIDs(ids...)
  1094. return _u
  1095. }
  1096. // AddRedeemCodes adds the "redeem_codes" edges to the RedeemCode entity.
  1097. func (_u *GroupUpdate) AddRedeemCodes(v ...*RedeemCode) *GroupUpdate {
  1098. ids := make([]int64, len(v))
  1099. for i := range v {
  1100. ids[i] = v[i].ID
  1101. }
  1102. return _u.AddRedeemCodeIDs(ids...)
  1103. }
  1104. // AddSubscriptionIDs adds the "subscriptions" edge to the UserSubscription entity by IDs.
  1105. func (_u *GroupUpdate) AddSubscriptionIDs(ids ...int64) *GroupUpdate {
  1106. _u.mutation.AddSubscriptionIDs(ids...)
  1107. return _u
  1108. }
  1109. // AddSubscriptions adds the "subscriptions" edges to the UserSubscription entity.
  1110. func (_u *GroupUpdate) AddSubscriptions(v ...*UserSubscription) *GroupUpdate {
  1111. ids := make([]int64, len(v))
  1112. for i := range v {
  1113. ids[i] = v[i].ID
  1114. }
  1115. return _u.AddSubscriptionIDs(ids...)
  1116. }
  1117. // AddUsageLogIDs adds the "usage_logs" edge to the UsageLog entity by IDs.
  1118. func (_u *GroupUpdate) AddUsageLogIDs(ids ...int64) *GroupUpdate {
  1119. _u.mutation.AddUsageLogIDs(ids...)
  1120. return _u
  1121. }
  1122. // AddUsageLogs adds the "usage_logs" edges to the UsageLog entity.
  1123. func (_u *GroupUpdate) AddUsageLogs(v ...*UsageLog) *GroupUpdate {
  1124. ids := make([]int64, len(v))
  1125. for i := range v {
  1126. ids[i] = v[i].ID
  1127. }
  1128. return _u.AddUsageLogIDs(ids...)
  1129. }
  1130. // AddAccountIDs adds the "accounts" edge to the Account entity by IDs.
  1131. func (_u *GroupUpdate) AddAccountIDs(ids ...int64) *GroupUpdate {
  1132. _u.mutation.AddAccountIDs(ids...)
  1133. return _u
  1134. }
  1135. // AddAccounts adds the "accounts" edges to the Account entity.
  1136. func (_u *GroupUpdate) AddAccounts(v ...*Account) *GroupUpdate {
  1137. ids := make([]int64, len(v))
  1138. for i := range v {
  1139. ids[i] = v[i].ID
  1140. }
  1141. return _u.AddAccountIDs(ids...)
  1142. }
  1143. // AddAllowedUserIDs adds the "allowed_users" edge to the User entity by IDs.
  1144. func (_u *GroupUpdate) AddAllowedUserIDs(ids ...int64) *GroupUpdate {
  1145. _u.mutation.AddAllowedUserIDs(ids...)
  1146. return _u
  1147. }
  1148. // AddAllowedUsers adds the "allowed_users" edges to the User entity.
  1149. func (_u *GroupUpdate) AddAllowedUsers(v ...*User) *GroupUpdate {
  1150. ids := make([]int64, len(v))
  1151. for i := range v {
  1152. ids[i] = v[i].ID
  1153. }
  1154. return _u.AddAllowedUserIDs(ids...)
  1155. }
  1156. // Mutation returns the GroupMutation object of the builder.
  1157. func (_u *GroupUpdate) Mutation() *GroupMutation {
  1158. return _u.mutation
  1159. }
  1160. // ClearAPIKeys clears all "api_keys" edges to the APIKey entity.
  1161. func (_u *GroupUpdate) ClearAPIKeys() *GroupUpdate {
  1162. _u.mutation.ClearAPIKeys()
  1163. return _u
  1164. }
  1165. // RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs.
  1166. func (_u *GroupUpdate) RemoveAPIKeyIDs(ids ...int64) *GroupUpdate {
  1167. _u.mutation.RemoveAPIKeyIDs(ids...)
  1168. return _u
  1169. }
  1170. // RemoveAPIKeys removes "api_keys" edges to APIKey entities.
  1171. func (_u *GroupUpdate) RemoveAPIKeys(v ...*APIKey) *GroupUpdate {
  1172. ids := make([]int64, len(v))
  1173. for i := range v {
  1174. ids[i] = v[i].ID
  1175. }
  1176. return _u.RemoveAPIKeyIDs(ids...)
  1177. }
  1178. // ClearRedeemCodes clears all "redeem_codes" edges to the RedeemCode entity.
  1179. func (_u *GroupUpdate) ClearRedeemCodes() *GroupUpdate {
  1180. _u.mutation.ClearRedeemCodes()
  1181. return _u
  1182. }
  1183. // RemoveRedeemCodeIDs removes the "redeem_codes" edge to RedeemCode entities by IDs.
  1184. func (_u *GroupUpdate) RemoveRedeemCodeIDs(ids ...int64) *GroupUpdate {
  1185. _u.mutation.RemoveRedeemCodeIDs(ids...)
  1186. return _u
  1187. }
  1188. // RemoveRedeemCodes removes "redeem_codes" edges to RedeemCode entities.
  1189. func (_u *GroupUpdate) RemoveRedeemCodes(v ...*RedeemCode) *GroupUpdate {
  1190. ids := make([]int64, len(v))
  1191. for i := range v {
  1192. ids[i] = v[i].ID
  1193. }
  1194. return _u.RemoveRedeemCodeIDs(ids...)
  1195. }
  1196. // ClearSubscriptions clears all "subscriptions" edges to the UserSubscription entity.
  1197. func (_u *GroupUpdate) ClearSubscriptions() *GroupUpdate {
  1198. _u.mutation.ClearSubscriptions()
  1199. return _u
  1200. }
  1201. // RemoveSubscriptionIDs removes the "subscriptions" edge to UserSubscription entities by IDs.
  1202. func (_u *GroupUpdate) RemoveSubscriptionIDs(ids ...int64) *GroupUpdate {
  1203. _u.mutation.RemoveSubscriptionIDs(ids...)
  1204. return _u
  1205. }
  1206. // RemoveSubscriptions removes "subscriptions" edges to UserSubscription entities.
  1207. func (_u *GroupUpdate) RemoveSubscriptions(v ...*UserSubscription) *GroupUpdate {
  1208. ids := make([]int64, len(v))
  1209. for i := range v {
  1210. ids[i] = v[i].ID
  1211. }
  1212. return _u.RemoveSubscriptionIDs(ids...)
  1213. }
  1214. // ClearUsageLogs clears all "usage_logs" edges to the UsageLog entity.
  1215. func (_u *GroupUpdate) ClearUsageLogs() *GroupUpdate {
  1216. _u.mutation.ClearUsageLogs()
  1217. return _u
  1218. }
  1219. // RemoveUsageLogIDs removes the "usage_logs" edge to UsageLog entities by IDs.
  1220. func (_u *GroupUpdate) RemoveUsageLogIDs(ids ...int64) *GroupUpdate {
  1221. _u.mutation.RemoveUsageLogIDs(ids...)
  1222. return _u
  1223. }
  1224. // RemoveUsageLogs removes "usage_logs" edges to UsageLog entities.
  1225. func (_u *GroupUpdate) RemoveUsageLogs(v ...*UsageLog) *GroupUpdate {
  1226. ids := make([]int64, len(v))
  1227. for i := range v {
  1228. ids[i] = v[i].ID
  1229. }
  1230. return _u.RemoveUsageLogIDs(ids...)
  1231. }
  1232. // ClearAccounts clears all "accounts" edges to the Account entity.
  1233. func (_u *GroupUpdate) ClearAccounts() *GroupUpdate {
  1234. _u.mutation.ClearAccounts()
  1235. return _u
  1236. }
  1237. // RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.
  1238. func (_u *GroupUpdate) RemoveAccountIDs(ids ...int64) *GroupUpdate {
  1239. _u.mutation.RemoveAccountIDs(ids...)
  1240. return _u
  1241. }
  1242. // RemoveAccounts removes "accounts" edges to Account entities.
  1243. func (_u *GroupUpdate) RemoveAccounts(v ...*Account) *GroupUpdate {
  1244. ids := make([]int64, len(v))
  1245. for i := range v {
  1246. ids[i] = v[i].ID
  1247. }
  1248. return _u.RemoveAccountIDs(ids...)
  1249. }
  1250. // ClearAllowedUsers clears all "allowed_users" edges to the User entity.
  1251. func (_u *GroupUpdate) ClearAllowedUsers() *GroupUpdate {
  1252. _u.mutation.ClearAllowedUsers()
  1253. return _u
  1254. }
  1255. // RemoveAllowedUserIDs removes the "allowed_users" edge to User entities by IDs.
  1256. func (_u *GroupUpdate) RemoveAllowedUserIDs(ids ...int64) *GroupUpdate {
  1257. _u.mutation.RemoveAllowedUserIDs(ids...)
  1258. return _u
  1259. }
  1260. // RemoveAllowedUsers removes "allowed_users" edges to User entities.
  1261. func (_u *GroupUpdate) RemoveAllowedUsers(v ...*User) *GroupUpdate {
  1262. ids := make([]int64, len(v))
  1263. for i := range v {
  1264. ids[i] = v[i].ID
  1265. }
  1266. return _u.RemoveAllowedUserIDs(ids...)
  1267. }
  1268. // Save executes the query and returns the number of nodes affected by the update operation.
  1269. func (_u *GroupUpdate) Save(ctx context.Context) (int, error) {
  1270. if err := _u.defaults(); err != nil {
  1271. return 0, err
  1272. }
  1273. return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
  1274. }
  1275. // SaveX is like Save, but panics if an error occurs.
  1276. func (_u *GroupUpdate) SaveX(ctx context.Context) int {
  1277. affected, err := _u.Save(ctx)
  1278. if err != nil {
  1279. panic(err)
  1280. }
  1281. return affected
  1282. }
  1283. // Exec executes the query.
  1284. func (_u *GroupUpdate) Exec(ctx context.Context) error {
  1285. _, err := _u.Save(ctx)
  1286. return err
  1287. }
  1288. // ExecX is like Exec, but panics if an error occurs.
  1289. func (_u *GroupUpdate) ExecX(ctx context.Context) {
  1290. if err := _u.Exec(ctx); err != nil {
  1291. panic(err)
  1292. }
  1293. }
  1294. // defaults sets the default values of the builder before save.
  1295. func (_u *GroupUpdate) defaults() error {
  1296. if _, ok := _u.mutation.UpdatedAt(); !ok {
  1297. if group.UpdateDefaultUpdatedAt == nil {
  1298. return fmt.Errorf("ent: uninitialized group.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
  1299. }
  1300. v := group.UpdateDefaultUpdatedAt()
  1301. _u.mutation.SetUpdatedAt(v)
  1302. }
  1303. return nil
  1304. }
  1305. // check runs all checks and user-defined validators on the builder.
  1306. func (_u *GroupUpdate) check() error {
  1307. if v, ok := _u.mutation.Name(); ok {
  1308. if err := group.NameValidator(v); err != nil {
  1309. return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Group.name": %w`, err)}
  1310. }
  1311. }
  1312. if v, ok := _u.mutation.PeakStart(); ok {
  1313. if err := group.PeakStartValidator(v); err != nil {
  1314. return &ValidationError{Name: "peak_start", err: fmt.Errorf(`ent: validator failed for field "Group.peak_start": %w`, err)}
  1315. }
  1316. }
  1317. if v, ok := _u.mutation.PeakEnd(); ok {
  1318. if err := group.PeakEndValidator(v); err != nil {
  1319. return &ValidationError{Name: "peak_end", err: fmt.Errorf(`ent: validator failed for field "Group.peak_end": %w`, err)}
  1320. }
  1321. }
  1322. if v, ok := _u.mutation.SecurityPolicyMode(); ok {
  1323. if err := group.SecurityPolicyModeValidator(v); err != nil {
  1324. return &ValidationError{Name: "security_policy_mode", err: fmt.Errorf(`ent: validator failed for field "Group.security_policy_mode": %w`, err)}
  1325. }
  1326. }
  1327. if v, ok := _u.mutation.Status(); ok {
  1328. if err := group.StatusValidator(v); err != nil {
  1329. return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Group.status": %w`, err)}
  1330. }
  1331. }
  1332. if v, ok := _u.mutation.Platform(); ok {
  1333. if err := group.PlatformValidator(v); err != nil {
  1334. return &ValidationError{Name: "platform", err: fmt.Errorf(`ent: validator failed for field "Group.platform": %w`, err)}
  1335. }
  1336. }
  1337. if v, ok := _u.mutation.SubscriptionType(); ok {
  1338. if err := group.SubscriptionTypeValidator(v); err != nil {
  1339. return &ValidationError{Name: "subscription_type", err: fmt.Errorf(`ent: validator failed for field "Group.subscription_type": %w`, err)}
  1340. }
  1341. }
  1342. if v, ok := _u.mutation.SearchPricePer1k(); ok {
  1343. if err := group.SearchPricePer1kValidator(v); err != nil {
  1344. return &ValidationError{Name: "search_price_per_1k", err: fmt.Errorf(`ent: validator failed for field "Group.search_price_per_1k": %w`, err)}
  1345. }
  1346. }
  1347. if v, ok := _u.mutation.AudioRealtimePricePerMin(); ok {
  1348. if err := group.AudioRealtimePricePerMinValidator(v); err != nil {
  1349. return &ValidationError{Name: "audio_realtime_price_per_min", err: fmt.Errorf(`ent: validator failed for field "Group.audio_realtime_price_per_min": %w`, err)}
  1350. }
  1351. }
  1352. if v, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok {
  1353. if err := group.AudioTtsPricePerMillionCharsValidator(v); err != nil {
  1354. 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)}
  1355. }
  1356. }
  1357. if v, ok := _u.mutation.AudioSttPricePerHour(); ok {
  1358. if err := group.AudioSttPricePerHourValidator(v); err != nil {
  1359. return &ValidationError{Name: "audio_stt_price_per_hour", err: fmt.Errorf(`ent: validator failed for field "Group.audio_stt_price_per_hour": %w`, err)}
  1360. }
  1361. }
  1362. if v, ok := _u.mutation.DefaultMappedModel(); ok {
  1363. if err := group.DefaultMappedModelValidator(v); err != nil {
  1364. return &ValidationError{Name: "default_mapped_model", err: fmt.Errorf(`ent: validator failed for field "Group.default_mapped_model": %w`, err)}
  1365. }
  1366. }
  1367. if v, ok := _u.mutation.MaxReasoningEffort(); ok {
  1368. if err := group.MaxReasoningEffortValidator(v); err != nil {
  1369. return &ValidationError{Name: "max_reasoning_effort", err: fmt.Errorf(`ent: validator failed for field "Group.max_reasoning_effort": %w`, err)}
  1370. }
  1371. }
  1372. if v, ok := _u.mutation.MaxReasoningEffortOverLimit(); ok {
  1373. if err := group.MaxReasoningEffortOverLimitValidator(v); err != nil {
  1374. return &ValidationError{Name: "max_reasoning_effort_over_limit", err: fmt.Errorf(`ent: validator failed for field "Group.max_reasoning_effort_over_limit": %w`, err)}
  1375. }
  1376. }
  1377. return nil
  1378. }
  1379. func (_u *GroupUpdate) sqlSave(ctx context.Context) (_node int, err error) {
  1380. if err := _u.check(); err != nil {
  1381. return _node, err
  1382. }
  1383. _spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeInt64))
  1384. if ps := _u.mutation.predicates; len(ps) > 0 {
  1385. _spec.Predicate = func(selector *sql.Selector) {
  1386. for i := range ps {
  1387. ps[i](selector)
  1388. }
  1389. }
  1390. }
  1391. if value, ok := _u.mutation.UpdatedAt(); ok {
  1392. _spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
  1393. }
  1394. if value, ok := _u.mutation.DeletedAt(); ok {
  1395. _spec.SetField(group.FieldDeletedAt, field.TypeTime, value)
  1396. }
  1397. if _u.mutation.DeletedAtCleared() {
  1398. _spec.ClearField(group.FieldDeletedAt, field.TypeTime)
  1399. }
  1400. if value, ok := _u.mutation.Name(); ok {
  1401. _spec.SetField(group.FieldName, field.TypeString, value)
  1402. }
  1403. if value, ok := _u.mutation.Description(); ok {
  1404. _spec.SetField(group.FieldDescription, field.TypeString, value)
  1405. }
  1406. if _u.mutation.DescriptionCleared() {
  1407. _spec.ClearField(group.FieldDescription, field.TypeString)
  1408. }
  1409. if value, ok := _u.mutation.RateMultiplier(); ok {
  1410. _spec.SetField(group.FieldRateMultiplier, field.TypeFloat64, value)
  1411. }
  1412. if value, ok := _u.mutation.AddedRateMultiplier(); ok {
  1413. _spec.AddField(group.FieldRateMultiplier, field.TypeFloat64, value)
  1414. }
  1415. if value, ok := _u.mutation.PeakRateEnabled(); ok {
  1416. _spec.SetField(group.FieldPeakRateEnabled, field.TypeBool, value)
  1417. }
  1418. if value, ok := _u.mutation.PeakStart(); ok {
  1419. _spec.SetField(group.FieldPeakStart, field.TypeString, value)
  1420. }
  1421. if value, ok := _u.mutation.PeakEnd(); ok {
  1422. _spec.SetField(group.FieldPeakEnd, field.TypeString, value)
  1423. }
  1424. if value, ok := _u.mutation.PeakRateMultiplier(); ok {
  1425. _spec.SetField(group.FieldPeakRateMultiplier, field.TypeFloat64, value)
  1426. }
  1427. if value, ok := _u.mutation.AddedPeakRateMultiplier(); ok {
  1428. _spec.AddField(group.FieldPeakRateMultiplier, field.TypeFloat64, value)
  1429. }
  1430. if value, ok := _u.mutation.IsExclusive(); ok {
  1431. _spec.SetField(group.FieldIsExclusive, field.TypeBool, value)
  1432. }
  1433. if value, ok := _u.mutation.SecurityPolicyEnabled(); ok {
  1434. _spec.SetField(group.FieldSecurityPolicyEnabled, field.TypeBool, value)
  1435. }
  1436. if value, ok := _u.mutation.SecurityPolicyMode(); ok {
  1437. _spec.SetField(group.FieldSecurityPolicyMode, field.TypeString, value)
  1438. }
  1439. if value, ok := _u.mutation.SecurityPolicyEmailEnabled(); ok {
  1440. _spec.SetField(group.FieldSecurityPolicyEmailEnabled, field.TypeBool, value)
  1441. }
  1442. if value, ok := _u.mutation.Status(); ok {
  1443. _spec.SetField(group.FieldStatus, field.TypeString, value)
  1444. }
  1445. if _u.mutation.DuplicateOperationIDCleared() {
  1446. _spec.ClearField(group.FieldDuplicateOperationID, field.TypeString)
  1447. }
  1448. if value, ok := _u.mutation.Platform(); ok {
  1449. _spec.SetField(group.FieldPlatform, field.TypeString, value)
  1450. }
  1451. if value, ok := _u.mutation.SubscriptionType(); ok {
  1452. _spec.SetField(group.FieldSubscriptionType, field.TypeString, value)
  1453. }
  1454. if value, ok := _u.mutation.DailyLimitUsd(); ok {
  1455. _spec.SetField(group.FieldDailyLimitUsd, field.TypeFloat64, value)
  1456. }
  1457. if value, ok := _u.mutation.AddedDailyLimitUsd(); ok {
  1458. _spec.AddField(group.FieldDailyLimitUsd, field.TypeFloat64, value)
  1459. }
  1460. if _u.mutation.DailyLimitUsdCleared() {
  1461. _spec.ClearField(group.FieldDailyLimitUsd, field.TypeFloat64)
  1462. }
  1463. if value, ok := _u.mutation.WeeklyLimitUsd(); ok {
  1464. _spec.SetField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value)
  1465. }
  1466. if value, ok := _u.mutation.AddedWeeklyLimitUsd(); ok {
  1467. _spec.AddField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value)
  1468. }
  1469. if _u.mutation.WeeklyLimitUsdCleared() {
  1470. _spec.ClearField(group.FieldWeeklyLimitUsd, field.TypeFloat64)
  1471. }
  1472. if value, ok := _u.mutation.MonthlyLimitUsd(); ok {
  1473. _spec.SetField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value)
  1474. }
  1475. if value, ok := _u.mutation.AddedMonthlyLimitUsd(); ok {
  1476. _spec.AddField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value)
  1477. }
  1478. if _u.mutation.MonthlyLimitUsdCleared() {
  1479. _spec.ClearField(group.FieldMonthlyLimitUsd, field.TypeFloat64)
  1480. }
  1481. if value, ok := _u.mutation.DefaultValidityDays(); ok {
  1482. _spec.SetField(group.FieldDefaultValidityDays, field.TypeInt, value)
  1483. }
  1484. if value, ok := _u.mutation.AddedDefaultValidityDays(); ok {
  1485. _spec.AddField(group.FieldDefaultValidityDays, field.TypeInt, value)
  1486. }
  1487. if value, ok := _u.mutation.AllowImageGeneration(); ok {
  1488. _spec.SetField(group.FieldAllowImageGeneration, field.TypeBool, value)
  1489. }
  1490. if value, ok := _u.mutation.AllowBatchImageGeneration(); ok {
  1491. _spec.SetField(group.FieldAllowBatchImageGeneration, field.TypeBool, value)
  1492. }
  1493. if value, ok := _u.mutation.ImageRateIndependent(); ok {
  1494. _spec.SetField(group.FieldImageRateIndependent, field.TypeBool, value)
  1495. }
  1496. if value, ok := _u.mutation.ImageRateMultiplier(); ok {
  1497. _spec.SetField(group.FieldImageRateMultiplier, field.TypeFloat64, value)
  1498. }
  1499. if value, ok := _u.mutation.AddedImageRateMultiplier(); ok {
  1500. _spec.AddField(group.FieldImageRateMultiplier, field.TypeFloat64, value)
  1501. }
  1502. if value, ok := _u.mutation.ImagePrice1k(); ok {
  1503. _spec.SetField(group.FieldImagePrice1k, field.TypeFloat64, value)
  1504. }
  1505. if value, ok := _u.mutation.AddedImagePrice1k(); ok {
  1506. _spec.AddField(group.FieldImagePrice1k, field.TypeFloat64, value)
  1507. }
  1508. if _u.mutation.ImagePrice1kCleared() {
  1509. _spec.ClearField(group.FieldImagePrice1k, field.TypeFloat64)
  1510. }
  1511. if value, ok := _u.mutation.ImagePrice2k(); ok {
  1512. _spec.SetField(group.FieldImagePrice2k, field.TypeFloat64, value)
  1513. }
  1514. if value, ok := _u.mutation.AddedImagePrice2k(); ok {
  1515. _spec.AddField(group.FieldImagePrice2k, field.TypeFloat64, value)
  1516. }
  1517. if _u.mutation.ImagePrice2kCleared() {
  1518. _spec.ClearField(group.FieldImagePrice2k, field.TypeFloat64)
  1519. }
  1520. if value, ok := _u.mutation.ImagePrice4k(); ok {
  1521. _spec.SetField(group.FieldImagePrice4k, field.TypeFloat64, value)
  1522. }
  1523. if value, ok := _u.mutation.AddedImagePrice4k(); ok {
  1524. _spec.AddField(group.FieldImagePrice4k, field.TypeFloat64, value)
  1525. }
  1526. if _u.mutation.ImagePrice4kCleared() {
  1527. _spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64)
  1528. }
  1529. if value, ok := _u.mutation.BatchImageDiscountMultiplier(); ok {
  1530. _spec.SetField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
  1531. }
  1532. if value, ok := _u.mutation.AddedBatchImageDiscountMultiplier(); ok {
  1533. _spec.AddField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
  1534. }
  1535. if value, ok := _u.mutation.BatchImageHoldMultiplier(); ok {
  1536. _spec.SetField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
  1537. }
  1538. if value, ok := _u.mutation.AddedBatchImageHoldMultiplier(); ok {
  1539. _spec.AddField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
  1540. }
  1541. if value, ok := _u.mutation.VideoRateIndependent(); ok {
  1542. _spec.SetField(group.FieldVideoRateIndependent, field.TypeBool, value)
  1543. }
  1544. if value, ok := _u.mutation.VideoRateMultiplier(); ok {
  1545. _spec.SetField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
  1546. }
  1547. if value, ok := _u.mutation.AddedVideoRateMultiplier(); ok {
  1548. _spec.AddField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
  1549. }
  1550. if value, ok := _u.mutation.VideoPrice480p(); ok {
  1551. _spec.SetField(group.FieldVideoPrice480p, field.TypeFloat64, value)
  1552. }
  1553. if value, ok := _u.mutation.AddedVideoPrice480p(); ok {
  1554. _spec.AddField(group.FieldVideoPrice480p, field.TypeFloat64, value)
  1555. }
  1556. if _u.mutation.VideoPrice480pCleared() {
  1557. _spec.ClearField(group.FieldVideoPrice480p, field.TypeFloat64)
  1558. }
  1559. if value, ok := _u.mutation.VideoPrice720p(); ok {
  1560. _spec.SetField(group.FieldVideoPrice720p, field.TypeFloat64, value)
  1561. }
  1562. if value, ok := _u.mutation.AddedVideoPrice720p(); ok {
  1563. _spec.AddField(group.FieldVideoPrice720p, field.TypeFloat64, value)
  1564. }
  1565. if _u.mutation.VideoPrice720pCleared() {
  1566. _spec.ClearField(group.FieldVideoPrice720p, field.TypeFloat64)
  1567. }
  1568. if value, ok := _u.mutation.VideoPrice1080p(); ok {
  1569. _spec.SetField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
  1570. }
  1571. if value, ok := _u.mutation.AddedVideoPrice1080p(); ok {
  1572. _spec.AddField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
  1573. }
  1574. if _u.mutation.VideoPrice1080pCleared() {
  1575. _spec.ClearField(group.FieldVideoPrice1080p, field.TypeFloat64)
  1576. }
  1577. if value, ok := _u.mutation.VideoModelPrices(); ok {
  1578. _spec.SetField(group.FieldVideoModelPrices, field.TypeJSON, value)
  1579. }
  1580. if _u.mutation.VideoModelPricesCleared() {
  1581. _spec.ClearField(group.FieldVideoModelPrices, field.TypeJSON)
  1582. }
  1583. if value, ok := _u.mutation.WebSearchPricePerCall(); ok {
  1584. _spec.SetField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value)
  1585. }
  1586. if value, ok := _u.mutation.AddedWebSearchPricePerCall(); ok {
  1587. _spec.AddField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value)
  1588. }
  1589. if _u.mutation.WebSearchPricePerCallCleared() {
  1590. _spec.ClearField(group.FieldWebSearchPricePerCall, field.TypeFloat64)
  1591. }
  1592. if value, ok := _u.mutation.SearchPricePer1k(); ok {
  1593. _spec.SetField(group.FieldSearchPricePer1k, field.TypeFloat64, value)
  1594. }
  1595. if value, ok := _u.mutation.AddedSearchPricePer1k(); ok {
  1596. _spec.AddField(group.FieldSearchPricePer1k, field.TypeFloat64, value)
  1597. }
  1598. if _u.mutation.SearchPricePer1kCleared() {
  1599. _spec.ClearField(group.FieldSearchPricePer1k, field.TypeFloat64)
  1600. }
  1601. if value, ok := _u.mutation.AudioRealtimePricePerMin(); ok {
  1602. _spec.SetField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value)
  1603. }
  1604. if value, ok := _u.mutation.AddedAudioRealtimePricePerMin(); ok {
  1605. _spec.AddField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value)
  1606. }
  1607. if _u.mutation.AudioRealtimePricePerMinCleared() {
  1608. _spec.ClearField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64)
  1609. }
  1610. if value, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok {
  1611. _spec.SetField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value)
  1612. }
  1613. if value, ok := _u.mutation.AddedAudioTtsPricePerMillionChars(); ok {
  1614. _spec.AddField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value)
  1615. }
  1616. if _u.mutation.AudioTtsPricePerMillionCharsCleared() {
  1617. _spec.ClearField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64)
  1618. }
  1619. if value, ok := _u.mutation.AudioSttPricePerHour(); ok {
  1620. _spec.SetField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value)
  1621. }
  1622. if value, ok := _u.mutation.AddedAudioSttPricePerHour(); ok {
  1623. _spec.AddField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value)
  1624. }
  1625. if _u.mutation.AudioSttPricePerHourCleared() {
  1626. _spec.ClearField(group.FieldAudioSttPricePerHour, field.TypeFloat64)
  1627. }
  1628. if value, ok := _u.mutation.LongContextPricingEnabled(); ok {
  1629. _spec.SetField(group.FieldLongContextPricingEnabled, field.TypeBool, value)
  1630. }
  1631. if value, ok := _u.mutation.ModelPricing(); ok {
  1632. _spec.SetField(group.FieldModelPricing, field.TypeJSON, value)
  1633. }
  1634. if value, ok := _u.mutation.AppendedModelPricing(); ok {
  1635. _spec.AddModifier(func(u *sql.UpdateBuilder) {
  1636. sqljson.Append(u, group.FieldModelPricing, value)
  1637. })
  1638. }
  1639. if _u.mutation.ModelPricingCleared() {
  1640. _spec.ClearField(group.FieldModelPricing, field.TypeJSON)
  1641. }
  1642. if value, ok := _u.mutation.ClaudeCodeOnly(); ok {
  1643. _spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value)
  1644. }
  1645. if value, ok := _u.mutation.FallbackGroupID(); ok {
  1646. _spec.SetField(group.FieldFallbackGroupID, field.TypeInt64, value)
  1647. }
  1648. if value, ok := _u.mutation.AddedFallbackGroupID(); ok {
  1649. _spec.AddField(group.FieldFallbackGroupID, field.TypeInt64, value)
  1650. }
  1651. if _u.mutation.FallbackGroupIDCleared() {
  1652. _spec.ClearField(group.FieldFallbackGroupID, field.TypeInt64)
  1653. }
  1654. if value, ok := _u.mutation.FallbackGroupIDOnInvalidRequest(); ok {
  1655. _spec.SetField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value)
  1656. }
  1657. if value, ok := _u.mutation.AddedFallbackGroupIDOnInvalidRequest(); ok {
  1658. _spec.AddField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value)
  1659. }
  1660. if _u.mutation.FallbackGroupIDOnInvalidRequestCleared() {
  1661. _spec.ClearField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64)
  1662. }
  1663. if value, ok := _u.mutation.ModelRouting(); ok {
  1664. _spec.SetField(group.FieldModelRouting, field.TypeJSON, value)
  1665. }
  1666. if _u.mutation.ModelRoutingCleared() {
  1667. _spec.ClearField(group.FieldModelRouting, field.TypeJSON)
  1668. }
  1669. if value, ok := _u.mutation.ModelRoutingEnabled(); ok {
  1670. _spec.SetField(group.FieldModelRoutingEnabled, field.TypeBool, value)
  1671. }
  1672. if value, ok := _u.mutation.McpXMLInject(); ok {
  1673. _spec.SetField(group.FieldMcpXMLInject, field.TypeBool, value)
  1674. }
  1675. if value, ok := _u.mutation.SupportedModelScopes(); ok {
  1676. _spec.SetField(group.FieldSupportedModelScopes, field.TypeJSON, value)
  1677. }
  1678. if value, ok := _u.mutation.AppendedSupportedModelScopes(); ok {
  1679. _spec.AddModifier(func(u *sql.UpdateBuilder) {
  1680. sqljson.Append(u, group.FieldSupportedModelScopes, value)
  1681. })
  1682. }
  1683. if value, ok := _u.mutation.SortOrder(); ok {
  1684. _spec.SetField(group.FieldSortOrder, field.TypeInt, value)
  1685. }
  1686. if value, ok := _u.mutation.AddedSortOrder(); ok {
  1687. _spec.AddField(group.FieldSortOrder, field.TypeInt, value)
  1688. }
  1689. if value, ok := _u.mutation.AllowMessagesDispatch(); ok {
  1690. _spec.SetField(group.FieldAllowMessagesDispatch, field.TypeBool, value)
  1691. }
  1692. if value, ok := _u.mutation.AllowLive(); ok {
  1693. _spec.SetField(group.FieldAllowLive, field.TypeBool, value)
  1694. }
  1695. if value, ok := _u.mutation.ForceOpenaiFast(); ok {
  1696. _spec.SetField(group.FieldForceOpenaiFast, field.TypeBool, value)
  1697. }
  1698. if value, ok := _u.mutation.FreeOpenaiFast(); ok {
  1699. _spec.SetField(group.FieldFreeOpenaiFast, field.TypeBool, value)
  1700. }
  1701. if value, ok := _u.mutation.RequireOauthOnly(); ok {
  1702. _spec.SetField(group.FieldRequireOauthOnly, field.TypeBool, value)
  1703. }
  1704. if value, ok := _u.mutation.RequirePrivacySet(); ok {
  1705. _spec.SetField(group.FieldRequirePrivacySet, field.TypeBool, value)
  1706. }
  1707. if value, ok := _u.mutation.DefaultMappedModel(); ok {
  1708. _spec.SetField(group.FieldDefaultMappedModel, field.TypeString, value)
  1709. }
  1710. if value, ok := _u.mutation.MessagesDispatchModelConfig(); ok {
  1711. _spec.SetField(group.FieldMessagesDispatchModelConfig, field.TypeJSON, value)
  1712. }
  1713. if value, ok := _u.mutation.ModelAllowlist(); ok {
  1714. _spec.SetField(group.FieldModelAllowlist, field.TypeJSON, value)
  1715. }
  1716. if value, ok := _u.mutation.CodexModelsManifestConfig(); ok {
  1717. _spec.SetField(group.FieldCodexModelsManifestConfig, field.TypeJSON, value)
  1718. }
  1719. if value, ok := _u.mutation.RpmLimit(); ok {
  1720. _spec.SetField(group.FieldRpmLimit, field.TypeInt, value)
  1721. }
  1722. if value, ok := _u.mutation.AddedRpmLimit(); ok {
  1723. _spec.AddField(group.FieldRpmLimit, field.TypeInt, value)
  1724. }
  1725. if value, ok := _u.mutation.MaxReasoningEffort(); ok {
  1726. _spec.SetField(group.FieldMaxReasoningEffort, field.TypeString, value)
  1727. }
  1728. if value, ok := _u.mutation.MaxReasoningEffortOverLimit(); ok {
  1729. _spec.SetField(group.FieldMaxReasoningEffortOverLimit, field.TypeString, value)
  1730. }
  1731. if value, ok := _u.mutation.ReasoningEffortMappings(); ok {
  1732. _spec.SetField(group.FieldReasoningEffortMappings, field.TypeJSON, value)
  1733. }
  1734. if value, ok := _u.mutation.AppendedReasoningEffortMappings(); ok {
  1735. _spec.AddModifier(func(u *sql.UpdateBuilder) {
  1736. sqljson.Append(u, group.FieldReasoningEffortMappings, value)
  1737. })
  1738. }
  1739. if value, ok := _u.mutation.ProfitControlEnabled(); ok {
  1740. _spec.SetField(group.FieldProfitControlEnabled, field.TypeBool, value)
  1741. }
  1742. if value, ok := _u.mutation.ProfitMinMargin(); ok {
  1743. _spec.SetField(group.FieldProfitMinMargin, field.TypeFloat64, value)
  1744. }
  1745. if value, ok := _u.mutation.AddedProfitMinMargin(); ok {
  1746. _spec.AddField(group.FieldProfitMinMargin, field.TypeFloat64, value)
  1747. }
  1748. if value, ok := _u.mutation.ProfitSafetyBuffer(); ok {
  1749. _spec.SetField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value)
  1750. }
  1751. if value, ok := _u.mutation.AddedProfitSafetyBuffer(); ok {
  1752. _spec.AddField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value)
  1753. }
  1754. if _u.mutation.APIKeysCleared() {
  1755. edge := &sqlgraph.EdgeSpec{
  1756. Rel: sqlgraph.O2M,
  1757. Inverse: false,
  1758. Table: group.APIKeysTable,
  1759. Columns: []string{group.APIKeysColumn},
  1760. Bidi: false,
  1761. Target: &sqlgraph.EdgeTarget{
  1762. IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64),
  1763. },
  1764. }
  1765. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1766. }
  1767. if nodes := _u.mutation.RemovedAPIKeysIDs(); len(nodes) > 0 && !_u.mutation.APIKeysCleared() {
  1768. edge := &sqlgraph.EdgeSpec{
  1769. Rel: sqlgraph.O2M,
  1770. Inverse: false,
  1771. Table: group.APIKeysTable,
  1772. Columns: []string{group.APIKeysColumn},
  1773. Bidi: false,
  1774. Target: &sqlgraph.EdgeTarget{
  1775. IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64),
  1776. },
  1777. }
  1778. for _, k := range nodes {
  1779. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1780. }
  1781. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1782. }
  1783. if nodes := _u.mutation.APIKeysIDs(); len(nodes) > 0 {
  1784. edge := &sqlgraph.EdgeSpec{
  1785. Rel: sqlgraph.O2M,
  1786. Inverse: false,
  1787. Table: group.APIKeysTable,
  1788. Columns: []string{group.APIKeysColumn},
  1789. Bidi: false,
  1790. Target: &sqlgraph.EdgeTarget{
  1791. IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64),
  1792. },
  1793. }
  1794. for _, k := range nodes {
  1795. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1796. }
  1797. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  1798. }
  1799. if _u.mutation.RedeemCodesCleared() {
  1800. edge := &sqlgraph.EdgeSpec{
  1801. Rel: sqlgraph.O2M,
  1802. Inverse: false,
  1803. Table: group.RedeemCodesTable,
  1804. Columns: []string{group.RedeemCodesColumn},
  1805. Bidi: false,
  1806. Target: &sqlgraph.EdgeTarget{
  1807. IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64),
  1808. },
  1809. }
  1810. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1811. }
  1812. if nodes := _u.mutation.RemovedRedeemCodesIDs(); len(nodes) > 0 && !_u.mutation.RedeemCodesCleared() {
  1813. edge := &sqlgraph.EdgeSpec{
  1814. Rel: sqlgraph.O2M,
  1815. Inverse: false,
  1816. Table: group.RedeemCodesTable,
  1817. Columns: []string{group.RedeemCodesColumn},
  1818. Bidi: false,
  1819. Target: &sqlgraph.EdgeTarget{
  1820. IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64),
  1821. },
  1822. }
  1823. for _, k := range nodes {
  1824. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1825. }
  1826. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1827. }
  1828. if nodes := _u.mutation.RedeemCodesIDs(); len(nodes) > 0 {
  1829. edge := &sqlgraph.EdgeSpec{
  1830. Rel: sqlgraph.O2M,
  1831. Inverse: false,
  1832. Table: group.RedeemCodesTable,
  1833. Columns: []string{group.RedeemCodesColumn},
  1834. Bidi: false,
  1835. Target: &sqlgraph.EdgeTarget{
  1836. IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64),
  1837. },
  1838. }
  1839. for _, k := range nodes {
  1840. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1841. }
  1842. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  1843. }
  1844. if _u.mutation.SubscriptionsCleared() {
  1845. edge := &sqlgraph.EdgeSpec{
  1846. Rel: sqlgraph.O2M,
  1847. Inverse: false,
  1848. Table: group.SubscriptionsTable,
  1849. Columns: []string{group.SubscriptionsColumn},
  1850. Bidi: false,
  1851. Target: &sqlgraph.EdgeTarget{
  1852. IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64),
  1853. },
  1854. }
  1855. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1856. }
  1857. if nodes := _u.mutation.RemovedSubscriptionsIDs(); len(nodes) > 0 && !_u.mutation.SubscriptionsCleared() {
  1858. edge := &sqlgraph.EdgeSpec{
  1859. Rel: sqlgraph.O2M,
  1860. Inverse: false,
  1861. Table: group.SubscriptionsTable,
  1862. Columns: []string{group.SubscriptionsColumn},
  1863. Bidi: false,
  1864. Target: &sqlgraph.EdgeTarget{
  1865. IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64),
  1866. },
  1867. }
  1868. for _, k := range nodes {
  1869. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1870. }
  1871. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1872. }
  1873. if nodes := _u.mutation.SubscriptionsIDs(); len(nodes) > 0 {
  1874. edge := &sqlgraph.EdgeSpec{
  1875. Rel: sqlgraph.O2M,
  1876. Inverse: false,
  1877. Table: group.SubscriptionsTable,
  1878. Columns: []string{group.SubscriptionsColumn},
  1879. Bidi: false,
  1880. Target: &sqlgraph.EdgeTarget{
  1881. IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64),
  1882. },
  1883. }
  1884. for _, k := range nodes {
  1885. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1886. }
  1887. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  1888. }
  1889. if _u.mutation.UsageLogsCleared() {
  1890. edge := &sqlgraph.EdgeSpec{
  1891. Rel: sqlgraph.O2M,
  1892. Inverse: false,
  1893. Table: group.UsageLogsTable,
  1894. Columns: []string{group.UsageLogsColumn},
  1895. Bidi: false,
  1896. Target: &sqlgraph.EdgeTarget{
  1897. IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64),
  1898. },
  1899. }
  1900. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1901. }
  1902. if nodes := _u.mutation.RemovedUsageLogsIDs(); len(nodes) > 0 && !_u.mutation.UsageLogsCleared() {
  1903. edge := &sqlgraph.EdgeSpec{
  1904. Rel: sqlgraph.O2M,
  1905. Inverse: false,
  1906. Table: group.UsageLogsTable,
  1907. Columns: []string{group.UsageLogsColumn},
  1908. Bidi: false,
  1909. Target: &sqlgraph.EdgeTarget{
  1910. IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64),
  1911. },
  1912. }
  1913. for _, k := range nodes {
  1914. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1915. }
  1916. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1917. }
  1918. if nodes := _u.mutation.UsageLogsIDs(); len(nodes) > 0 {
  1919. edge := &sqlgraph.EdgeSpec{
  1920. Rel: sqlgraph.O2M,
  1921. Inverse: false,
  1922. Table: group.UsageLogsTable,
  1923. Columns: []string{group.UsageLogsColumn},
  1924. Bidi: false,
  1925. Target: &sqlgraph.EdgeTarget{
  1926. IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64),
  1927. },
  1928. }
  1929. for _, k := range nodes {
  1930. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1931. }
  1932. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  1933. }
  1934. if _u.mutation.AccountsCleared() {
  1935. edge := &sqlgraph.EdgeSpec{
  1936. Rel: sqlgraph.M2M,
  1937. Inverse: true,
  1938. Table: group.AccountsTable,
  1939. Columns: group.AccountsPrimaryKey,
  1940. Bidi: false,
  1941. Target: &sqlgraph.EdgeTarget{
  1942. IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
  1943. },
  1944. }
  1945. createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)}
  1946. createE.defaults()
  1947. _, specE := createE.createSpec()
  1948. edge.Target.Fields = specE.Fields
  1949. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1950. }
  1951. if nodes := _u.mutation.RemovedAccountsIDs(); len(nodes) > 0 && !_u.mutation.AccountsCleared() {
  1952. edge := &sqlgraph.EdgeSpec{
  1953. Rel: sqlgraph.M2M,
  1954. Inverse: true,
  1955. Table: group.AccountsTable,
  1956. Columns: group.AccountsPrimaryKey,
  1957. Bidi: false,
  1958. Target: &sqlgraph.EdgeTarget{
  1959. IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
  1960. },
  1961. }
  1962. for _, k := range nodes {
  1963. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1964. }
  1965. createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)}
  1966. createE.defaults()
  1967. _, specE := createE.createSpec()
  1968. edge.Target.Fields = specE.Fields
  1969. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  1970. }
  1971. if nodes := _u.mutation.AccountsIDs(); len(nodes) > 0 {
  1972. edge := &sqlgraph.EdgeSpec{
  1973. Rel: sqlgraph.M2M,
  1974. Inverse: true,
  1975. Table: group.AccountsTable,
  1976. Columns: group.AccountsPrimaryKey,
  1977. Bidi: false,
  1978. Target: &sqlgraph.EdgeTarget{
  1979. IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
  1980. },
  1981. }
  1982. for _, k := range nodes {
  1983. edge.Target.Nodes = append(edge.Target.Nodes, k)
  1984. }
  1985. createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)}
  1986. createE.defaults()
  1987. _, specE := createE.createSpec()
  1988. edge.Target.Fields = specE.Fields
  1989. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  1990. }
  1991. if _u.mutation.AllowedUsersCleared() {
  1992. edge := &sqlgraph.EdgeSpec{
  1993. Rel: sqlgraph.M2M,
  1994. Inverse: true,
  1995. Table: group.AllowedUsersTable,
  1996. Columns: group.AllowedUsersPrimaryKey,
  1997. Bidi: false,
  1998. Target: &sqlgraph.EdgeTarget{
  1999. IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
  2000. },
  2001. }
  2002. createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)}
  2003. createE.defaults()
  2004. _, specE := createE.createSpec()
  2005. edge.Target.Fields = specE.Fields
  2006. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  2007. }
  2008. if nodes := _u.mutation.RemovedAllowedUsersIDs(); len(nodes) > 0 && !_u.mutation.AllowedUsersCleared() {
  2009. edge := &sqlgraph.EdgeSpec{
  2010. Rel: sqlgraph.M2M,
  2011. Inverse: true,
  2012. Table: group.AllowedUsersTable,
  2013. Columns: group.AllowedUsersPrimaryKey,
  2014. Bidi: false,
  2015. Target: &sqlgraph.EdgeTarget{
  2016. IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
  2017. },
  2018. }
  2019. for _, k := range nodes {
  2020. edge.Target.Nodes = append(edge.Target.Nodes, k)
  2021. }
  2022. createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)}
  2023. createE.defaults()
  2024. _, specE := createE.createSpec()
  2025. edge.Target.Fields = specE.Fields
  2026. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  2027. }
  2028. if nodes := _u.mutation.AllowedUsersIDs(); len(nodes) > 0 {
  2029. edge := &sqlgraph.EdgeSpec{
  2030. Rel: sqlgraph.M2M,
  2031. Inverse: true,
  2032. Table: group.AllowedUsersTable,
  2033. Columns: group.AllowedUsersPrimaryKey,
  2034. Bidi: false,
  2035. Target: &sqlgraph.EdgeTarget{
  2036. IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
  2037. },
  2038. }
  2039. for _, k := range nodes {
  2040. edge.Target.Nodes = append(edge.Target.Nodes, k)
  2041. }
  2042. createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)}
  2043. createE.defaults()
  2044. _, specE := createE.createSpec()
  2045. edge.Target.Fields = specE.Fields
  2046. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  2047. }
  2048. if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
  2049. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  2050. err = &NotFoundError{group.Label}
  2051. } else if sqlgraph.IsConstraintError(err) {
  2052. err = &ConstraintError{msg: err.Error(), wrap: err}
  2053. }
  2054. return 0, err
  2055. }
  2056. _u.mutation.done = true
  2057. return _node, nil
  2058. }
  2059. // GroupUpdateOne is the builder for updating a single Group entity.
  2060. type GroupUpdateOne struct {
  2061. config
  2062. fields []string
  2063. hooks []Hook
  2064. mutation *GroupMutation
  2065. }
  2066. // SetUpdatedAt sets the "updated_at" field.
  2067. func (_u *GroupUpdateOne) SetUpdatedAt(v time.Time) *GroupUpdateOne {
  2068. _u.mutation.SetUpdatedAt(v)
  2069. return _u
  2070. }
  2071. // SetDeletedAt sets the "deleted_at" field.
  2072. func (_u *GroupUpdateOne) SetDeletedAt(v time.Time) *GroupUpdateOne {
  2073. _u.mutation.SetDeletedAt(v)
  2074. return _u
  2075. }
  2076. // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
  2077. func (_u *GroupUpdateOne) SetNillableDeletedAt(v *time.Time) *GroupUpdateOne {
  2078. if v != nil {
  2079. _u.SetDeletedAt(*v)
  2080. }
  2081. return _u
  2082. }
  2083. // ClearDeletedAt clears the value of the "deleted_at" field.
  2084. func (_u *GroupUpdateOne) ClearDeletedAt() *GroupUpdateOne {
  2085. _u.mutation.ClearDeletedAt()
  2086. return _u
  2087. }
  2088. // SetName sets the "name" field.
  2089. func (_u *GroupUpdateOne) SetName(v string) *GroupUpdateOne {
  2090. _u.mutation.SetName(v)
  2091. return _u
  2092. }
  2093. // SetNillableName sets the "name" field if the given value is not nil.
  2094. func (_u *GroupUpdateOne) SetNillableName(v *string) *GroupUpdateOne {
  2095. if v != nil {
  2096. _u.SetName(*v)
  2097. }
  2098. return _u
  2099. }
  2100. // SetDescription sets the "description" field.
  2101. func (_u *GroupUpdateOne) SetDescription(v string) *GroupUpdateOne {
  2102. _u.mutation.SetDescription(v)
  2103. return _u
  2104. }
  2105. // SetNillableDescription sets the "description" field if the given value is not nil.
  2106. func (_u *GroupUpdateOne) SetNillableDescription(v *string) *GroupUpdateOne {
  2107. if v != nil {
  2108. _u.SetDescription(*v)
  2109. }
  2110. return _u
  2111. }
  2112. // ClearDescription clears the value of the "description" field.
  2113. func (_u *GroupUpdateOne) ClearDescription() *GroupUpdateOne {
  2114. _u.mutation.ClearDescription()
  2115. return _u
  2116. }
  2117. // SetRateMultiplier sets the "rate_multiplier" field.
  2118. func (_u *GroupUpdateOne) SetRateMultiplier(v float64) *GroupUpdateOne {
  2119. _u.mutation.ResetRateMultiplier()
  2120. _u.mutation.SetRateMultiplier(v)
  2121. return _u
  2122. }
  2123. // SetNillableRateMultiplier sets the "rate_multiplier" field if the given value is not nil.
  2124. func (_u *GroupUpdateOne) SetNillableRateMultiplier(v *float64) *GroupUpdateOne {
  2125. if v != nil {
  2126. _u.SetRateMultiplier(*v)
  2127. }
  2128. return _u
  2129. }
  2130. // AddRateMultiplier adds value to the "rate_multiplier" field.
  2131. func (_u *GroupUpdateOne) AddRateMultiplier(v float64) *GroupUpdateOne {
  2132. _u.mutation.AddRateMultiplier(v)
  2133. return _u
  2134. }
  2135. // SetPeakRateEnabled sets the "peak_rate_enabled" field.
  2136. func (_u *GroupUpdateOne) SetPeakRateEnabled(v bool) *GroupUpdateOne {
  2137. _u.mutation.SetPeakRateEnabled(v)
  2138. return _u
  2139. }
  2140. // SetNillablePeakRateEnabled sets the "peak_rate_enabled" field if the given value is not nil.
  2141. func (_u *GroupUpdateOne) SetNillablePeakRateEnabled(v *bool) *GroupUpdateOne {
  2142. if v != nil {
  2143. _u.SetPeakRateEnabled(*v)
  2144. }
  2145. return _u
  2146. }
  2147. // SetPeakStart sets the "peak_start" field.
  2148. func (_u *GroupUpdateOne) SetPeakStart(v string) *GroupUpdateOne {
  2149. _u.mutation.SetPeakStart(v)
  2150. return _u
  2151. }
  2152. // SetNillablePeakStart sets the "peak_start" field if the given value is not nil.
  2153. func (_u *GroupUpdateOne) SetNillablePeakStart(v *string) *GroupUpdateOne {
  2154. if v != nil {
  2155. _u.SetPeakStart(*v)
  2156. }
  2157. return _u
  2158. }
  2159. // SetPeakEnd sets the "peak_end" field.
  2160. func (_u *GroupUpdateOne) SetPeakEnd(v string) *GroupUpdateOne {
  2161. _u.mutation.SetPeakEnd(v)
  2162. return _u
  2163. }
  2164. // SetNillablePeakEnd sets the "peak_end" field if the given value is not nil.
  2165. func (_u *GroupUpdateOne) SetNillablePeakEnd(v *string) *GroupUpdateOne {
  2166. if v != nil {
  2167. _u.SetPeakEnd(*v)
  2168. }
  2169. return _u
  2170. }
  2171. // SetPeakRateMultiplier sets the "peak_rate_multiplier" field.
  2172. func (_u *GroupUpdateOne) SetPeakRateMultiplier(v float64) *GroupUpdateOne {
  2173. _u.mutation.ResetPeakRateMultiplier()
  2174. _u.mutation.SetPeakRateMultiplier(v)
  2175. return _u
  2176. }
  2177. // SetNillablePeakRateMultiplier sets the "peak_rate_multiplier" field if the given value is not nil.
  2178. func (_u *GroupUpdateOne) SetNillablePeakRateMultiplier(v *float64) *GroupUpdateOne {
  2179. if v != nil {
  2180. _u.SetPeakRateMultiplier(*v)
  2181. }
  2182. return _u
  2183. }
  2184. // AddPeakRateMultiplier adds value to the "peak_rate_multiplier" field.
  2185. func (_u *GroupUpdateOne) AddPeakRateMultiplier(v float64) *GroupUpdateOne {
  2186. _u.mutation.AddPeakRateMultiplier(v)
  2187. return _u
  2188. }
  2189. // SetIsExclusive sets the "is_exclusive" field.
  2190. func (_u *GroupUpdateOne) SetIsExclusive(v bool) *GroupUpdateOne {
  2191. _u.mutation.SetIsExclusive(v)
  2192. return _u
  2193. }
  2194. // SetNillableIsExclusive sets the "is_exclusive" field if the given value is not nil.
  2195. func (_u *GroupUpdateOne) SetNillableIsExclusive(v *bool) *GroupUpdateOne {
  2196. if v != nil {
  2197. _u.SetIsExclusive(*v)
  2198. }
  2199. return _u
  2200. }
  2201. // SetSecurityPolicyEnabled sets the "security_policy_enabled" field.
  2202. func (_u *GroupUpdateOne) SetSecurityPolicyEnabled(v bool) *GroupUpdateOne {
  2203. _u.mutation.SetSecurityPolicyEnabled(v)
  2204. return _u
  2205. }
  2206. // SetNillableSecurityPolicyEnabled sets the "security_policy_enabled" field if the given value is not nil.
  2207. func (_u *GroupUpdateOne) SetNillableSecurityPolicyEnabled(v *bool) *GroupUpdateOne {
  2208. if v != nil {
  2209. _u.SetSecurityPolicyEnabled(*v)
  2210. }
  2211. return _u
  2212. }
  2213. // SetSecurityPolicyMode sets the "security_policy_mode" field.
  2214. func (_u *GroupUpdateOne) SetSecurityPolicyMode(v string) *GroupUpdateOne {
  2215. _u.mutation.SetSecurityPolicyMode(v)
  2216. return _u
  2217. }
  2218. // SetNillableSecurityPolicyMode sets the "security_policy_mode" field if the given value is not nil.
  2219. func (_u *GroupUpdateOne) SetNillableSecurityPolicyMode(v *string) *GroupUpdateOne {
  2220. if v != nil {
  2221. _u.SetSecurityPolicyMode(*v)
  2222. }
  2223. return _u
  2224. }
  2225. // SetSecurityPolicyEmailEnabled sets the "security_policy_email_enabled" field.
  2226. func (_u *GroupUpdateOne) SetSecurityPolicyEmailEnabled(v bool) *GroupUpdateOne {
  2227. _u.mutation.SetSecurityPolicyEmailEnabled(v)
  2228. return _u
  2229. }
  2230. // SetNillableSecurityPolicyEmailEnabled sets the "security_policy_email_enabled" field if the given value is not nil.
  2231. func (_u *GroupUpdateOne) SetNillableSecurityPolicyEmailEnabled(v *bool) *GroupUpdateOne {
  2232. if v != nil {
  2233. _u.SetSecurityPolicyEmailEnabled(*v)
  2234. }
  2235. return _u
  2236. }
  2237. // SetStatus sets the "status" field.
  2238. func (_u *GroupUpdateOne) SetStatus(v string) *GroupUpdateOne {
  2239. _u.mutation.SetStatus(v)
  2240. return _u
  2241. }
  2242. // SetNillableStatus sets the "status" field if the given value is not nil.
  2243. func (_u *GroupUpdateOne) SetNillableStatus(v *string) *GroupUpdateOne {
  2244. if v != nil {
  2245. _u.SetStatus(*v)
  2246. }
  2247. return _u
  2248. }
  2249. // SetPlatform sets the "platform" field.
  2250. func (_u *GroupUpdateOne) SetPlatform(v string) *GroupUpdateOne {
  2251. _u.mutation.SetPlatform(v)
  2252. return _u
  2253. }
  2254. // SetNillablePlatform sets the "platform" field if the given value is not nil.
  2255. func (_u *GroupUpdateOne) SetNillablePlatform(v *string) *GroupUpdateOne {
  2256. if v != nil {
  2257. _u.SetPlatform(*v)
  2258. }
  2259. return _u
  2260. }
  2261. // SetSubscriptionType sets the "subscription_type" field.
  2262. func (_u *GroupUpdateOne) SetSubscriptionType(v string) *GroupUpdateOne {
  2263. _u.mutation.SetSubscriptionType(v)
  2264. return _u
  2265. }
  2266. // SetNillableSubscriptionType sets the "subscription_type" field if the given value is not nil.
  2267. func (_u *GroupUpdateOne) SetNillableSubscriptionType(v *string) *GroupUpdateOne {
  2268. if v != nil {
  2269. _u.SetSubscriptionType(*v)
  2270. }
  2271. return _u
  2272. }
  2273. // SetDailyLimitUsd sets the "daily_limit_usd" field.
  2274. func (_u *GroupUpdateOne) SetDailyLimitUsd(v float64) *GroupUpdateOne {
  2275. _u.mutation.ResetDailyLimitUsd()
  2276. _u.mutation.SetDailyLimitUsd(v)
  2277. return _u
  2278. }
  2279. // SetNillableDailyLimitUsd sets the "daily_limit_usd" field if the given value is not nil.
  2280. func (_u *GroupUpdateOne) SetNillableDailyLimitUsd(v *float64) *GroupUpdateOne {
  2281. if v != nil {
  2282. _u.SetDailyLimitUsd(*v)
  2283. }
  2284. return _u
  2285. }
  2286. // AddDailyLimitUsd adds value to the "daily_limit_usd" field.
  2287. func (_u *GroupUpdateOne) AddDailyLimitUsd(v float64) *GroupUpdateOne {
  2288. _u.mutation.AddDailyLimitUsd(v)
  2289. return _u
  2290. }
  2291. // ClearDailyLimitUsd clears the value of the "daily_limit_usd" field.
  2292. func (_u *GroupUpdateOne) ClearDailyLimitUsd() *GroupUpdateOne {
  2293. _u.mutation.ClearDailyLimitUsd()
  2294. return _u
  2295. }
  2296. // SetWeeklyLimitUsd sets the "weekly_limit_usd" field.
  2297. func (_u *GroupUpdateOne) SetWeeklyLimitUsd(v float64) *GroupUpdateOne {
  2298. _u.mutation.ResetWeeklyLimitUsd()
  2299. _u.mutation.SetWeeklyLimitUsd(v)
  2300. return _u
  2301. }
  2302. // SetNillableWeeklyLimitUsd sets the "weekly_limit_usd" field if the given value is not nil.
  2303. func (_u *GroupUpdateOne) SetNillableWeeklyLimitUsd(v *float64) *GroupUpdateOne {
  2304. if v != nil {
  2305. _u.SetWeeklyLimitUsd(*v)
  2306. }
  2307. return _u
  2308. }
  2309. // AddWeeklyLimitUsd adds value to the "weekly_limit_usd" field.
  2310. func (_u *GroupUpdateOne) AddWeeklyLimitUsd(v float64) *GroupUpdateOne {
  2311. _u.mutation.AddWeeklyLimitUsd(v)
  2312. return _u
  2313. }
  2314. // ClearWeeklyLimitUsd clears the value of the "weekly_limit_usd" field.
  2315. func (_u *GroupUpdateOne) ClearWeeklyLimitUsd() *GroupUpdateOne {
  2316. _u.mutation.ClearWeeklyLimitUsd()
  2317. return _u
  2318. }
  2319. // SetMonthlyLimitUsd sets the "monthly_limit_usd" field.
  2320. func (_u *GroupUpdateOne) SetMonthlyLimitUsd(v float64) *GroupUpdateOne {
  2321. _u.mutation.ResetMonthlyLimitUsd()
  2322. _u.mutation.SetMonthlyLimitUsd(v)
  2323. return _u
  2324. }
  2325. // SetNillableMonthlyLimitUsd sets the "monthly_limit_usd" field if the given value is not nil.
  2326. func (_u *GroupUpdateOne) SetNillableMonthlyLimitUsd(v *float64) *GroupUpdateOne {
  2327. if v != nil {
  2328. _u.SetMonthlyLimitUsd(*v)
  2329. }
  2330. return _u
  2331. }
  2332. // AddMonthlyLimitUsd adds value to the "monthly_limit_usd" field.
  2333. func (_u *GroupUpdateOne) AddMonthlyLimitUsd(v float64) *GroupUpdateOne {
  2334. _u.mutation.AddMonthlyLimitUsd(v)
  2335. return _u
  2336. }
  2337. // ClearMonthlyLimitUsd clears the value of the "monthly_limit_usd" field.
  2338. func (_u *GroupUpdateOne) ClearMonthlyLimitUsd() *GroupUpdateOne {
  2339. _u.mutation.ClearMonthlyLimitUsd()
  2340. return _u
  2341. }
  2342. // SetDefaultValidityDays sets the "default_validity_days" field.
  2343. func (_u *GroupUpdateOne) SetDefaultValidityDays(v int) *GroupUpdateOne {
  2344. _u.mutation.ResetDefaultValidityDays()
  2345. _u.mutation.SetDefaultValidityDays(v)
  2346. return _u
  2347. }
  2348. // SetNillableDefaultValidityDays sets the "default_validity_days" field if the given value is not nil.
  2349. func (_u *GroupUpdateOne) SetNillableDefaultValidityDays(v *int) *GroupUpdateOne {
  2350. if v != nil {
  2351. _u.SetDefaultValidityDays(*v)
  2352. }
  2353. return _u
  2354. }
  2355. // AddDefaultValidityDays adds value to the "default_validity_days" field.
  2356. func (_u *GroupUpdateOne) AddDefaultValidityDays(v int) *GroupUpdateOne {
  2357. _u.mutation.AddDefaultValidityDays(v)
  2358. return _u
  2359. }
  2360. // SetAllowImageGeneration sets the "allow_image_generation" field.
  2361. func (_u *GroupUpdateOne) SetAllowImageGeneration(v bool) *GroupUpdateOne {
  2362. _u.mutation.SetAllowImageGeneration(v)
  2363. return _u
  2364. }
  2365. // SetNillableAllowImageGeneration sets the "allow_image_generation" field if the given value is not nil.
  2366. func (_u *GroupUpdateOne) SetNillableAllowImageGeneration(v *bool) *GroupUpdateOne {
  2367. if v != nil {
  2368. _u.SetAllowImageGeneration(*v)
  2369. }
  2370. return _u
  2371. }
  2372. // SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
  2373. func (_u *GroupUpdateOne) SetAllowBatchImageGeneration(v bool) *GroupUpdateOne {
  2374. _u.mutation.SetAllowBatchImageGeneration(v)
  2375. return _u
  2376. }
  2377. // SetNillableAllowBatchImageGeneration sets the "allow_batch_image_generation" field if the given value is not nil.
  2378. func (_u *GroupUpdateOne) SetNillableAllowBatchImageGeneration(v *bool) *GroupUpdateOne {
  2379. if v != nil {
  2380. _u.SetAllowBatchImageGeneration(*v)
  2381. }
  2382. return _u
  2383. }
  2384. // SetImageRateIndependent sets the "image_rate_independent" field.
  2385. func (_u *GroupUpdateOne) SetImageRateIndependent(v bool) *GroupUpdateOne {
  2386. _u.mutation.SetImageRateIndependent(v)
  2387. return _u
  2388. }
  2389. // SetNillableImageRateIndependent sets the "image_rate_independent" field if the given value is not nil.
  2390. func (_u *GroupUpdateOne) SetNillableImageRateIndependent(v *bool) *GroupUpdateOne {
  2391. if v != nil {
  2392. _u.SetImageRateIndependent(*v)
  2393. }
  2394. return _u
  2395. }
  2396. // SetImageRateMultiplier sets the "image_rate_multiplier" field.
  2397. func (_u *GroupUpdateOne) SetImageRateMultiplier(v float64) *GroupUpdateOne {
  2398. _u.mutation.ResetImageRateMultiplier()
  2399. _u.mutation.SetImageRateMultiplier(v)
  2400. return _u
  2401. }
  2402. // SetNillableImageRateMultiplier sets the "image_rate_multiplier" field if the given value is not nil.
  2403. func (_u *GroupUpdateOne) SetNillableImageRateMultiplier(v *float64) *GroupUpdateOne {
  2404. if v != nil {
  2405. _u.SetImageRateMultiplier(*v)
  2406. }
  2407. return _u
  2408. }
  2409. // AddImageRateMultiplier adds value to the "image_rate_multiplier" field.
  2410. func (_u *GroupUpdateOne) AddImageRateMultiplier(v float64) *GroupUpdateOne {
  2411. _u.mutation.AddImageRateMultiplier(v)
  2412. return _u
  2413. }
  2414. // SetImagePrice1k sets the "image_price_1k" field.
  2415. func (_u *GroupUpdateOne) SetImagePrice1k(v float64) *GroupUpdateOne {
  2416. _u.mutation.ResetImagePrice1k()
  2417. _u.mutation.SetImagePrice1k(v)
  2418. return _u
  2419. }
  2420. // SetNillableImagePrice1k sets the "image_price_1k" field if the given value is not nil.
  2421. func (_u *GroupUpdateOne) SetNillableImagePrice1k(v *float64) *GroupUpdateOne {
  2422. if v != nil {
  2423. _u.SetImagePrice1k(*v)
  2424. }
  2425. return _u
  2426. }
  2427. // AddImagePrice1k adds value to the "image_price_1k" field.
  2428. func (_u *GroupUpdateOne) AddImagePrice1k(v float64) *GroupUpdateOne {
  2429. _u.mutation.AddImagePrice1k(v)
  2430. return _u
  2431. }
  2432. // ClearImagePrice1k clears the value of the "image_price_1k" field.
  2433. func (_u *GroupUpdateOne) ClearImagePrice1k() *GroupUpdateOne {
  2434. _u.mutation.ClearImagePrice1k()
  2435. return _u
  2436. }
  2437. // SetImagePrice2k sets the "image_price_2k" field.
  2438. func (_u *GroupUpdateOne) SetImagePrice2k(v float64) *GroupUpdateOne {
  2439. _u.mutation.ResetImagePrice2k()
  2440. _u.mutation.SetImagePrice2k(v)
  2441. return _u
  2442. }
  2443. // SetNillableImagePrice2k sets the "image_price_2k" field if the given value is not nil.
  2444. func (_u *GroupUpdateOne) SetNillableImagePrice2k(v *float64) *GroupUpdateOne {
  2445. if v != nil {
  2446. _u.SetImagePrice2k(*v)
  2447. }
  2448. return _u
  2449. }
  2450. // AddImagePrice2k adds value to the "image_price_2k" field.
  2451. func (_u *GroupUpdateOne) AddImagePrice2k(v float64) *GroupUpdateOne {
  2452. _u.mutation.AddImagePrice2k(v)
  2453. return _u
  2454. }
  2455. // ClearImagePrice2k clears the value of the "image_price_2k" field.
  2456. func (_u *GroupUpdateOne) ClearImagePrice2k() *GroupUpdateOne {
  2457. _u.mutation.ClearImagePrice2k()
  2458. return _u
  2459. }
  2460. // SetImagePrice4k sets the "image_price_4k" field.
  2461. func (_u *GroupUpdateOne) SetImagePrice4k(v float64) *GroupUpdateOne {
  2462. _u.mutation.ResetImagePrice4k()
  2463. _u.mutation.SetImagePrice4k(v)
  2464. return _u
  2465. }
  2466. // SetNillableImagePrice4k sets the "image_price_4k" field if the given value is not nil.
  2467. func (_u *GroupUpdateOne) SetNillableImagePrice4k(v *float64) *GroupUpdateOne {
  2468. if v != nil {
  2469. _u.SetImagePrice4k(*v)
  2470. }
  2471. return _u
  2472. }
  2473. // AddImagePrice4k adds value to the "image_price_4k" field.
  2474. func (_u *GroupUpdateOne) AddImagePrice4k(v float64) *GroupUpdateOne {
  2475. _u.mutation.AddImagePrice4k(v)
  2476. return _u
  2477. }
  2478. // ClearImagePrice4k clears the value of the "image_price_4k" field.
  2479. func (_u *GroupUpdateOne) ClearImagePrice4k() *GroupUpdateOne {
  2480. _u.mutation.ClearImagePrice4k()
  2481. return _u
  2482. }
  2483. // SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
  2484. func (_u *GroupUpdateOne) SetBatchImageDiscountMultiplier(v float64) *GroupUpdateOne {
  2485. _u.mutation.ResetBatchImageDiscountMultiplier()
  2486. _u.mutation.SetBatchImageDiscountMultiplier(v)
  2487. return _u
  2488. }
  2489. // SetNillableBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field if the given value is not nil.
  2490. func (_u *GroupUpdateOne) SetNillableBatchImageDiscountMultiplier(v *float64) *GroupUpdateOne {
  2491. if v != nil {
  2492. _u.SetBatchImageDiscountMultiplier(*v)
  2493. }
  2494. return _u
  2495. }
  2496. // AddBatchImageDiscountMultiplier adds value to the "batch_image_discount_multiplier" field.
  2497. func (_u *GroupUpdateOne) AddBatchImageDiscountMultiplier(v float64) *GroupUpdateOne {
  2498. _u.mutation.AddBatchImageDiscountMultiplier(v)
  2499. return _u
  2500. }
  2501. // SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
  2502. func (_u *GroupUpdateOne) SetBatchImageHoldMultiplier(v float64) *GroupUpdateOne {
  2503. _u.mutation.ResetBatchImageHoldMultiplier()
  2504. _u.mutation.SetBatchImageHoldMultiplier(v)
  2505. return _u
  2506. }
  2507. // SetNillableBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field if the given value is not nil.
  2508. func (_u *GroupUpdateOne) SetNillableBatchImageHoldMultiplier(v *float64) *GroupUpdateOne {
  2509. if v != nil {
  2510. _u.SetBatchImageHoldMultiplier(*v)
  2511. }
  2512. return _u
  2513. }
  2514. // AddBatchImageHoldMultiplier adds value to the "batch_image_hold_multiplier" field.
  2515. func (_u *GroupUpdateOne) AddBatchImageHoldMultiplier(v float64) *GroupUpdateOne {
  2516. _u.mutation.AddBatchImageHoldMultiplier(v)
  2517. return _u
  2518. }
  2519. // SetVideoRateIndependent sets the "video_rate_independent" field.
  2520. func (_u *GroupUpdateOne) SetVideoRateIndependent(v bool) *GroupUpdateOne {
  2521. _u.mutation.SetVideoRateIndependent(v)
  2522. return _u
  2523. }
  2524. // SetNillableVideoRateIndependent sets the "video_rate_independent" field if the given value is not nil.
  2525. func (_u *GroupUpdateOne) SetNillableVideoRateIndependent(v *bool) *GroupUpdateOne {
  2526. if v != nil {
  2527. _u.SetVideoRateIndependent(*v)
  2528. }
  2529. return _u
  2530. }
  2531. // SetVideoRateMultiplier sets the "video_rate_multiplier" field.
  2532. func (_u *GroupUpdateOne) SetVideoRateMultiplier(v float64) *GroupUpdateOne {
  2533. _u.mutation.ResetVideoRateMultiplier()
  2534. _u.mutation.SetVideoRateMultiplier(v)
  2535. return _u
  2536. }
  2537. // SetNillableVideoRateMultiplier sets the "video_rate_multiplier" field if the given value is not nil.
  2538. func (_u *GroupUpdateOne) SetNillableVideoRateMultiplier(v *float64) *GroupUpdateOne {
  2539. if v != nil {
  2540. _u.SetVideoRateMultiplier(*v)
  2541. }
  2542. return _u
  2543. }
  2544. // AddVideoRateMultiplier adds value to the "video_rate_multiplier" field.
  2545. func (_u *GroupUpdateOne) AddVideoRateMultiplier(v float64) *GroupUpdateOne {
  2546. _u.mutation.AddVideoRateMultiplier(v)
  2547. return _u
  2548. }
  2549. // SetVideoPrice480p sets the "video_price_480p" field.
  2550. func (_u *GroupUpdateOne) SetVideoPrice480p(v float64) *GroupUpdateOne {
  2551. _u.mutation.ResetVideoPrice480p()
  2552. _u.mutation.SetVideoPrice480p(v)
  2553. return _u
  2554. }
  2555. // SetNillableVideoPrice480p sets the "video_price_480p" field if the given value is not nil.
  2556. func (_u *GroupUpdateOne) SetNillableVideoPrice480p(v *float64) *GroupUpdateOne {
  2557. if v != nil {
  2558. _u.SetVideoPrice480p(*v)
  2559. }
  2560. return _u
  2561. }
  2562. // AddVideoPrice480p adds value to the "video_price_480p" field.
  2563. func (_u *GroupUpdateOne) AddVideoPrice480p(v float64) *GroupUpdateOne {
  2564. _u.mutation.AddVideoPrice480p(v)
  2565. return _u
  2566. }
  2567. // ClearVideoPrice480p clears the value of the "video_price_480p" field.
  2568. func (_u *GroupUpdateOne) ClearVideoPrice480p() *GroupUpdateOne {
  2569. _u.mutation.ClearVideoPrice480p()
  2570. return _u
  2571. }
  2572. // SetVideoPrice720p sets the "video_price_720p" field.
  2573. func (_u *GroupUpdateOne) SetVideoPrice720p(v float64) *GroupUpdateOne {
  2574. _u.mutation.ResetVideoPrice720p()
  2575. _u.mutation.SetVideoPrice720p(v)
  2576. return _u
  2577. }
  2578. // SetNillableVideoPrice720p sets the "video_price_720p" field if the given value is not nil.
  2579. func (_u *GroupUpdateOne) SetNillableVideoPrice720p(v *float64) *GroupUpdateOne {
  2580. if v != nil {
  2581. _u.SetVideoPrice720p(*v)
  2582. }
  2583. return _u
  2584. }
  2585. // AddVideoPrice720p adds value to the "video_price_720p" field.
  2586. func (_u *GroupUpdateOne) AddVideoPrice720p(v float64) *GroupUpdateOne {
  2587. _u.mutation.AddVideoPrice720p(v)
  2588. return _u
  2589. }
  2590. // ClearVideoPrice720p clears the value of the "video_price_720p" field.
  2591. func (_u *GroupUpdateOne) ClearVideoPrice720p() *GroupUpdateOne {
  2592. _u.mutation.ClearVideoPrice720p()
  2593. return _u
  2594. }
  2595. // SetVideoPrice1080p sets the "video_price_1080p" field.
  2596. func (_u *GroupUpdateOne) SetVideoPrice1080p(v float64) *GroupUpdateOne {
  2597. _u.mutation.ResetVideoPrice1080p()
  2598. _u.mutation.SetVideoPrice1080p(v)
  2599. return _u
  2600. }
  2601. // SetNillableVideoPrice1080p sets the "video_price_1080p" field if the given value is not nil.
  2602. func (_u *GroupUpdateOne) SetNillableVideoPrice1080p(v *float64) *GroupUpdateOne {
  2603. if v != nil {
  2604. _u.SetVideoPrice1080p(*v)
  2605. }
  2606. return _u
  2607. }
  2608. // AddVideoPrice1080p adds value to the "video_price_1080p" field.
  2609. func (_u *GroupUpdateOne) AddVideoPrice1080p(v float64) *GroupUpdateOne {
  2610. _u.mutation.AddVideoPrice1080p(v)
  2611. return _u
  2612. }
  2613. // ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
  2614. func (_u *GroupUpdateOne) ClearVideoPrice1080p() *GroupUpdateOne {
  2615. _u.mutation.ClearVideoPrice1080p()
  2616. return _u
  2617. }
  2618. // SetVideoModelPrices sets the "video_model_prices" field.
  2619. func (_u *GroupUpdateOne) SetVideoModelPrices(v map[string]map[string]float64) *GroupUpdateOne {
  2620. _u.mutation.SetVideoModelPrices(v)
  2621. return _u
  2622. }
  2623. // ClearVideoModelPrices clears the value of the "video_model_prices" field.
  2624. func (_u *GroupUpdateOne) ClearVideoModelPrices() *GroupUpdateOne {
  2625. _u.mutation.ClearVideoModelPrices()
  2626. return _u
  2627. }
  2628. // SetWebSearchPricePerCall sets the "web_search_price_per_call" field.
  2629. func (_u *GroupUpdateOne) SetWebSearchPricePerCall(v float64) *GroupUpdateOne {
  2630. _u.mutation.ResetWebSearchPricePerCall()
  2631. _u.mutation.SetWebSearchPricePerCall(v)
  2632. return _u
  2633. }
  2634. // SetNillableWebSearchPricePerCall sets the "web_search_price_per_call" field if the given value is not nil.
  2635. func (_u *GroupUpdateOne) SetNillableWebSearchPricePerCall(v *float64) *GroupUpdateOne {
  2636. if v != nil {
  2637. _u.SetWebSearchPricePerCall(*v)
  2638. }
  2639. return _u
  2640. }
  2641. // AddWebSearchPricePerCall adds value to the "web_search_price_per_call" field.
  2642. func (_u *GroupUpdateOne) AddWebSearchPricePerCall(v float64) *GroupUpdateOne {
  2643. _u.mutation.AddWebSearchPricePerCall(v)
  2644. return _u
  2645. }
  2646. // ClearWebSearchPricePerCall clears the value of the "web_search_price_per_call" field.
  2647. func (_u *GroupUpdateOne) ClearWebSearchPricePerCall() *GroupUpdateOne {
  2648. _u.mutation.ClearWebSearchPricePerCall()
  2649. return _u
  2650. }
  2651. // SetSearchPricePer1k sets the "search_price_per_1k" field.
  2652. func (_u *GroupUpdateOne) SetSearchPricePer1k(v float64) *GroupUpdateOne {
  2653. _u.mutation.ResetSearchPricePer1k()
  2654. _u.mutation.SetSearchPricePer1k(v)
  2655. return _u
  2656. }
  2657. // SetNillableSearchPricePer1k sets the "search_price_per_1k" field if the given value is not nil.
  2658. func (_u *GroupUpdateOne) SetNillableSearchPricePer1k(v *float64) *GroupUpdateOne {
  2659. if v != nil {
  2660. _u.SetSearchPricePer1k(*v)
  2661. }
  2662. return _u
  2663. }
  2664. // AddSearchPricePer1k adds value to the "search_price_per_1k" field.
  2665. func (_u *GroupUpdateOne) AddSearchPricePer1k(v float64) *GroupUpdateOne {
  2666. _u.mutation.AddSearchPricePer1k(v)
  2667. return _u
  2668. }
  2669. // ClearSearchPricePer1k clears the value of the "search_price_per_1k" field.
  2670. func (_u *GroupUpdateOne) ClearSearchPricePer1k() *GroupUpdateOne {
  2671. _u.mutation.ClearSearchPricePer1k()
  2672. return _u
  2673. }
  2674. // SetAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field.
  2675. func (_u *GroupUpdateOne) SetAudioRealtimePricePerMin(v float64) *GroupUpdateOne {
  2676. _u.mutation.ResetAudioRealtimePricePerMin()
  2677. _u.mutation.SetAudioRealtimePricePerMin(v)
  2678. return _u
  2679. }
  2680. // SetNillableAudioRealtimePricePerMin sets the "audio_realtime_price_per_min" field if the given value is not nil.
  2681. func (_u *GroupUpdateOne) SetNillableAudioRealtimePricePerMin(v *float64) *GroupUpdateOne {
  2682. if v != nil {
  2683. _u.SetAudioRealtimePricePerMin(*v)
  2684. }
  2685. return _u
  2686. }
  2687. // AddAudioRealtimePricePerMin adds value to the "audio_realtime_price_per_min" field.
  2688. func (_u *GroupUpdateOne) AddAudioRealtimePricePerMin(v float64) *GroupUpdateOne {
  2689. _u.mutation.AddAudioRealtimePricePerMin(v)
  2690. return _u
  2691. }
  2692. // ClearAudioRealtimePricePerMin clears the value of the "audio_realtime_price_per_min" field.
  2693. func (_u *GroupUpdateOne) ClearAudioRealtimePricePerMin() *GroupUpdateOne {
  2694. _u.mutation.ClearAudioRealtimePricePerMin()
  2695. return _u
  2696. }
  2697. // SetAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field.
  2698. func (_u *GroupUpdateOne) SetAudioTtsPricePerMillionChars(v float64) *GroupUpdateOne {
  2699. _u.mutation.ResetAudioTtsPricePerMillionChars()
  2700. _u.mutation.SetAudioTtsPricePerMillionChars(v)
  2701. return _u
  2702. }
  2703. // SetNillableAudioTtsPricePerMillionChars sets the "audio_tts_price_per_million_chars" field if the given value is not nil.
  2704. func (_u *GroupUpdateOne) SetNillableAudioTtsPricePerMillionChars(v *float64) *GroupUpdateOne {
  2705. if v != nil {
  2706. _u.SetAudioTtsPricePerMillionChars(*v)
  2707. }
  2708. return _u
  2709. }
  2710. // AddAudioTtsPricePerMillionChars adds value to the "audio_tts_price_per_million_chars" field.
  2711. func (_u *GroupUpdateOne) AddAudioTtsPricePerMillionChars(v float64) *GroupUpdateOne {
  2712. _u.mutation.AddAudioTtsPricePerMillionChars(v)
  2713. return _u
  2714. }
  2715. // ClearAudioTtsPricePerMillionChars clears the value of the "audio_tts_price_per_million_chars" field.
  2716. func (_u *GroupUpdateOne) ClearAudioTtsPricePerMillionChars() *GroupUpdateOne {
  2717. _u.mutation.ClearAudioTtsPricePerMillionChars()
  2718. return _u
  2719. }
  2720. // SetAudioSttPricePerHour sets the "audio_stt_price_per_hour" field.
  2721. func (_u *GroupUpdateOne) SetAudioSttPricePerHour(v float64) *GroupUpdateOne {
  2722. _u.mutation.ResetAudioSttPricePerHour()
  2723. _u.mutation.SetAudioSttPricePerHour(v)
  2724. return _u
  2725. }
  2726. // SetNillableAudioSttPricePerHour sets the "audio_stt_price_per_hour" field if the given value is not nil.
  2727. func (_u *GroupUpdateOne) SetNillableAudioSttPricePerHour(v *float64) *GroupUpdateOne {
  2728. if v != nil {
  2729. _u.SetAudioSttPricePerHour(*v)
  2730. }
  2731. return _u
  2732. }
  2733. // AddAudioSttPricePerHour adds value to the "audio_stt_price_per_hour" field.
  2734. func (_u *GroupUpdateOne) AddAudioSttPricePerHour(v float64) *GroupUpdateOne {
  2735. _u.mutation.AddAudioSttPricePerHour(v)
  2736. return _u
  2737. }
  2738. // ClearAudioSttPricePerHour clears the value of the "audio_stt_price_per_hour" field.
  2739. func (_u *GroupUpdateOne) ClearAudioSttPricePerHour() *GroupUpdateOne {
  2740. _u.mutation.ClearAudioSttPricePerHour()
  2741. return _u
  2742. }
  2743. // SetLongContextPricingEnabled sets the "long_context_pricing_enabled" field.
  2744. func (_u *GroupUpdateOne) SetLongContextPricingEnabled(v bool) *GroupUpdateOne {
  2745. _u.mutation.SetLongContextPricingEnabled(v)
  2746. return _u
  2747. }
  2748. // SetNillableLongContextPricingEnabled sets the "long_context_pricing_enabled" field if the given value is not nil.
  2749. func (_u *GroupUpdateOne) SetNillableLongContextPricingEnabled(v *bool) *GroupUpdateOne {
  2750. if v != nil {
  2751. _u.SetLongContextPricingEnabled(*v)
  2752. }
  2753. return _u
  2754. }
  2755. // SetModelPricing sets the "model_pricing" field.
  2756. func (_u *GroupUpdateOne) SetModelPricing(v jsontext.Value) *GroupUpdateOne {
  2757. _u.mutation.SetModelPricing(v)
  2758. return _u
  2759. }
  2760. // AppendModelPricing appends value to the "model_pricing" field.
  2761. func (_u *GroupUpdateOne) AppendModelPricing(v jsontext.Value) *GroupUpdateOne {
  2762. _u.mutation.AppendModelPricing(v)
  2763. return _u
  2764. }
  2765. // ClearModelPricing clears the value of the "model_pricing" field.
  2766. func (_u *GroupUpdateOne) ClearModelPricing() *GroupUpdateOne {
  2767. _u.mutation.ClearModelPricing()
  2768. return _u
  2769. }
  2770. // SetClaudeCodeOnly sets the "claude_code_only" field.
  2771. func (_u *GroupUpdateOne) SetClaudeCodeOnly(v bool) *GroupUpdateOne {
  2772. _u.mutation.SetClaudeCodeOnly(v)
  2773. return _u
  2774. }
  2775. // SetNillableClaudeCodeOnly sets the "claude_code_only" field if the given value is not nil.
  2776. func (_u *GroupUpdateOne) SetNillableClaudeCodeOnly(v *bool) *GroupUpdateOne {
  2777. if v != nil {
  2778. _u.SetClaudeCodeOnly(*v)
  2779. }
  2780. return _u
  2781. }
  2782. // SetFallbackGroupID sets the "fallback_group_id" field.
  2783. func (_u *GroupUpdateOne) SetFallbackGroupID(v int64) *GroupUpdateOne {
  2784. _u.mutation.ResetFallbackGroupID()
  2785. _u.mutation.SetFallbackGroupID(v)
  2786. return _u
  2787. }
  2788. // SetNillableFallbackGroupID sets the "fallback_group_id" field if the given value is not nil.
  2789. func (_u *GroupUpdateOne) SetNillableFallbackGroupID(v *int64) *GroupUpdateOne {
  2790. if v != nil {
  2791. _u.SetFallbackGroupID(*v)
  2792. }
  2793. return _u
  2794. }
  2795. // AddFallbackGroupID adds value to the "fallback_group_id" field.
  2796. func (_u *GroupUpdateOne) AddFallbackGroupID(v int64) *GroupUpdateOne {
  2797. _u.mutation.AddFallbackGroupID(v)
  2798. return _u
  2799. }
  2800. // ClearFallbackGroupID clears the value of the "fallback_group_id" field.
  2801. func (_u *GroupUpdateOne) ClearFallbackGroupID() *GroupUpdateOne {
  2802. _u.mutation.ClearFallbackGroupID()
  2803. return _u
  2804. }
  2805. // SetFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field.
  2806. func (_u *GroupUpdateOne) SetFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdateOne {
  2807. _u.mutation.ResetFallbackGroupIDOnInvalidRequest()
  2808. _u.mutation.SetFallbackGroupIDOnInvalidRequest(v)
  2809. return _u
  2810. }
  2811. // SetNillableFallbackGroupIDOnInvalidRequest sets the "fallback_group_id_on_invalid_request" field if the given value is not nil.
  2812. func (_u *GroupUpdateOne) SetNillableFallbackGroupIDOnInvalidRequest(v *int64) *GroupUpdateOne {
  2813. if v != nil {
  2814. _u.SetFallbackGroupIDOnInvalidRequest(*v)
  2815. }
  2816. return _u
  2817. }
  2818. // AddFallbackGroupIDOnInvalidRequest adds value to the "fallback_group_id_on_invalid_request" field.
  2819. func (_u *GroupUpdateOne) AddFallbackGroupIDOnInvalidRequest(v int64) *GroupUpdateOne {
  2820. _u.mutation.AddFallbackGroupIDOnInvalidRequest(v)
  2821. return _u
  2822. }
  2823. // ClearFallbackGroupIDOnInvalidRequest clears the value of the "fallback_group_id_on_invalid_request" field.
  2824. func (_u *GroupUpdateOne) ClearFallbackGroupIDOnInvalidRequest() *GroupUpdateOne {
  2825. _u.mutation.ClearFallbackGroupIDOnInvalidRequest()
  2826. return _u
  2827. }
  2828. // SetModelRouting sets the "model_routing" field.
  2829. func (_u *GroupUpdateOne) SetModelRouting(v map[string][]int64) *GroupUpdateOne {
  2830. _u.mutation.SetModelRouting(v)
  2831. return _u
  2832. }
  2833. // ClearModelRouting clears the value of the "model_routing" field.
  2834. func (_u *GroupUpdateOne) ClearModelRouting() *GroupUpdateOne {
  2835. _u.mutation.ClearModelRouting()
  2836. return _u
  2837. }
  2838. // SetModelRoutingEnabled sets the "model_routing_enabled" field.
  2839. func (_u *GroupUpdateOne) SetModelRoutingEnabled(v bool) *GroupUpdateOne {
  2840. _u.mutation.SetModelRoutingEnabled(v)
  2841. return _u
  2842. }
  2843. // SetNillableModelRoutingEnabled sets the "model_routing_enabled" field if the given value is not nil.
  2844. func (_u *GroupUpdateOne) SetNillableModelRoutingEnabled(v *bool) *GroupUpdateOne {
  2845. if v != nil {
  2846. _u.SetModelRoutingEnabled(*v)
  2847. }
  2848. return _u
  2849. }
  2850. // SetMcpXMLInject sets the "mcp_xml_inject" field.
  2851. func (_u *GroupUpdateOne) SetMcpXMLInject(v bool) *GroupUpdateOne {
  2852. _u.mutation.SetMcpXMLInject(v)
  2853. return _u
  2854. }
  2855. // SetNillableMcpXMLInject sets the "mcp_xml_inject" field if the given value is not nil.
  2856. func (_u *GroupUpdateOne) SetNillableMcpXMLInject(v *bool) *GroupUpdateOne {
  2857. if v != nil {
  2858. _u.SetMcpXMLInject(*v)
  2859. }
  2860. return _u
  2861. }
  2862. // SetSupportedModelScopes sets the "supported_model_scopes" field.
  2863. func (_u *GroupUpdateOne) SetSupportedModelScopes(v []string) *GroupUpdateOne {
  2864. _u.mutation.SetSupportedModelScopes(v)
  2865. return _u
  2866. }
  2867. // AppendSupportedModelScopes appends value to the "supported_model_scopes" field.
  2868. func (_u *GroupUpdateOne) AppendSupportedModelScopes(v []string) *GroupUpdateOne {
  2869. _u.mutation.AppendSupportedModelScopes(v)
  2870. return _u
  2871. }
  2872. // SetSortOrder sets the "sort_order" field.
  2873. func (_u *GroupUpdateOne) SetSortOrder(v int) *GroupUpdateOne {
  2874. _u.mutation.ResetSortOrder()
  2875. _u.mutation.SetSortOrder(v)
  2876. return _u
  2877. }
  2878. // SetNillableSortOrder sets the "sort_order" field if the given value is not nil.
  2879. func (_u *GroupUpdateOne) SetNillableSortOrder(v *int) *GroupUpdateOne {
  2880. if v != nil {
  2881. _u.SetSortOrder(*v)
  2882. }
  2883. return _u
  2884. }
  2885. // AddSortOrder adds value to the "sort_order" field.
  2886. func (_u *GroupUpdateOne) AddSortOrder(v int) *GroupUpdateOne {
  2887. _u.mutation.AddSortOrder(v)
  2888. return _u
  2889. }
  2890. // SetAllowMessagesDispatch sets the "allow_messages_dispatch" field.
  2891. func (_u *GroupUpdateOne) SetAllowMessagesDispatch(v bool) *GroupUpdateOne {
  2892. _u.mutation.SetAllowMessagesDispatch(v)
  2893. return _u
  2894. }
  2895. // SetNillableAllowMessagesDispatch sets the "allow_messages_dispatch" field if the given value is not nil.
  2896. func (_u *GroupUpdateOne) SetNillableAllowMessagesDispatch(v *bool) *GroupUpdateOne {
  2897. if v != nil {
  2898. _u.SetAllowMessagesDispatch(*v)
  2899. }
  2900. return _u
  2901. }
  2902. // SetAllowLive sets the "allow_live" field.
  2903. func (_u *GroupUpdateOne) SetAllowLive(v bool) *GroupUpdateOne {
  2904. _u.mutation.SetAllowLive(v)
  2905. return _u
  2906. }
  2907. // SetNillableAllowLive sets the "allow_live" field if the given value is not nil.
  2908. func (_u *GroupUpdateOne) SetNillableAllowLive(v *bool) *GroupUpdateOne {
  2909. if v != nil {
  2910. _u.SetAllowLive(*v)
  2911. }
  2912. return _u
  2913. }
  2914. // SetForceOpenaiFast sets the "force_openai_fast" field.
  2915. func (_u *GroupUpdateOne) SetForceOpenaiFast(v bool) *GroupUpdateOne {
  2916. _u.mutation.SetForceOpenaiFast(v)
  2917. return _u
  2918. }
  2919. // SetNillableForceOpenaiFast sets the "force_openai_fast" field if the given value is not nil.
  2920. func (_u *GroupUpdateOne) SetNillableForceOpenaiFast(v *bool) *GroupUpdateOne {
  2921. if v != nil {
  2922. _u.SetForceOpenaiFast(*v)
  2923. }
  2924. return _u
  2925. }
  2926. // SetFreeOpenaiFast sets the "free_openai_fast" field.
  2927. func (_u *GroupUpdateOne) SetFreeOpenaiFast(v bool) *GroupUpdateOne {
  2928. _u.mutation.SetFreeOpenaiFast(v)
  2929. return _u
  2930. }
  2931. // SetNillableFreeOpenaiFast sets the "free_openai_fast" field if the given value is not nil.
  2932. func (_u *GroupUpdateOne) SetNillableFreeOpenaiFast(v *bool) *GroupUpdateOne {
  2933. if v != nil {
  2934. _u.SetFreeOpenaiFast(*v)
  2935. }
  2936. return _u
  2937. }
  2938. // SetRequireOauthOnly sets the "require_oauth_only" field.
  2939. func (_u *GroupUpdateOne) SetRequireOauthOnly(v bool) *GroupUpdateOne {
  2940. _u.mutation.SetRequireOauthOnly(v)
  2941. return _u
  2942. }
  2943. // SetNillableRequireOauthOnly sets the "require_oauth_only" field if the given value is not nil.
  2944. func (_u *GroupUpdateOne) SetNillableRequireOauthOnly(v *bool) *GroupUpdateOne {
  2945. if v != nil {
  2946. _u.SetRequireOauthOnly(*v)
  2947. }
  2948. return _u
  2949. }
  2950. // SetRequirePrivacySet sets the "require_privacy_set" field.
  2951. func (_u *GroupUpdateOne) SetRequirePrivacySet(v bool) *GroupUpdateOne {
  2952. _u.mutation.SetRequirePrivacySet(v)
  2953. return _u
  2954. }
  2955. // SetNillableRequirePrivacySet sets the "require_privacy_set" field if the given value is not nil.
  2956. func (_u *GroupUpdateOne) SetNillableRequirePrivacySet(v *bool) *GroupUpdateOne {
  2957. if v != nil {
  2958. _u.SetRequirePrivacySet(*v)
  2959. }
  2960. return _u
  2961. }
  2962. // SetDefaultMappedModel sets the "default_mapped_model" field.
  2963. func (_u *GroupUpdateOne) SetDefaultMappedModel(v string) *GroupUpdateOne {
  2964. _u.mutation.SetDefaultMappedModel(v)
  2965. return _u
  2966. }
  2967. // SetNillableDefaultMappedModel sets the "default_mapped_model" field if the given value is not nil.
  2968. func (_u *GroupUpdateOne) SetNillableDefaultMappedModel(v *string) *GroupUpdateOne {
  2969. if v != nil {
  2970. _u.SetDefaultMappedModel(*v)
  2971. }
  2972. return _u
  2973. }
  2974. // SetMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field.
  2975. func (_u *GroupUpdateOne) SetMessagesDispatchModelConfig(v domain.OpenAIMessagesDispatchModelConfig) *GroupUpdateOne {
  2976. _u.mutation.SetMessagesDispatchModelConfig(v)
  2977. return _u
  2978. }
  2979. // SetNillableMessagesDispatchModelConfig sets the "messages_dispatch_model_config" field if the given value is not nil.
  2980. func (_u *GroupUpdateOne) SetNillableMessagesDispatchModelConfig(v *domain.OpenAIMessagesDispatchModelConfig) *GroupUpdateOne {
  2981. if v != nil {
  2982. _u.SetMessagesDispatchModelConfig(*v)
  2983. }
  2984. return _u
  2985. }
  2986. // SetModelAllowlist sets the "model_allowlist" field.
  2987. func (_u *GroupUpdateOne) SetModelAllowlist(v domain.GroupModelAllowlist) *GroupUpdateOne {
  2988. _u.mutation.SetModelAllowlist(v)
  2989. return _u
  2990. }
  2991. // SetNillableModelAllowlist sets the "model_allowlist" field if the given value is not nil.
  2992. func (_u *GroupUpdateOne) SetNillableModelAllowlist(v *domain.GroupModelAllowlist) *GroupUpdateOne {
  2993. if v != nil {
  2994. _u.SetModelAllowlist(*v)
  2995. }
  2996. return _u
  2997. }
  2998. // SetCodexModelsManifestConfig sets the "codex_models_manifest_config" field.
  2999. func (_u *GroupUpdateOne) SetCodexModelsManifestConfig(v domain.GroupCodexModelsManifestConfig) *GroupUpdateOne {
  3000. _u.mutation.SetCodexModelsManifestConfig(v)
  3001. return _u
  3002. }
  3003. // SetNillableCodexModelsManifestConfig sets the "codex_models_manifest_config" field if the given value is not nil.
  3004. func (_u *GroupUpdateOne) SetNillableCodexModelsManifestConfig(v *domain.GroupCodexModelsManifestConfig) *GroupUpdateOne {
  3005. if v != nil {
  3006. _u.SetCodexModelsManifestConfig(*v)
  3007. }
  3008. return _u
  3009. }
  3010. // SetRpmLimit sets the "rpm_limit" field.
  3011. func (_u *GroupUpdateOne) SetRpmLimit(v int) *GroupUpdateOne {
  3012. _u.mutation.ResetRpmLimit()
  3013. _u.mutation.SetRpmLimit(v)
  3014. return _u
  3015. }
  3016. // SetNillableRpmLimit sets the "rpm_limit" field if the given value is not nil.
  3017. func (_u *GroupUpdateOne) SetNillableRpmLimit(v *int) *GroupUpdateOne {
  3018. if v != nil {
  3019. _u.SetRpmLimit(*v)
  3020. }
  3021. return _u
  3022. }
  3023. // AddRpmLimit adds value to the "rpm_limit" field.
  3024. func (_u *GroupUpdateOne) AddRpmLimit(v int) *GroupUpdateOne {
  3025. _u.mutation.AddRpmLimit(v)
  3026. return _u
  3027. }
  3028. // SetMaxReasoningEffort sets the "max_reasoning_effort" field.
  3029. func (_u *GroupUpdateOne) SetMaxReasoningEffort(v string) *GroupUpdateOne {
  3030. _u.mutation.SetMaxReasoningEffort(v)
  3031. return _u
  3032. }
  3033. // SetNillableMaxReasoningEffort sets the "max_reasoning_effort" field if the given value is not nil.
  3034. func (_u *GroupUpdateOne) SetNillableMaxReasoningEffort(v *string) *GroupUpdateOne {
  3035. if v != nil {
  3036. _u.SetMaxReasoningEffort(*v)
  3037. }
  3038. return _u
  3039. }
  3040. // SetMaxReasoningEffortOverLimit sets the "max_reasoning_effort_over_limit" field.
  3041. func (_u *GroupUpdateOne) SetMaxReasoningEffortOverLimit(v string) *GroupUpdateOne {
  3042. _u.mutation.SetMaxReasoningEffortOverLimit(v)
  3043. return _u
  3044. }
  3045. // SetNillableMaxReasoningEffortOverLimit sets the "max_reasoning_effort_over_limit" field if the given value is not nil.
  3046. func (_u *GroupUpdateOne) SetNillableMaxReasoningEffortOverLimit(v *string) *GroupUpdateOne {
  3047. if v != nil {
  3048. _u.SetMaxReasoningEffortOverLimit(*v)
  3049. }
  3050. return _u
  3051. }
  3052. // SetReasoningEffortMappings sets the "reasoning_effort_mappings" field.
  3053. func (_u *GroupUpdateOne) SetReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdateOne {
  3054. _u.mutation.SetReasoningEffortMappings(v)
  3055. return _u
  3056. }
  3057. // AppendReasoningEffortMappings appends value to the "reasoning_effort_mappings" field.
  3058. func (_u *GroupUpdateOne) AppendReasoningEffortMappings(v []domain.ReasoningEffortMapping) *GroupUpdateOne {
  3059. _u.mutation.AppendReasoningEffortMappings(v)
  3060. return _u
  3061. }
  3062. // SetProfitControlEnabled sets the "profit_control_enabled" field.
  3063. func (_u *GroupUpdateOne) SetProfitControlEnabled(v bool) *GroupUpdateOne {
  3064. _u.mutation.SetProfitControlEnabled(v)
  3065. return _u
  3066. }
  3067. // SetNillableProfitControlEnabled sets the "profit_control_enabled" field if the given value is not nil.
  3068. func (_u *GroupUpdateOne) SetNillableProfitControlEnabled(v *bool) *GroupUpdateOne {
  3069. if v != nil {
  3070. _u.SetProfitControlEnabled(*v)
  3071. }
  3072. return _u
  3073. }
  3074. // SetProfitMinMargin sets the "profit_min_margin" field.
  3075. func (_u *GroupUpdateOne) SetProfitMinMargin(v float64) *GroupUpdateOne {
  3076. _u.mutation.ResetProfitMinMargin()
  3077. _u.mutation.SetProfitMinMargin(v)
  3078. return _u
  3079. }
  3080. // SetNillableProfitMinMargin sets the "profit_min_margin" field if the given value is not nil.
  3081. func (_u *GroupUpdateOne) SetNillableProfitMinMargin(v *float64) *GroupUpdateOne {
  3082. if v != nil {
  3083. _u.SetProfitMinMargin(*v)
  3084. }
  3085. return _u
  3086. }
  3087. // AddProfitMinMargin adds value to the "profit_min_margin" field.
  3088. func (_u *GroupUpdateOne) AddProfitMinMargin(v float64) *GroupUpdateOne {
  3089. _u.mutation.AddProfitMinMargin(v)
  3090. return _u
  3091. }
  3092. // SetProfitSafetyBuffer sets the "profit_safety_buffer" field.
  3093. func (_u *GroupUpdateOne) SetProfitSafetyBuffer(v float64) *GroupUpdateOne {
  3094. _u.mutation.ResetProfitSafetyBuffer()
  3095. _u.mutation.SetProfitSafetyBuffer(v)
  3096. return _u
  3097. }
  3098. // SetNillableProfitSafetyBuffer sets the "profit_safety_buffer" field if the given value is not nil.
  3099. func (_u *GroupUpdateOne) SetNillableProfitSafetyBuffer(v *float64) *GroupUpdateOne {
  3100. if v != nil {
  3101. _u.SetProfitSafetyBuffer(*v)
  3102. }
  3103. return _u
  3104. }
  3105. // AddProfitSafetyBuffer adds value to the "profit_safety_buffer" field.
  3106. func (_u *GroupUpdateOne) AddProfitSafetyBuffer(v float64) *GroupUpdateOne {
  3107. _u.mutation.AddProfitSafetyBuffer(v)
  3108. return _u
  3109. }
  3110. // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.
  3111. func (_u *GroupUpdateOne) AddAPIKeyIDs(ids ...int64) *GroupUpdateOne {
  3112. _u.mutation.AddAPIKeyIDs(ids...)
  3113. return _u
  3114. }
  3115. // AddAPIKeys adds the "api_keys" edges to the APIKey entity.
  3116. func (_u *GroupUpdateOne) AddAPIKeys(v ...*APIKey) *GroupUpdateOne {
  3117. ids := make([]int64, len(v))
  3118. for i := range v {
  3119. ids[i] = v[i].ID
  3120. }
  3121. return _u.AddAPIKeyIDs(ids...)
  3122. }
  3123. // AddRedeemCodeIDs adds the "redeem_codes" edge to the RedeemCode entity by IDs.
  3124. func (_u *GroupUpdateOne) AddRedeemCodeIDs(ids ...int64) *GroupUpdateOne {
  3125. _u.mutation.AddRedeemCodeIDs(ids...)
  3126. return _u
  3127. }
  3128. // AddRedeemCodes adds the "redeem_codes" edges to the RedeemCode entity.
  3129. func (_u *GroupUpdateOne) AddRedeemCodes(v ...*RedeemCode) *GroupUpdateOne {
  3130. ids := make([]int64, len(v))
  3131. for i := range v {
  3132. ids[i] = v[i].ID
  3133. }
  3134. return _u.AddRedeemCodeIDs(ids...)
  3135. }
  3136. // AddSubscriptionIDs adds the "subscriptions" edge to the UserSubscription entity by IDs.
  3137. func (_u *GroupUpdateOne) AddSubscriptionIDs(ids ...int64) *GroupUpdateOne {
  3138. _u.mutation.AddSubscriptionIDs(ids...)
  3139. return _u
  3140. }
  3141. // AddSubscriptions adds the "subscriptions" edges to the UserSubscription entity.
  3142. func (_u *GroupUpdateOne) AddSubscriptions(v ...*UserSubscription) *GroupUpdateOne {
  3143. ids := make([]int64, len(v))
  3144. for i := range v {
  3145. ids[i] = v[i].ID
  3146. }
  3147. return _u.AddSubscriptionIDs(ids...)
  3148. }
  3149. // AddUsageLogIDs adds the "usage_logs" edge to the UsageLog entity by IDs.
  3150. func (_u *GroupUpdateOne) AddUsageLogIDs(ids ...int64) *GroupUpdateOne {
  3151. _u.mutation.AddUsageLogIDs(ids...)
  3152. return _u
  3153. }
  3154. // AddUsageLogs adds the "usage_logs" edges to the UsageLog entity.
  3155. func (_u *GroupUpdateOne) AddUsageLogs(v ...*UsageLog) *GroupUpdateOne {
  3156. ids := make([]int64, len(v))
  3157. for i := range v {
  3158. ids[i] = v[i].ID
  3159. }
  3160. return _u.AddUsageLogIDs(ids...)
  3161. }
  3162. // AddAccountIDs adds the "accounts" edge to the Account entity by IDs.
  3163. func (_u *GroupUpdateOne) AddAccountIDs(ids ...int64) *GroupUpdateOne {
  3164. _u.mutation.AddAccountIDs(ids...)
  3165. return _u
  3166. }
  3167. // AddAccounts adds the "accounts" edges to the Account entity.
  3168. func (_u *GroupUpdateOne) AddAccounts(v ...*Account) *GroupUpdateOne {
  3169. ids := make([]int64, len(v))
  3170. for i := range v {
  3171. ids[i] = v[i].ID
  3172. }
  3173. return _u.AddAccountIDs(ids...)
  3174. }
  3175. // AddAllowedUserIDs adds the "allowed_users" edge to the User entity by IDs.
  3176. func (_u *GroupUpdateOne) AddAllowedUserIDs(ids ...int64) *GroupUpdateOne {
  3177. _u.mutation.AddAllowedUserIDs(ids...)
  3178. return _u
  3179. }
  3180. // AddAllowedUsers adds the "allowed_users" edges to the User entity.
  3181. func (_u *GroupUpdateOne) AddAllowedUsers(v ...*User) *GroupUpdateOne {
  3182. ids := make([]int64, len(v))
  3183. for i := range v {
  3184. ids[i] = v[i].ID
  3185. }
  3186. return _u.AddAllowedUserIDs(ids...)
  3187. }
  3188. // Mutation returns the GroupMutation object of the builder.
  3189. func (_u *GroupUpdateOne) Mutation() *GroupMutation {
  3190. return _u.mutation
  3191. }
  3192. // ClearAPIKeys clears all "api_keys" edges to the APIKey entity.
  3193. func (_u *GroupUpdateOne) ClearAPIKeys() *GroupUpdateOne {
  3194. _u.mutation.ClearAPIKeys()
  3195. return _u
  3196. }
  3197. // RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs.
  3198. func (_u *GroupUpdateOne) RemoveAPIKeyIDs(ids ...int64) *GroupUpdateOne {
  3199. _u.mutation.RemoveAPIKeyIDs(ids...)
  3200. return _u
  3201. }
  3202. // RemoveAPIKeys removes "api_keys" edges to APIKey entities.
  3203. func (_u *GroupUpdateOne) RemoveAPIKeys(v ...*APIKey) *GroupUpdateOne {
  3204. ids := make([]int64, len(v))
  3205. for i := range v {
  3206. ids[i] = v[i].ID
  3207. }
  3208. return _u.RemoveAPIKeyIDs(ids...)
  3209. }
  3210. // ClearRedeemCodes clears all "redeem_codes" edges to the RedeemCode entity.
  3211. func (_u *GroupUpdateOne) ClearRedeemCodes() *GroupUpdateOne {
  3212. _u.mutation.ClearRedeemCodes()
  3213. return _u
  3214. }
  3215. // RemoveRedeemCodeIDs removes the "redeem_codes" edge to RedeemCode entities by IDs.
  3216. func (_u *GroupUpdateOne) RemoveRedeemCodeIDs(ids ...int64) *GroupUpdateOne {
  3217. _u.mutation.RemoveRedeemCodeIDs(ids...)
  3218. return _u
  3219. }
  3220. // RemoveRedeemCodes removes "redeem_codes" edges to RedeemCode entities.
  3221. func (_u *GroupUpdateOne) RemoveRedeemCodes(v ...*RedeemCode) *GroupUpdateOne {
  3222. ids := make([]int64, len(v))
  3223. for i := range v {
  3224. ids[i] = v[i].ID
  3225. }
  3226. return _u.RemoveRedeemCodeIDs(ids...)
  3227. }
  3228. // ClearSubscriptions clears all "subscriptions" edges to the UserSubscription entity.
  3229. func (_u *GroupUpdateOne) ClearSubscriptions() *GroupUpdateOne {
  3230. _u.mutation.ClearSubscriptions()
  3231. return _u
  3232. }
  3233. // RemoveSubscriptionIDs removes the "subscriptions" edge to UserSubscription entities by IDs.
  3234. func (_u *GroupUpdateOne) RemoveSubscriptionIDs(ids ...int64) *GroupUpdateOne {
  3235. _u.mutation.RemoveSubscriptionIDs(ids...)
  3236. return _u
  3237. }
  3238. // RemoveSubscriptions removes "subscriptions" edges to UserSubscription entities.
  3239. func (_u *GroupUpdateOne) RemoveSubscriptions(v ...*UserSubscription) *GroupUpdateOne {
  3240. ids := make([]int64, len(v))
  3241. for i := range v {
  3242. ids[i] = v[i].ID
  3243. }
  3244. return _u.RemoveSubscriptionIDs(ids...)
  3245. }
  3246. // ClearUsageLogs clears all "usage_logs" edges to the UsageLog entity.
  3247. func (_u *GroupUpdateOne) ClearUsageLogs() *GroupUpdateOne {
  3248. _u.mutation.ClearUsageLogs()
  3249. return _u
  3250. }
  3251. // RemoveUsageLogIDs removes the "usage_logs" edge to UsageLog entities by IDs.
  3252. func (_u *GroupUpdateOne) RemoveUsageLogIDs(ids ...int64) *GroupUpdateOne {
  3253. _u.mutation.RemoveUsageLogIDs(ids...)
  3254. return _u
  3255. }
  3256. // RemoveUsageLogs removes "usage_logs" edges to UsageLog entities.
  3257. func (_u *GroupUpdateOne) RemoveUsageLogs(v ...*UsageLog) *GroupUpdateOne {
  3258. ids := make([]int64, len(v))
  3259. for i := range v {
  3260. ids[i] = v[i].ID
  3261. }
  3262. return _u.RemoveUsageLogIDs(ids...)
  3263. }
  3264. // ClearAccounts clears all "accounts" edges to the Account entity.
  3265. func (_u *GroupUpdateOne) ClearAccounts() *GroupUpdateOne {
  3266. _u.mutation.ClearAccounts()
  3267. return _u
  3268. }
  3269. // RemoveAccountIDs removes the "accounts" edge to Account entities by IDs.
  3270. func (_u *GroupUpdateOne) RemoveAccountIDs(ids ...int64) *GroupUpdateOne {
  3271. _u.mutation.RemoveAccountIDs(ids...)
  3272. return _u
  3273. }
  3274. // RemoveAccounts removes "accounts" edges to Account entities.
  3275. func (_u *GroupUpdateOne) RemoveAccounts(v ...*Account) *GroupUpdateOne {
  3276. ids := make([]int64, len(v))
  3277. for i := range v {
  3278. ids[i] = v[i].ID
  3279. }
  3280. return _u.RemoveAccountIDs(ids...)
  3281. }
  3282. // ClearAllowedUsers clears all "allowed_users" edges to the User entity.
  3283. func (_u *GroupUpdateOne) ClearAllowedUsers() *GroupUpdateOne {
  3284. _u.mutation.ClearAllowedUsers()
  3285. return _u
  3286. }
  3287. // RemoveAllowedUserIDs removes the "allowed_users" edge to User entities by IDs.
  3288. func (_u *GroupUpdateOne) RemoveAllowedUserIDs(ids ...int64) *GroupUpdateOne {
  3289. _u.mutation.RemoveAllowedUserIDs(ids...)
  3290. return _u
  3291. }
  3292. // RemoveAllowedUsers removes "allowed_users" edges to User entities.
  3293. func (_u *GroupUpdateOne) RemoveAllowedUsers(v ...*User) *GroupUpdateOne {
  3294. ids := make([]int64, len(v))
  3295. for i := range v {
  3296. ids[i] = v[i].ID
  3297. }
  3298. return _u.RemoveAllowedUserIDs(ids...)
  3299. }
  3300. // Where appends a list predicates to the GroupUpdate builder.
  3301. func (_u *GroupUpdateOne) Where(ps ...predicate.Group) *GroupUpdateOne {
  3302. _u.mutation.Where(ps...)
  3303. return _u
  3304. }
  3305. // Select allows selecting one or more fields (columns) of the returned entity.
  3306. // The default is selecting all fields defined in the entity schema.
  3307. func (_u *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne {
  3308. _u.fields = append([]string{field}, fields...)
  3309. return _u
  3310. }
  3311. // Save executes the query and returns the updated Group entity.
  3312. func (_u *GroupUpdateOne) Save(ctx context.Context) (*Group, error) {
  3313. if err := _u.defaults(); err != nil {
  3314. return nil, err
  3315. }
  3316. return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
  3317. }
  3318. // SaveX is like Save, but panics if an error occurs.
  3319. func (_u *GroupUpdateOne) SaveX(ctx context.Context) *Group {
  3320. node, err := _u.Save(ctx)
  3321. if err != nil {
  3322. panic(err)
  3323. }
  3324. return node
  3325. }
  3326. // Exec executes the query on the entity.
  3327. func (_u *GroupUpdateOne) Exec(ctx context.Context) error {
  3328. _, err := _u.Save(ctx)
  3329. return err
  3330. }
  3331. // ExecX is like Exec, but panics if an error occurs.
  3332. func (_u *GroupUpdateOne) ExecX(ctx context.Context) {
  3333. if err := _u.Exec(ctx); err != nil {
  3334. panic(err)
  3335. }
  3336. }
  3337. // defaults sets the default values of the builder before save.
  3338. func (_u *GroupUpdateOne) defaults() error {
  3339. if _, ok := _u.mutation.UpdatedAt(); !ok {
  3340. if group.UpdateDefaultUpdatedAt == nil {
  3341. return fmt.Errorf("ent: uninitialized group.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
  3342. }
  3343. v := group.UpdateDefaultUpdatedAt()
  3344. _u.mutation.SetUpdatedAt(v)
  3345. }
  3346. return nil
  3347. }
  3348. // check runs all checks and user-defined validators on the builder.
  3349. func (_u *GroupUpdateOne) check() error {
  3350. if v, ok := _u.mutation.Name(); ok {
  3351. if err := group.NameValidator(v); err != nil {
  3352. return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Group.name": %w`, err)}
  3353. }
  3354. }
  3355. if v, ok := _u.mutation.PeakStart(); ok {
  3356. if err := group.PeakStartValidator(v); err != nil {
  3357. return &ValidationError{Name: "peak_start", err: fmt.Errorf(`ent: validator failed for field "Group.peak_start": %w`, err)}
  3358. }
  3359. }
  3360. if v, ok := _u.mutation.PeakEnd(); ok {
  3361. if err := group.PeakEndValidator(v); err != nil {
  3362. return &ValidationError{Name: "peak_end", err: fmt.Errorf(`ent: validator failed for field "Group.peak_end": %w`, err)}
  3363. }
  3364. }
  3365. if v, ok := _u.mutation.SecurityPolicyMode(); ok {
  3366. if err := group.SecurityPolicyModeValidator(v); err != nil {
  3367. return &ValidationError{Name: "security_policy_mode", err: fmt.Errorf(`ent: validator failed for field "Group.security_policy_mode": %w`, err)}
  3368. }
  3369. }
  3370. if v, ok := _u.mutation.Status(); ok {
  3371. if err := group.StatusValidator(v); err != nil {
  3372. return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Group.status": %w`, err)}
  3373. }
  3374. }
  3375. if v, ok := _u.mutation.Platform(); ok {
  3376. if err := group.PlatformValidator(v); err != nil {
  3377. return &ValidationError{Name: "platform", err: fmt.Errorf(`ent: validator failed for field "Group.platform": %w`, err)}
  3378. }
  3379. }
  3380. if v, ok := _u.mutation.SubscriptionType(); ok {
  3381. if err := group.SubscriptionTypeValidator(v); err != nil {
  3382. return &ValidationError{Name: "subscription_type", err: fmt.Errorf(`ent: validator failed for field "Group.subscription_type": %w`, err)}
  3383. }
  3384. }
  3385. if v, ok := _u.mutation.SearchPricePer1k(); ok {
  3386. if err := group.SearchPricePer1kValidator(v); err != nil {
  3387. return &ValidationError{Name: "search_price_per_1k", err: fmt.Errorf(`ent: validator failed for field "Group.search_price_per_1k": %w`, err)}
  3388. }
  3389. }
  3390. if v, ok := _u.mutation.AudioRealtimePricePerMin(); ok {
  3391. if err := group.AudioRealtimePricePerMinValidator(v); err != nil {
  3392. return &ValidationError{Name: "audio_realtime_price_per_min", err: fmt.Errorf(`ent: validator failed for field "Group.audio_realtime_price_per_min": %w`, err)}
  3393. }
  3394. }
  3395. if v, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok {
  3396. if err := group.AudioTtsPricePerMillionCharsValidator(v); err != nil {
  3397. 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)}
  3398. }
  3399. }
  3400. if v, ok := _u.mutation.AudioSttPricePerHour(); ok {
  3401. if err := group.AudioSttPricePerHourValidator(v); err != nil {
  3402. return &ValidationError{Name: "audio_stt_price_per_hour", err: fmt.Errorf(`ent: validator failed for field "Group.audio_stt_price_per_hour": %w`, err)}
  3403. }
  3404. }
  3405. if v, ok := _u.mutation.DefaultMappedModel(); ok {
  3406. if err := group.DefaultMappedModelValidator(v); err != nil {
  3407. return &ValidationError{Name: "default_mapped_model", err: fmt.Errorf(`ent: validator failed for field "Group.default_mapped_model": %w`, err)}
  3408. }
  3409. }
  3410. if v, ok := _u.mutation.MaxReasoningEffort(); ok {
  3411. if err := group.MaxReasoningEffortValidator(v); err != nil {
  3412. return &ValidationError{Name: "max_reasoning_effort", err: fmt.Errorf(`ent: validator failed for field "Group.max_reasoning_effort": %w`, err)}
  3413. }
  3414. }
  3415. if v, ok := _u.mutation.MaxReasoningEffortOverLimit(); ok {
  3416. if err := group.MaxReasoningEffortOverLimitValidator(v); err != nil {
  3417. return &ValidationError{Name: "max_reasoning_effort_over_limit", err: fmt.Errorf(`ent: validator failed for field "Group.max_reasoning_effort_over_limit": %w`, err)}
  3418. }
  3419. }
  3420. return nil
  3421. }
  3422. func (_u *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) {
  3423. if err := _u.check(); err != nil {
  3424. return _node, err
  3425. }
  3426. _spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeInt64))
  3427. id, ok := _u.mutation.ID()
  3428. if !ok {
  3429. return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Group.id" for update`)}
  3430. }
  3431. _spec.Node.ID.Value = id
  3432. if fields := _u.fields; len(fields) > 0 {
  3433. _spec.Node.Columns = make([]string, 0, len(fields))
  3434. _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID)
  3435. for _, f := range fields {
  3436. if !group.ValidColumn(f) {
  3437. return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
  3438. }
  3439. if f != group.FieldID {
  3440. _spec.Node.Columns = append(_spec.Node.Columns, f)
  3441. }
  3442. }
  3443. }
  3444. if ps := _u.mutation.predicates; len(ps) > 0 {
  3445. _spec.Predicate = func(selector *sql.Selector) {
  3446. for i := range ps {
  3447. ps[i](selector)
  3448. }
  3449. }
  3450. }
  3451. if value, ok := _u.mutation.UpdatedAt(); ok {
  3452. _spec.SetField(group.FieldUpdatedAt, field.TypeTime, value)
  3453. }
  3454. if value, ok := _u.mutation.DeletedAt(); ok {
  3455. _spec.SetField(group.FieldDeletedAt, field.TypeTime, value)
  3456. }
  3457. if _u.mutation.DeletedAtCleared() {
  3458. _spec.ClearField(group.FieldDeletedAt, field.TypeTime)
  3459. }
  3460. if value, ok := _u.mutation.Name(); ok {
  3461. _spec.SetField(group.FieldName, field.TypeString, value)
  3462. }
  3463. if value, ok := _u.mutation.Description(); ok {
  3464. _spec.SetField(group.FieldDescription, field.TypeString, value)
  3465. }
  3466. if _u.mutation.DescriptionCleared() {
  3467. _spec.ClearField(group.FieldDescription, field.TypeString)
  3468. }
  3469. if value, ok := _u.mutation.RateMultiplier(); ok {
  3470. _spec.SetField(group.FieldRateMultiplier, field.TypeFloat64, value)
  3471. }
  3472. if value, ok := _u.mutation.AddedRateMultiplier(); ok {
  3473. _spec.AddField(group.FieldRateMultiplier, field.TypeFloat64, value)
  3474. }
  3475. if value, ok := _u.mutation.PeakRateEnabled(); ok {
  3476. _spec.SetField(group.FieldPeakRateEnabled, field.TypeBool, value)
  3477. }
  3478. if value, ok := _u.mutation.PeakStart(); ok {
  3479. _spec.SetField(group.FieldPeakStart, field.TypeString, value)
  3480. }
  3481. if value, ok := _u.mutation.PeakEnd(); ok {
  3482. _spec.SetField(group.FieldPeakEnd, field.TypeString, value)
  3483. }
  3484. if value, ok := _u.mutation.PeakRateMultiplier(); ok {
  3485. _spec.SetField(group.FieldPeakRateMultiplier, field.TypeFloat64, value)
  3486. }
  3487. if value, ok := _u.mutation.AddedPeakRateMultiplier(); ok {
  3488. _spec.AddField(group.FieldPeakRateMultiplier, field.TypeFloat64, value)
  3489. }
  3490. if value, ok := _u.mutation.IsExclusive(); ok {
  3491. _spec.SetField(group.FieldIsExclusive, field.TypeBool, value)
  3492. }
  3493. if value, ok := _u.mutation.SecurityPolicyEnabled(); ok {
  3494. _spec.SetField(group.FieldSecurityPolicyEnabled, field.TypeBool, value)
  3495. }
  3496. if value, ok := _u.mutation.SecurityPolicyMode(); ok {
  3497. _spec.SetField(group.FieldSecurityPolicyMode, field.TypeString, value)
  3498. }
  3499. if value, ok := _u.mutation.SecurityPolicyEmailEnabled(); ok {
  3500. _spec.SetField(group.FieldSecurityPolicyEmailEnabled, field.TypeBool, value)
  3501. }
  3502. if value, ok := _u.mutation.Status(); ok {
  3503. _spec.SetField(group.FieldStatus, field.TypeString, value)
  3504. }
  3505. if _u.mutation.DuplicateOperationIDCleared() {
  3506. _spec.ClearField(group.FieldDuplicateOperationID, field.TypeString)
  3507. }
  3508. if value, ok := _u.mutation.Platform(); ok {
  3509. _spec.SetField(group.FieldPlatform, field.TypeString, value)
  3510. }
  3511. if value, ok := _u.mutation.SubscriptionType(); ok {
  3512. _spec.SetField(group.FieldSubscriptionType, field.TypeString, value)
  3513. }
  3514. if value, ok := _u.mutation.DailyLimitUsd(); ok {
  3515. _spec.SetField(group.FieldDailyLimitUsd, field.TypeFloat64, value)
  3516. }
  3517. if value, ok := _u.mutation.AddedDailyLimitUsd(); ok {
  3518. _spec.AddField(group.FieldDailyLimitUsd, field.TypeFloat64, value)
  3519. }
  3520. if _u.mutation.DailyLimitUsdCleared() {
  3521. _spec.ClearField(group.FieldDailyLimitUsd, field.TypeFloat64)
  3522. }
  3523. if value, ok := _u.mutation.WeeklyLimitUsd(); ok {
  3524. _spec.SetField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value)
  3525. }
  3526. if value, ok := _u.mutation.AddedWeeklyLimitUsd(); ok {
  3527. _spec.AddField(group.FieldWeeklyLimitUsd, field.TypeFloat64, value)
  3528. }
  3529. if _u.mutation.WeeklyLimitUsdCleared() {
  3530. _spec.ClearField(group.FieldWeeklyLimitUsd, field.TypeFloat64)
  3531. }
  3532. if value, ok := _u.mutation.MonthlyLimitUsd(); ok {
  3533. _spec.SetField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value)
  3534. }
  3535. if value, ok := _u.mutation.AddedMonthlyLimitUsd(); ok {
  3536. _spec.AddField(group.FieldMonthlyLimitUsd, field.TypeFloat64, value)
  3537. }
  3538. if _u.mutation.MonthlyLimitUsdCleared() {
  3539. _spec.ClearField(group.FieldMonthlyLimitUsd, field.TypeFloat64)
  3540. }
  3541. if value, ok := _u.mutation.DefaultValidityDays(); ok {
  3542. _spec.SetField(group.FieldDefaultValidityDays, field.TypeInt, value)
  3543. }
  3544. if value, ok := _u.mutation.AddedDefaultValidityDays(); ok {
  3545. _spec.AddField(group.FieldDefaultValidityDays, field.TypeInt, value)
  3546. }
  3547. if value, ok := _u.mutation.AllowImageGeneration(); ok {
  3548. _spec.SetField(group.FieldAllowImageGeneration, field.TypeBool, value)
  3549. }
  3550. if value, ok := _u.mutation.AllowBatchImageGeneration(); ok {
  3551. _spec.SetField(group.FieldAllowBatchImageGeneration, field.TypeBool, value)
  3552. }
  3553. if value, ok := _u.mutation.ImageRateIndependent(); ok {
  3554. _spec.SetField(group.FieldImageRateIndependent, field.TypeBool, value)
  3555. }
  3556. if value, ok := _u.mutation.ImageRateMultiplier(); ok {
  3557. _spec.SetField(group.FieldImageRateMultiplier, field.TypeFloat64, value)
  3558. }
  3559. if value, ok := _u.mutation.AddedImageRateMultiplier(); ok {
  3560. _spec.AddField(group.FieldImageRateMultiplier, field.TypeFloat64, value)
  3561. }
  3562. if value, ok := _u.mutation.ImagePrice1k(); ok {
  3563. _spec.SetField(group.FieldImagePrice1k, field.TypeFloat64, value)
  3564. }
  3565. if value, ok := _u.mutation.AddedImagePrice1k(); ok {
  3566. _spec.AddField(group.FieldImagePrice1k, field.TypeFloat64, value)
  3567. }
  3568. if _u.mutation.ImagePrice1kCleared() {
  3569. _spec.ClearField(group.FieldImagePrice1k, field.TypeFloat64)
  3570. }
  3571. if value, ok := _u.mutation.ImagePrice2k(); ok {
  3572. _spec.SetField(group.FieldImagePrice2k, field.TypeFloat64, value)
  3573. }
  3574. if value, ok := _u.mutation.AddedImagePrice2k(); ok {
  3575. _spec.AddField(group.FieldImagePrice2k, field.TypeFloat64, value)
  3576. }
  3577. if _u.mutation.ImagePrice2kCleared() {
  3578. _spec.ClearField(group.FieldImagePrice2k, field.TypeFloat64)
  3579. }
  3580. if value, ok := _u.mutation.ImagePrice4k(); ok {
  3581. _spec.SetField(group.FieldImagePrice4k, field.TypeFloat64, value)
  3582. }
  3583. if value, ok := _u.mutation.AddedImagePrice4k(); ok {
  3584. _spec.AddField(group.FieldImagePrice4k, field.TypeFloat64, value)
  3585. }
  3586. if _u.mutation.ImagePrice4kCleared() {
  3587. _spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64)
  3588. }
  3589. if value, ok := _u.mutation.BatchImageDiscountMultiplier(); ok {
  3590. _spec.SetField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
  3591. }
  3592. if value, ok := _u.mutation.AddedBatchImageDiscountMultiplier(); ok {
  3593. _spec.AddField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
  3594. }
  3595. if value, ok := _u.mutation.BatchImageHoldMultiplier(); ok {
  3596. _spec.SetField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
  3597. }
  3598. if value, ok := _u.mutation.AddedBatchImageHoldMultiplier(); ok {
  3599. _spec.AddField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
  3600. }
  3601. if value, ok := _u.mutation.VideoRateIndependent(); ok {
  3602. _spec.SetField(group.FieldVideoRateIndependent, field.TypeBool, value)
  3603. }
  3604. if value, ok := _u.mutation.VideoRateMultiplier(); ok {
  3605. _spec.SetField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
  3606. }
  3607. if value, ok := _u.mutation.AddedVideoRateMultiplier(); ok {
  3608. _spec.AddField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
  3609. }
  3610. if value, ok := _u.mutation.VideoPrice480p(); ok {
  3611. _spec.SetField(group.FieldVideoPrice480p, field.TypeFloat64, value)
  3612. }
  3613. if value, ok := _u.mutation.AddedVideoPrice480p(); ok {
  3614. _spec.AddField(group.FieldVideoPrice480p, field.TypeFloat64, value)
  3615. }
  3616. if _u.mutation.VideoPrice480pCleared() {
  3617. _spec.ClearField(group.FieldVideoPrice480p, field.TypeFloat64)
  3618. }
  3619. if value, ok := _u.mutation.VideoPrice720p(); ok {
  3620. _spec.SetField(group.FieldVideoPrice720p, field.TypeFloat64, value)
  3621. }
  3622. if value, ok := _u.mutation.AddedVideoPrice720p(); ok {
  3623. _spec.AddField(group.FieldVideoPrice720p, field.TypeFloat64, value)
  3624. }
  3625. if _u.mutation.VideoPrice720pCleared() {
  3626. _spec.ClearField(group.FieldVideoPrice720p, field.TypeFloat64)
  3627. }
  3628. if value, ok := _u.mutation.VideoPrice1080p(); ok {
  3629. _spec.SetField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
  3630. }
  3631. if value, ok := _u.mutation.AddedVideoPrice1080p(); ok {
  3632. _spec.AddField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
  3633. }
  3634. if _u.mutation.VideoPrice1080pCleared() {
  3635. _spec.ClearField(group.FieldVideoPrice1080p, field.TypeFloat64)
  3636. }
  3637. if value, ok := _u.mutation.VideoModelPrices(); ok {
  3638. _spec.SetField(group.FieldVideoModelPrices, field.TypeJSON, value)
  3639. }
  3640. if _u.mutation.VideoModelPricesCleared() {
  3641. _spec.ClearField(group.FieldVideoModelPrices, field.TypeJSON)
  3642. }
  3643. if value, ok := _u.mutation.WebSearchPricePerCall(); ok {
  3644. _spec.SetField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value)
  3645. }
  3646. if value, ok := _u.mutation.AddedWebSearchPricePerCall(); ok {
  3647. _spec.AddField(group.FieldWebSearchPricePerCall, field.TypeFloat64, value)
  3648. }
  3649. if _u.mutation.WebSearchPricePerCallCleared() {
  3650. _spec.ClearField(group.FieldWebSearchPricePerCall, field.TypeFloat64)
  3651. }
  3652. if value, ok := _u.mutation.SearchPricePer1k(); ok {
  3653. _spec.SetField(group.FieldSearchPricePer1k, field.TypeFloat64, value)
  3654. }
  3655. if value, ok := _u.mutation.AddedSearchPricePer1k(); ok {
  3656. _spec.AddField(group.FieldSearchPricePer1k, field.TypeFloat64, value)
  3657. }
  3658. if _u.mutation.SearchPricePer1kCleared() {
  3659. _spec.ClearField(group.FieldSearchPricePer1k, field.TypeFloat64)
  3660. }
  3661. if value, ok := _u.mutation.AudioRealtimePricePerMin(); ok {
  3662. _spec.SetField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value)
  3663. }
  3664. if value, ok := _u.mutation.AddedAudioRealtimePricePerMin(); ok {
  3665. _spec.AddField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64, value)
  3666. }
  3667. if _u.mutation.AudioRealtimePricePerMinCleared() {
  3668. _spec.ClearField(group.FieldAudioRealtimePricePerMin, field.TypeFloat64)
  3669. }
  3670. if value, ok := _u.mutation.AudioTtsPricePerMillionChars(); ok {
  3671. _spec.SetField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value)
  3672. }
  3673. if value, ok := _u.mutation.AddedAudioTtsPricePerMillionChars(); ok {
  3674. _spec.AddField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64, value)
  3675. }
  3676. if _u.mutation.AudioTtsPricePerMillionCharsCleared() {
  3677. _spec.ClearField(group.FieldAudioTtsPricePerMillionChars, field.TypeFloat64)
  3678. }
  3679. if value, ok := _u.mutation.AudioSttPricePerHour(); ok {
  3680. _spec.SetField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value)
  3681. }
  3682. if value, ok := _u.mutation.AddedAudioSttPricePerHour(); ok {
  3683. _spec.AddField(group.FieldAudioSttPricePerHour, field.TypeFloat64, value)
  3684. }
  3685. if _u.mutation.AudioSttPricePerHourCleared() {
  3686. _spec.ClearField(group.FieldAudioSttPricePerHour, field.TypeFloat64)
  3687. }
  3688. if value, ok := _u.mutation.LongContextPricingEnabled(); ok {
  3689. _spec.SetField(group.FieldLongContextPricingEnabled, field.TypeBool, value)
  3690. }
  3691. if value, ok := _u.mutation.ModelPricing(); ok {
  3692. _spec.SetField(group.FieldModelPricing, field.TypeJSON, value)
  3693. }
  3694. if value, ok := _u.mutation.AppendedModelPricing(); ok {
  3695. _spec.AddModifier(func(u *sql.UpdateBuilder) {
  3696. sqljson.Append(u, group.FieldModelPricing, value)
  3697. })
  3698. }
  3699. if _u.mutation.ModelPricingCleared() {
  3700. _spec.ClearField(group.FieldModelPricing, field.TypeJSON)
  3701. }
  3702. if value, ok := _u.mutation.ClaudeCodeOnly(); ok {
  3703. _spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value)
  3704. }
  3705. if value, ok := _u.mutation.FallbackGroupID(); ok {
  3706. _spec.SetField(group.FieldFallbackGroupID, field.TypeInt64, value)
  3707. }
  3708. if value, ok := _u.mutation.AddedFallbackGroupID(); ok {
  3709. _spec.AddField(group.FieldFallbackGroupID, field.TypeInt64, value)
  3710. }
  3711. if _u.mutation.FallbackGroupIDCleared() {
  3712. _spec.ClearField(group.FieldFallbackGroupID, field.TypeInt64)
  3713. }
  3714. if value, ok := _u.mutation.FallbackGroupIDOnInvalidRequest(); ok {
  3715. _spec.SetField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value)
  3716. }
  3717. if value, ok := _u.mutation.AddedFallbackGroupIDOnInvalidRequest(); ok {
  3718. _spec.AddField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64, value)
  3719. }
  3720. if _u.mutation.FallbackGroupIDOnInvalidRequestCleared() {
  3721. _spec.ClearField(group.FieldFallbackGroupIDOnInvalidRequest, field.TypeInt64)
  3722. }
  3723. if value, ok := _u.mutation.ModelRouting(); ok {
  3724. _spec.SetField(group.FieldModelRouting, field.TypeJSON, value)
  3725. }
  3726. if _u.mutation.ModelRoutingCleared() {
  3727. _spec.ClearField(group.FieldModelRouting, field.TypeJSON)
  3728. }
  3729. if value, ok := _u.mutation.ModelRoutingEnabled(); ok {
  3730. _spec.SetField(group.FieldModelRoutingEnabled, field.TypeBool, value)
  3731. }
  3732. if value, ok := _u.mutation.McpXMLInject(); ok {
  3733. _spec.SetField(group.FieldMcpXMLInject, field.TypeBool, value)
  3734. }
  3735. if value, ok := _u.mutation.SupportedModelScopes(); ok {
  3736. _spec.SetField(group.FieldSupportedModelScopes, field.TypeJSON, value)
  3737. }
  3738. if value, ok := _u.mutation.AppendedSupportedModelScopes(); ok {
  3739. _spec.AddModifier(func(u *sql.UpdateBuilder) {
  3740. sqljson.Append(u, group.FieldSupportedModelScopes, value)
  3741. })
  3742. }
  3743. if value, ok := _u.mutation.SortOrder(); ok {
  3744. _spec.SetField(group.FieldSortOrder, field.TypeInt, value)
  3745. }
  3746. if value, ok := _u.mutation.AddedSortOrder(); ok {
  3747. _spec.AddField(group.FieldSortOrder, field.TypeInt, value)
  3748. }
  3749. if value, ok := _u.mutation.AllowMessagesDispatch(); ok {
  3750. _spec.SetField(group.FieldAllowMessagesDispatch, field.TypeBool, value)
  3751. }
  3752. if value, ok := _u.mutation.AllowLive(); ok {
  3753. _spec.SetField(group.FieldAllowLive, field.TypeBool, value)
  3754. }
  3755. if value, ok := _u.mutation.ForceOpenaiFast(); ok {
  3756. _spec.SetField(group.FieldForceOpenaiFast, field.TypeBool, value)
  3757. }
  3758. if value, ok := _u.mutation.FreeOpenaiFast(); ok {
  3759. _spec.SetField(group.FieldFreeOpenaiFast, field.TypeBool, value)
  3760. }
  3761. if value, ok := _u.mutation.RequireOauthOnly(); ok {
  3762. _spec.SetField(group.FieldRequireOauthOnly, field.TypeBool, value)
  3763. }
  3764. if value, ok := _u.mutation.RequirePrivacySet(); ok {
  3765. _spec.SetField(group.FieldRequirePrivacySet, field.TypeBool, value)
  3766. }
  3767. if value, ok := _u.mutation.DefaultMappedModel(); ok {
  3768. _spec.SetField(group.FieldDefaultMappedModel, field.TypeString, value)
  3769. }
  3770. if value, ok := _u.mutation.MessagesDispatchModelConfig(); ok {
  3771. _spec.SetField(group.FieldMessagesDispatchModelConfig, field.TypeJSON, value)
  3772. }
  3773. if value, ok := _u.mutation.ModelAllowlist(); ok {
  3774. _spec.SetField(group.FieldModelAllowlist, field.TypeJSON, value)
  3775. }
  3776. if value, ok := _u.mutation.CodexModelsManifestConfig(); ok {
  3777. _spec.SetField(group.FieldCodexModelsManifestConfig, field.TypeJSON, value)
  3778. }
  3779. if value, ok := _u.mutation.RpmLimit(); ok {
  3780. _spec.SetField(group.FieldRpmLimit, field.TypeInt, value)
  3781. }
  3782. if value, ok := _u.mutation.AddedRpmLimit(); ok {
  3783. _spec.AddField(group.FieldRpmLimit, field.TypeInt, value)
  3784. }
  3785. if value, ok := _u.mutation.MaxReasoningEffort(); ok {
  3786. _spec.SetField(group.FieldMaxReasoningEffort, field.TypeString, value)
  3787. }
  3788. if value, ok := _u.mutation.MaxReasoningEffortOverLimit(); ok {
  3789. _spec.SetField(group.FieldMaxReasoningEffortOverLimit, field.TypeString, value)
  3790. }
  3791. if value, ok := _u.mutation.ReasoningEffortMappings(); ok {
  3792. _spec.SetField(group.FieldReasoningEffortMappings, field.TypeJSON, value)
  3793. }
  3794. if value, ok := _u.mutation.AppendedReasoningEffortMappings(); ok {
  3795. _spec.AddModifier(func(u *sql.UpdateBuilder) {
  3796. sqljson.Append(u, group.FieldReasoningEffortMappings, value)
  3797. })
  3798. }
  3799. if value, ok := _u.mutation.ProfitControlEnabled(); ok {
  3800. _spec.SetField(group.FieldProfitControlEnabled, field.TypeBool, value)
  3801. }
  3802. if value, ok := _u.mutation.ProfitMinMargin(); ok {
  3803. _spec.SetField(group.FieldProfitMinMargin, field.TypeFloat64, value)
  3804. }
  3805. if value, ok := _u.mutation.AddedProfitMinMargin(); ok {
  3806. _spec.AddField(group.FieldProfitMinMargin, field.TypeFloat64, value)
  3807. }
  3808. if value, ok := _u.mutation.ProfitSafetyBuffer(); ok {
  3809. _spec.SetField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value)
  3810. }
  3811. if value, ok := _u.mutation.AddedProfitSafetyBuffer(); ok {
  3812. _spec.AddField(group.FieldProfitSafetyBuffer, field.TypeFloat64, value)
  3813. }
  3814. if _u.mutation.APIKeysCleared() {
  3815. edge := &sqlgraph.EdgeSpec{
  3816. Rel: sqlgraph.O2M,
  3817. Inverse: false,
  3818. Table: group.APIKeysTable,
  3819. Columns: []string{group.APIKeysColumn},
  3820. Bidi: false,
  3821. Target: &sqlgraph.EdgeTarget{
  3822. IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64),
  3823. },
  3824. }
  3825. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3826. }
  3827. if nodes := _u.mutation.RemovedAPIKeysIDs(); len(nodes) > 0 && !_u.mutation.APIKeysCleared() {
  3828. edge := &sqlgraph.EdgeSpec{
  3829. Rel: sqlgraph.O2M,
  3830. Inverse: false,
  3831. Table: group.APIKeysTable,
  3832. Columns: []string{group.APIKeysColumn},
  3833. Bidi: false,
  3834. Target: &sqlgraph.EdgeTarget{
  3835. IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64),
  3836. },
  3837. }
  3838. for _, k := range nodes {
  3839. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3840. }
  3841. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3842. }
  3843. if nodes := _u.mutation.APIKeysIDs(); len(nodes) > 0 {
  3844. edge := &sqlgraph.EdgeSpec{
  3845. Rel: sqlgraph.O2M,
  3846. Inverse: false,
  3847. Table: group.APIKeysTable,
  3848. Columns: []string{group.APIKeysColumn},
  3849. Bidi: false,
  3850. Target: &sqlgraph.EdgeTarget{
  3851. IDSpec: sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64),
  3852. },
  3853. }
  3854. for _, k := range nodes {
  3855. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3856. }
  3857. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  3858. }
  3859. if _u.mutation.RedeemCodesCleared() {
  3860. edge := &sqlgraph.EdgeSpec{
  3861. Rel: sqlgraph.O2M,
  3862. Inverse: false,
  3863. Table: group.RedeemCodesTable,
  3864. Columns: []string{group.RedeemCodesColumn},
  3865. Bidi: false,
  3866. Target: &sqlgraph.EdgeTarget{
  3867. IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64),
  3868. },
  3869. }
  3870. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3871. }
  3872. if nodes := _u.mutation.RemovedRedeemCodesIDs(); len(nodes) > 0 && !_u.mutation.RedeemCodesCleared() {
  3873. edge := &sqlgraph.EdgeSpec{
  3874. Rel: sqlgraph.O2M,
  3875. Inverse: false,
  3876. Table: group.RedeemCodesTable,
  3877. Columns: []string{group.RedeemCodesColumn},
  3878. Bidi: false,
  3879. Target: &sqlgraph.EdgeTarget{
  3880. IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64),
  3881. },
  3882. }
  3883. for _, k := range nodes {
  3884. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3885. }
  3886. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3887. }
  3888. if nodes := _u.mutation.RedeemCodesIDs(); len(nodes) > 0 {
  3889. edge := &sqlgraph.EdgeSpec{
  3890. Rel: sqlgraph.O2M,
  3891. Inverse: false,
  3892. Table: group.RedeemCodesTable,
  3893. Columns: []string{group.RedeemCodesColumn},
  3894. Bidi: false,
  3895. Target: &sqlgraph.EdgeTarget{
  3896. IDSpec: sqlgraph.NewFieldSpec(redeemcode.FieldID, field.TypeInt64),
  3897. },
  3898. }
  3899. for _, k := range nodes {
  3900. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3901. }
  3902. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  3903. }
  3904. if _u.mutation.SubscriptionsCleared() {
  3905. edge := &sqlgraph.EdgeSpec{
  3906. Rel: sqlgraph.O2M,
  3907. Inverse: false,
  3908. Table: group.SubscriptionsTable,
  3909. Columns: []string{group.SubscriptionsColumn},
  3910. Bidi: false,
  3911. Target: &sqlgraph.EdgeTarget{
  3912. IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64),
  3913. },
  3914. }
  3915. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3916. }
  3917. if nodes := _u.mutation.RemovedSubscriptionsIDs(); len(nodes) > 0 && !_u.mutation.SubscriptionsCleared() {
  3918. edge := &sqlgraph.EdgeSpec{
  3919. Rel: sqlgraph.O2M,
  3920. Inverse: false,
  3921. Table: group.SubscriptionsTable,
  3922. Columns: []string{group.SubscriptionsColumn},
  3923. Bidi: false,
  3924. Target: &sqlgraph.EdgeTarget{
  3925. IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64),
  3926. },
  3927. }
  3928. for _, k := range nodes {
  3929. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3930. }
  3931. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3932. }
  3933. if nodes := _u.mutation.SubscriptionsIDs(); len(nodes) > 0 {
  3934. edge := &sqlgraph.EdgeSpec{
  3935. Rel: sqlgraph.O2M,
  3936. Inverse: false,
  3937. Table: group.SubscriptionsTable,
  3938. Columns: []string{group.SubscriptionsColumn},
  3939. Bidi: false,
  3940. Target: &sqlgraph.EdgeTarget{
  3941. IDSpec: sqlgraph.NewFieldSpec(usersubscription.FieldID, field.TypeInt64),
  3942. },
  3943. }
  3944. for _, k := range nodes {
  3945. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3946. }
  3947. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  3948. }
  3949. if _u.mutation.UsageLogsCleared() {
  3950. edge := &sqlgraph.EdgeSpec{
  3951. Rel: sqlgraph.O2M,
  3952. Inverse: false,
  3953. Table: group.UsageLogsTable,
  3954. Columns: []string{group.UsageLogsColumn},
  3955. Bidi: false,
  3956. Target: &sqlgraph.EdgeTarget{
  3957. IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64),
  3958. },
  3959. }
  3960. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3961. }
  3962. if nodes := _u.mutation.RemovedUsageLogsIDs(); len(nodes) > 0 && !_u.mutation.UsageLogsCleared() {
  3963. edge := &sqlgraph.EdgeSpec{
  3964. Rel: sqlgraph.O2M,
  3965. Inverse: false,
  3966. Table: group.UsageLogsTable,
  3967. Columns: []string{group.UsageLogsColumn},
  3968. Bidi: false,
  3969. Target: &sqlgraph.EdgeTarget{
  3970. IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64),
  3971. },
  3972. }
  3973. for _, k := range nodes {
  3974. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3975. }
  3976. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  3977. }
  3978. if nodes := _u.mutation.UsageLogsIDs(); len(nodes) > 0 {
  3979. edge := &sqlgraph.EdgeSpec{
  3980. Rel: sqlgraph.O2M,
  3981. Inverse: false,
  3982. Table: group.UsageLogsTable,
  3983. Columns: []string{group.UsageLogsColumn},
  3984. Bidi: false,
  3985. Target: &sqlgraph.EdgeTarget{
  3986. IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64),
  3987. },
  3988. }
  3989. for _, k := range nodes {
  3990. edge.Target.Nodes = append(edge.Target.Nodes, k)
  3991. }
  3992. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  3993. }
  3994. if _u.mutation.AccountsCleared() {
  3995. edge := &sqlgraph.EdgeSpec{
  3996. Rel: sqlgraph.M2M,
  3997. Inverse: true,
  3998. Table: group.AccountsTable,
  3999. Columns: group.AccountsPrimaryKey,
  4000. Bidi: false,
  4001. Target: &sqlgraph.EdgeTarget{
  4002. IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
  4003. },
  4004. }
  4005. createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)}
  4006. createE.defaults()
  4007. _, specE := createE.createSpec()
  4008. edge.Target.Fields = specE.Fields
  4009. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  4010. }
  4011. if nodes := _u.mutation.RemovedAccountsIDs(); len(nodes) > 0 && !_u.mutation.AccountsCleared() {
  4012. edge := &sqlgraph.EdgeSpec{
  4013. Rel: sqlgraph.M2M,
  4014. Inverse: true,
  4015. Table: group.AccountsTable,
  4016. Columns: group.AccountsPrimaryKey,
  4017. Bidi: false,
  4018. Target: &sqlgraph.EdgeTarget{
  4019. IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
  4020. },
  4021. }
  4022. for _, k := range nodes {
  4023. edge.Target.Nodes = append(edge.Target.Nodes, k)
  4024. }
  4025. createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)}
  4026. createE.defaults()
  4027. _, specE := createE.createSpec()
  4028. edge.Target.Fields = specE.Fields
  4029. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  4030. }
  4031. if nodes := _u.mutation.AccountsIDs(); len(nodes) > 0 {
  4032. edge := &sqlgraph.EdgeSpec{
  4033. Rel: sqlgraph.M2M,
  4034. Inverse: true,
  4035. Table: group.AccountsTable,
  4036. Columns: group.AccountsPrimaryKey,
  4037. Bidi: false,
  4038. Target: &sqlgraph.EdgeTarget{
  4039. IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
  4040. },
  4041. }
  4042. for _, k := range nodes {
  4043. edge.Target.Nodes = append(edge.Target.Nodes, k)
  4044. }
  4045. createE := &AccountGroupCreate{config: _u.config, mutation: newAccountGroupMutation(_u.config, OpCreate)}
  4046. createE.defaults()
  4047. _, specE := createE.createSpec()
  4048. edge.Target.Fields = specE.Fields
  4049. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  4050. }
  4051. if _u.mutation.AllowedUsersCleared() {
  4052. edge := &sqlgraph.EdgeSpec{
  4053. Rel: sqlgraph.M2M,
  4054. Inverse: true,
  4055. Table: group.AllowedUsersTable,
  4056. Columns: group.AllowedUsersPrimaryKey,
  4057. Bidi: false,
  4058. Target: &sqlgraph.EdgeTarget{
  4059. IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
  4060. },
  4061. }
  4062. createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)}
  4063. createE.defaults()
  4064. _, specE := createE.createSpec()
  4065. edge.Target.Fields = specE.Fields
  4066. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  4067. }
  4068. if nodes := _u.mutation.RemovedAllowedUsersIDs(); len(nodes) > 0 && !_u.mutation.AllowedUsersCleared() {
  4069. edge := &sqlgraph.EdgeSpec{
  4070. Rel: sqlgraph.M2M,
  4071. Inverse: true,
  4072. Table: group.AllowedUsersTable,
  4073. Columns: group.AllowedUsersPrimaryKey,
  4074. Bidi: false,
  4075. Target: &sqlgraph.EdgeTarget{
  4076. IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
  4077. },
  4078. }
  4079. for _, k := range nodes {
  4080. edge.Target.Nodes = append(edge.Target.Nodes, k)
  4081. }
  4082. createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)}
  4083. createE.defaults()
  4084. _, specE := createE.createSpec()
  4085. edge.Target.Fields = specE.Fields
  4086. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  4087. }
  4088. if nodes := _u.mutation.AllowedUsersIDs(); len(nodes) > 0 {
  4089. edge := &sqlgraph.EdgeSpec{
  4090. Rel: sqlgraph.M2M,
  4091. Inverse: true,
  4092. Table: group.AllowedUsersTable,
  4093. Columns: group.AllowedUsersPrimaryKey,
  4094. Bidi: false,
  4095. Target: &sqlgraph.EdgeTarget{
  4096. IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
  4097. },
  4098. }
  4099. for _, k := range nodes {
  4100. edge.Target.Nodes = append(edge.Target.Nodes, k)
  4101. }
  4102. createE := &UserAllowedGroupCreate{config: _u.config, mutation: newUserAllowedGroupMutation(_u.config, OpCreate)}
  4103. createE.defaults()
  4104. _, specE := createE.createSpec()
  4105. edge.Target.Fields = specE.Fields
  4106. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  4107. }
  4108. _node = &Group{config: _u.config}
  4109. _spec.Assign = _node.assignValues
  4110. _spec.ScanValues = _node.scanValues
  4111. if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
  4112. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  4113. err = &NotFoundError{group.Label}
  4114. } else if sqlgraph.IsConstraintError(err) {
  4115. err = &ConstraintError{msg: err.Error(), wrap: err}
  4116. }
  4117. return nil, err
  4118. }
  4119. _u.mutation.done = true
  4120. return _node, nil
  4121. }