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