| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "log"
- "reflect"
- "github.com/Wei-Shaw/sub2api/ent/migrate"
- "entgo.io/ent"
- "entgo.io/ent/dialect"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "github.com/Wei-Shaw/sub2api/ent/account"
- "github.com/Wei-Shaw/sub2api/ent/accountgroup"
- "github.com/Wei-Shaw/sub2api/ent/announcement"
- "github.com/Wei-Shaw/sub2api/ent/announcementread"
- "github.com/Wei-Shaw/sub2api/ent/apikey"
- "github.com/Wei-Shaw/sub2api/ent/authidentity"
- "github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
- "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
- "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
- "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
- "github.com/Wei-Shaw/sub2api/ent/channelmonitor"
- "github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
- "github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
- "github.com/Wei-Shaw/sub2api/ent/channelmonitorrequesttemplate"
- "github.com/Wei-Shaw/sub2api/ent/compositemodelroute"
- "github.com/Wei-Shaw/sub2api/ent/errorpassthroughrule"
- "github.com/Wei-Shaw/sub2api/ent/group"
- "github.com/Wei-Shaw/sub2api/ent/idempotencyrecord"
- "github.com/Wei-Shaw/sub2api/ent/identityadoptiondecision"
- "github.com/Wei-Shaw/sub2api/ent/paymentauditlog"
- "github.com/Wei-Shaw/sub2api/ent/paymentorder"
- "github.com/Wei-Shaw/sub2api/ent/paymentproviderinstance"
- "github.com/Wei-Shaw/sub2api/ent/pendingauthsession"
- "github.com/Wei-Shaw/sub2api/ent/promocode"
- "github.com/Wei-Shaw/sub2api/ent/promocodeusage"
- "github.com/Wei-Shaw/sub2api/ent/proxy"
- "github.com/Wei-Shaw/sub2api/ent/redeemcode"
- "github.com/Wei-Shaw/sub2api/ent/securitypolicykeyword"
- "github.com/Wei-Shaw/sub2api/ent/securitysecret"
- "github.com/Wei-Shaw/sub2api/ent/setting"
- "github.com/Wei-Shaw/sub2api/ent/subscriptionplan"
- "github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
- "github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
- "github.com/Wei-Shaw/sub2api/ent/usagelog"
- "github.com/Wei-Shaw/sub2api/ent/user"
- "github.com/Wei-Shaw/sub2api/ent/userallowedgroup"
- "github.com/Wei-Shaw/sub2api/ent/userattributedefinition"
- "github.com/Wei-Shaw/sub2api/ent/userattributevalue"
- "github.com/Wei-Shaw/sub2api/ent/userplatformquota"
- "github.com/Wei-Shaw/sub2api/ent/usersubscription"
- stdsql "database/sql"
- )
- // Client is the client that holds all ent builders.
- type Client struct {
- config
- // Schema is the client for creating, migrating and dropping schema.
- Schema *migrate.Schema
- // APIKey is the client for interacting with the APIKey builders.
- APIKey *APIKeyClient
- // Account is the client for interacting with the Account builders.
- Account *AccountClient
- // AccountGroup is the client for interacting with the AccountGroup builders.
- AccountGroup *AccountGroupClient
- // Announcement is the client for interacting with the Announcement builders.
- Announcement *AnnouncementClient
- // AnnouncementRead is the client for interacting with the AnnouncementRead builders.
- AnnouncementRead *AnnouncementReadClient
- // AuthIdentity is the client for interacting with the AuthIdentity builders.
- AuthIdentity *AuthIdentityClient
- // AuthIdentityChannel is the client for interacting with the AuthIdentityChannel builders.
- AuthIdentityChannel *AuthIdentityChannelClient
- // BatchImageEvent is the client for interacting with the BatchImageEvent builders.
- BatchImageEvent *BatchImageEventClient
- // BatchImageItem is the client for interacting with the BatchImageItem builders.
- BatchImageItem *BatchImageItemClient
- // BatchImageJob is the client for interacting with the BatchImageJob builders.
- BatchImageJob *BatchImageJobClient
- // ChannelMonitor is the client for interacting with the ChannelMonitor builders.
- ChannelMonitor *ChannelMonitorClient
- // ChannelMonitorDailyRollup is the client for interacting with the ChannelMonitorDailyRollup builders.
- ChannelMonitorDailyRollup *ChannelMonitorDailyRollupClient
- // ChannelMonitorHistory is the client for interacting with the ChannelMonitorHistory builders.
- ChannelMonitorHistory *ChannelMonitorHistoryClient
- // ChannelMonitorRequestTemplate is the client for interacting with the ChannelMonitorRequestTemplate builders.
- ChannelMonitorRequestTemplate *ChannelMonitorRequestTemplateClient
- // CompositeModelRoute is the client for interacting with the CompositeModelRoute builders.
- CompositeModelRoute *CompositeModelRouteClient
- // ErrorPassthroughRule is the client for interacting with the ErrorPassthroughRule builders.
- ErrorPassthroughRule *ErrorPassthroughRuleClient
- // Group is the client for interacting with the Group builders.
- Group *GroupClient
- // IdempotencyRecord is the client for interacting with the IdempotencyRecord builders.
- IdempotencyRecord *IdempotencyRecordClient
- // IdentityAdoptionDecision is the client for interacting with the IdentityAdoptionDecision builders.
- IdentityAdoptionDecision *IdentityAdoptionDecisionClient
- // PaymentAuditLog is the client for interacting with the PaymentAuditLog builders.
- PaymentAuditLog *PaymentAuditLogClient
- // PaymentOrder is the client for interacting with the PaymentOrder builders.
- PaymentOrder *PaymentOrderClient
- // PaymentProviderInstance is the client for interacting with the PaymentProviderInstance builders.
- PaymentProviderInstance *PaymentProviderInstanceClient
- // PendingAuthSession is the client for interacting with the PendingAuthSession builders.
- PendingAuthSession *PendingAuthSessionClient
- // PromoCode is the client for interacting with the PromoCode builders.
- PromoCode *PromoCodeClient
- // PromoCodeUsage is the client for interacting with the PromoCodeUsage builders.
- PromoCodeUsage *PromoCodeUsageClient
- // Proxy is the client for interacting with the Proxy builders.
- Proxy *ProxyClient
- // RedeemCode is the client for interacting with the RedeemCode builders.
- RedeemCode *RedeemCodeClient
- // SecurityPolicyKeyword is the client for interacting with the SecurityPolicyKeyword builders.
- SecurityPolicyKeyword *SecurityPolicyKeywordClient
- // SecuritySecret is the client for interacting with the SecuritySecret builders.
- SecuritySecret *SecuritySecretClient
- // Setting is the client for interacting with the Setting builders.
- Setting *SettingClient
- // SubscriptionPlan is the client for interacting with the SubscriptionPlan builders.
- SubscriptionPlan *SubscriptionPlanClient
- // TLSFingerprintProfile is the client for interacting with the TLSFingerprintProfile builders.
- TLSFingerprintProfile *TLSFingerprintProfileClient
- // UsageCleanupTask is the client for interacting with the UsageCleanupTask builders.
- UsageCleanupTask *UsageCleanupTaskClient
- // UsageLog is the client for interacting with the UsageLog builders.
- UsageLog *UsageLogClient
- // User is the client for interacting with the User builders.
- User *UserClient
- // UserAllowedGroup is the client for interacting with the UserAllowedGroup builders.
- UserAllowedGroup *UserAllowedGroupClient
- // UserAttributeDefinition is the client for interacting with the UserAttributeDefinition builders.
- UserAttributeDefinition *UserAttributeDefinitionClient
- // UserAttributeValue is the client for interacting with the UserAttributeValue builders.
- UserAttributeValue *UserAttributeValueClient
- // UserPlatformQuota is the client for interacting with the UserPlatformQuota builders.
- UserPlatformQuota *UserPlatformQuotaClient
- // UserSubscription is the client for interacting with the UserSubscription builders.
- UserSubscription *UserSubscriptionClient
- }
- // NewClient creates a new client configured with the given options.
- func NewClient(opts ...Option) *Client {
- client := &Client{config: newConfig(opts...)}
- client.init()
- return client
- }
- func (c *Client) init() {
- c.Schema = migrate.NewSchema(c.driver)
- c.APIKey = NewAPIKeyClient(c.config)
- c.Account = NewAccountClient(c.config)
- c.AccountGroup = NewAccountGroupClient(c.config)
- c.Announcement = NewAnnouncementClient(c.config)
- c.AnnouncementRead = NewAnnouncementReadClient(c.config)
- c.AuthIdentity = NewAuthIdentityClient(c.config)
- c.AuthIdentityChannel = NewAuthIdentityChannelClient(c.config)
- c.BatchImageEvent = NewBatchImageEventClient(c.config)
- c.BatchImageItem = NewBatchImageItemClient(c.config)
- c.BatchImageJob = NewBatchImageJobClient(c.config)
- c.ChannelMonitor = NewChannelMonitorClient(c.config)
- c.ChannelMonitorDailyRollup = NewChannelMonitorDailyRollupClient(c.config)
- c.ChannelMonitorHistory = NewChannelMonitorHistoryClient(c.config)
- c.ChannelMonitorRequestTemplate = NewChannelMonitorRequestTemplateClient(c.config)
- c.CompositeModelRoute = NewCompositeModelRouteClient(c.config)
- c.ErrorPassthroughRule = NewErrorPassthroughRuleClient(c.config)
- c.Group = NewGroupClient(c.config)
- c.IdempotencyRecord = NewIdempotencyRecordClient(c.config)
- c.IdentityAdoptionDecision = NewIdentityAdoptionDecisionClient(c.config)
- c.PaymentAuditLog = NewPaymentAuditLogClient(c.config)
- c.PaymentOrder = NewPaymentOrderClient(c.config)
- c.PaymentProviderInstance = NewPaymentProviderInstanceClient(c.config)
- c.PendingAuthSession = NewPendingAuthSessionClient(c.config)
- c.PromoCode = NewPromoCodeClient(c.config)
- c.PromoCodeUsage = NewPromoCodeUsageClient(c.config)
- c.Proxy = NewProxyClient(c.config)
- c.RedeemCode = NewRedeemCodeClient(c.config)
- c.SecurityPolicyKeyword = NewSecurityPolicyKeywordClient(c.config)
- c.SecuritySecret = NewSecuritySecretClient(c.config)
- c.Setting = NewSettingClient(c.config)
- c.SubscriptionPlan = NewSubscriptionPlanClient(c.config)
- c.TLSFingerprintProfile = NewTLSFingerprintProfileClient(c.config)
- c.UsageCleanupTask = NewUsageCleanupTaskClient(c.config)
- c.UsageLog = NewUsageLogClient(c.config)
- c.User = NewUserClient(c.config)
- c.UserAllowedGroup = NewUserAllowedGroupClient(c.config)
- c.UserAttributeDefinition = NewUserAttributeDefinitionClient(c.config)
- c.UserAttributeValue = NewUserAttributeValueClient(c.config)
- c.UserPlatformQuota = NewUserPlatformQuotaClient(c.config)
- c.UserSubscription = NewUserSubscriptionClient(c.config)
- }
- type (
- // config is the configuration for the client and its builder.
- config struct {
- // driver used for executing database requests.
- driver dialect.Driver
- // debug enable a debug logging.
- debug bool
- // log used for logging on debug mode.
- log func(...any)
- // hooks to execute on mutations.
- hooks *hooks
- // interceptors to execute on queries.
- inters *inters
- }
- // Option function to configure the client.
- Option func(*config)
- )
- // newConfig creates a new config for the client.
- func newConfig(opts ...Option) config {
- cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
- cfg.options(opts...)
- return cfg
- }
- // options applies the options on the config object.
- func (c *config) options(opts ...Option) {
- for _, opt := range opts {
- opt(c)
- }
- if c.debug {
- c.driver = dialect.Debug(c.driver, c.log)
- }
- }
- // Debug enables debug logging on the ent.Driver.
- func Debug() Option {
- return func(c *config) {
- c.debug = true
- }
- }
- // Log sets the logging function for debug mode.
- func Log(fn func(...any)) Option {
- return func(c *config) {
- c.log = fn
- }
- }
- // Driver configures the client driver.
- func Driver(driver dialect.Driver) Option {
- return func(c *config) {
- c.driver = driver
- }
- }
- // Open opens a database/sql.DB specified by the driver name and
- // the data source name, and returns a new client attached to it.
- // Optional parameters can be added for configuring the client.
- func Open(driverName, dataSourceName string, options ...Option) (*Client, error) {
- switch driverName {
- case dialect.MySQL, dialect.Postgres, dialect.SQLite:
- drv, err := sql.Open(driverName, dataSourceName)
- if err != nil {
- return nil, err
- }
- return NewClient(append(options, Driver(drv))...), nil
- default:
- return nil, fmt.Errorf("unsupported driver: %q", driverName)
- }
- }
- // ErrTxStarted is returned when trying to start a new transaction from a transactional client.
- var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")
- // Tx returns a new transactional client. The provided context
- // is used until the transaction is committed or rolled back.
- func (c *Client) Tx(ctx context.Context) (*Tx, error) {
- if _, ok := c.driver.(*txDriver); ok {
- return nil, ErrTxStarted
- }
- tx, err := newTx(ctx, c.driver)
- if err != nil {
- return nil, fmt.Errorf("ent: starting a transaction: %w", err)
- }
- cfg := c.config
- cfg.driver = tx
- return &Tx{
- ctx: ctx,
- config: cfg,
- APIKey: NewAPIKeyClient(cfg),
- Account: NewAccountClient(cfg),
- AccountGroup: NewAccountGroupClient(cfg),
- Announcement: NewAnnouncementClient(cfg),
- AnnouncementRead: NewAnnouncementReadClient(cfg),
- AuthIdentity: NewAuthIdentityClient(cfg),
- AuthIdentityChannel: NewAuthIdentityChannelClient(cfg),
- BatchImageEvent: NewBatchImageEventClient(cfg),
- BatchImageItem: NewBatchImageItemClient(cfg),
- BatchImageJob: NewBatchImageJobClient(cfg),
- ChannelMonitor: NewChannelMonitorClient(cfg),
- ChannelMonitorDailyRollup: NewChannelMonitorDailyRollupClient(cfg),
- ChannelMonitorHistory: NewChannelMonitorHistoryClient(cfg),
- ChannelMonitorRequestTemplate: NewChannelMonitorRequestTemplateClient(cfg),
- CompositeModelRoute: NewCompositeModelRouteClient(cfg),
- ErrorPassthroughRule: NewErrorPassthroughRuleClient(cfg),
- Group: NewGroupClient(cfg),
- IdempotencyRecord: NewIdempotencyRecordClient(cfg),
- IdentityAdoptionDecision: NewIdentityAdoptionDecisionClient(cfg),
- PaymentAuditLog: NewPaymentAuditLogClient(cfg),
- PaymentOrder: NewPaymentOrderClient(cfg),
- PaymentProviderInstance: NewPaymentProviderInstanceClient(cfg),
- PendingAuthSession: NewPendingAuthSessionClient(cfg),
- PromoCode: NewPromoCodeClient(cfg),
- PromoCodeUsage: NewPromoCodeUsageClient(cfg),
- Proxy: NewProxyClient(cfg),
- RedeemCode: NewRedeemCodeClient(cfg),
- SecurityPolicyKeyword: NewSecurityPolicyKeywordClient(cfg),
- SecuritySecret: NewSecuritySecretClient(cfg),
- Setting: NewSettingClient(cfg),
- SubscriptionPlan: NewSubscriptionPlanClient(cfg),
- TLSFingerprintProfile: NewTLSFingerprintProfileClient(cfg),
- UsageCleanupTask: NewUsageCleanupTaskClient(cfg),
- UsageLog: NewUsageLogClient(cfg),
- User: NewUserClient(cfg),
- UserAllowedGroup: NewUserAllowedGroupClient(cfg),
- UserAttributeDefinition: NewUserAttributeDefinitionClient(cfg),
- UserAttributeValue: NewUserAttributeValueClient(cfg),
- UserPlatformQuota: NewUserPlatformQuotaClient(cfg),
- UserSubscription: NewUserSubscriptionClient(cfg),
- }, nil
- }
- // BeginTx returns a transactional client with specified options.
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
- if _, ok := c.driver.(*txDriver); ok {
- return nil, errors.New("ent: cannot start a transaction within a transaction")
- }
- tx, err := c.driver.(interface {
- BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
- }).BeginTx(ctx, opts)
- if err != nil {
- return nil, fmt.Errorf("ent: starting a transaction: %w", err)
- }
- cfg := c.config
- cfg.driver = &txDriver{tx: tx, drv: c.driver}
- return &Tx{
- ctx: ctx,
- config: cfg,
- APIKey: NewAPIKeyClient(cfg),
- Account: NewAccountClient(cfg),
- AccountGroup: NewAccountGroupClient(cfg),
- Announcement: NewAnnouncementClient(cfg),
- AnnouncementRead: NewAnnouncementReadClient(cfg),
- AuthIdentity: NewAuthIdentityClient(cfg),
- AuthIdentityChannel: NewAuthIdentityChannelClient(cfg),
- BatchImageEvent: NewBatchImageEventClient(cfg),
- BatchImageItem: NewBatchImageItemClient(cfg),
- BatchImageJob: NewBatchImageJobClient(cfg),
- ChannelMonitor: NewChannelMonitorClient(cfg),
- ChannelMonitorDailyRollup: NewChannelMonitorDailyRollupClient(cfg),
- ChannelMonitorHistory: NewChannelMonitorHistoryClient(cfg),
- ChannelMonitorRequestTemplate: NewChannelMonitorRequestTemplateClient(cfg),
- CompositeModelRoute: NewCompositeModelRouteClient(cfg),
- ErrorPassthroughRule: NewErrorPassthroughRuleClient(cfg),
- Group: NewGroupClient(cfg),
- IdempotencyRecord: NewIdempotencyRecordClient(cfg),
- IdentityAdoptionDecision: NewIdentityAdoptionDecisionClient(cfg),
- PaymentAuditLog: NewPaymentAuditLogClient(cfg),
- PaymentOrder: NewPaymentOrderClient(cfg),
- PaymentProviderInstance: NewPaymentProviderInstanceClient(cfg),
- PendingAuthSession: NewPendingAuthSessionClient(cfg),
- PromoCode: NewPromoCodeClient(cfg),
- PromoCodeUsage: NewPromoCodeUsageClient(cfg),
- Proxy: NewProxyClient(cfg),
- RedeemCode: NewRedeemCodeClient(cfg),
- SecurityPolicyKeyword: NewSecurityPolicyKeywordClient(cfg),
- SecuritySecret: NewSecuritySecretClient(cfg),
- Setting: NewSettingClient(cfg),
- SubscriptionPlan: NewSubscriptionPlanClient(cfg),
- TLSFingerprintProfile: NewTLSFingerprintProfileClient(cfg),
- UsageCleanupTask: NewUsageCleanupTaskClient(cfg),
- UsageLog: NewUsageLogClient(cfg),
- User: NewUserClient(cfg),
- UserAllowedGroup: NewUserAllowedGroupClient(cfg),
- UserAttributeDefinition: NewUserAttributeDefinitionClient(cfg),
- UserAttributeValue: NewUserAttributeValueClient(cfg),
- UserPlatformQuota: NewUserPlatformQuotaClient(cfg),
- UserSubscription: NewUserSubscriptionClient(cfg),
- }, nil
- }
- // Debug returns a new debug-client. It's used to get verbose logging on specific operations.
- //
- // client.Debug().
- // APIKey.
- // Query().
- // Count(ctx)
- func (c *Client) Debug() *Client {
- if c.debug {
- return c
- }
- cfg := c.config
- cfg.driver = dialect.Debug(c.driver, c.log)
- client := &Client{config: cfg}
- client.init()
- return client
- }
- // Close closes the database connection and prevents new queries from starting.
- func (c *Client) Close() error {
- return c.driver.Close()
- }
- // Use adds the mutation hooks to all the entity clients.
- // In order to add hooks to a specific client, call: `client.Node.Use(...)`.
- func (c *Client) Use(hooks ...Hook) {
- for _, n := range []interface{ Use(...Hook) }{
- c.APIKey, c.Account, c.AccountGroup, c.Announcement, c.AnnouncementRead,
- c.AuthIdentity, c.AuthIdentityChannel, c.BatchImageEvent, c.BatchImageItem,
- c.BatchImageJob, c.ChannelMonitor, c.ChannelMonitorDailyRollup,
- c.ChannelMonitorHistory, c.ChannelMonitorRequestTemplate,
- c.CompositeModelRoute, c.ErrorPassthroughRule, c.Group, c.IdempotencyRecord,
- c.IdentityAdoptionDecision, c.PaymentAuditLog, c.PaymentOrder,
- c.PaymentProviderInstance, c.PendingAuthSession, c.PromoCode, c.PromoCodeUsage,
- c.Proxy, c.RedeemCode, c.SecurityPolicyKeyword, c.SecuritySecret, c.Setting,
- c.SubscriptionPlan, c.TLSFingerprintProfile, c.UsageCleanupTask, c.UsageLog,
- c.User, c.UserAllowedGroup, c.UserAttributeDefinition, c.UserAttributeValue,
- c.UserPlatformQuota, c.UserSubscription,
- } {
- n.Use(hooks...)
- }
- }
- // Intercept adds the query interceptors to all the entity clients.
- // In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
- func (c *Client) Intercept(interceptors ...Interceptor) {
- for _, n := range []interface{ Intercept(...Interceptor) }{
- c.APIKey, c.Account, c.AccountGroup, c.Announcement, c.AnnouncementRead,
- c.AuthIdentity, c.AuthIdentityChannel, c.BatchImageEvent, c.BatchImageItem,
- c.BatchImageJob, c.ChannelMonitor, c.ChannelMonitorDailyRollup,
- c.ChannelMonitorHistory, c.ChannelMonitorRequestTemplate,
- c.CompositeModelRoute, c.ErrorPassthroughRule, c.Group, c.IdempotencyRecord,
- c.IdentityAdoptionDecision, c.PaymentAuditLog, c.PaymentOrder,
- c.PaymentProviderInstance, c.PendingAuthSession, c.PromoCode, c.PromoCodeUsage,
- c.Proxy, c.RedeemCode, c.SecurityPolicyKeyword, c.SecuritySecret, c.Setting,
- c.SubscriptionPlan, c.TLSFingerprintProfile, c.UsageCleanupTask, c.UsageLog,
- c.User, c.UserAllowedGroup, c.UserAttributeDefinition, c.UserAttributeValue,
- c.UserPlatformQuota, c.UserSubscription,
- } {
- n.Intercept(interceptors...)
- }
- }
- // Mutate implements the ent.Mutator interface.
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
- switch m := m.(type) {
- case *APIKeyMutation:
- return c.APIKey.mutate(ctx, m)
- case *AccountMutation:
- return c.Account.mutate(ctx, m)
- case *AccountGroupMutation:
- return c.AccountGroup.mutate(ctx, m)
- case *AnnouncementMutation:
- return c.Announcement.mutate(ctx, m)
- case *AnnouncementReadMutation:
- return c.AnnouncementRead.mutate(ctx, m)
- case *AuthIdentityMutation:
- return c.AuthIdentity.mutate(ctx, m)
- case *AuthIdentityChannelMutation:
- return c.AuthIdentityChannel.mutate(ctx, m)
- case *BatchImageEventMutation:
- return c.BatchImageEvent.mutate(ctx, m)
- case *BatchImageItemMutation:
- return c.BatchImageItem.mutate(ctx, m)
- case *BatchImageJobMutation:
- return c.BatchImageJob.mutate(ctx, m)
- case *ChannelMonitorMutation:
- return c.ChannelMonitor.mutate(ctx, m)
- case *ChannelMonitorDailyRollupMutation:
- return c.ChannelMonitorDailyRollup.mutate(ctx, m)
- case *ChannelMonitorHistoryMutation:
- return c.ChannelMonitorHistory.mutate(ctx, m)
- case *ChannelMonitorRequestTemplateMutation:
- return c.ChannelMonitorRequestTemplate.mutate(ctx, m)
- case *CompositeModelRouteMutation:
- return c.CompositeModelRoute.mutate(ctx, m)
- case *ErrorPassthroughRuleMutation:
- return c.ErrorPassthroughRule.mutate(ctx, m)
- case *GroupMutation:
- return c.Group.mutate(ctx, m)
- case *IdempotencyRecordMutation:
- return c.IdempotencyRecord.mutate(ctx, m)
- case *IdentityAdoptionDecisionMutation:
- return c.IdentityAdoptionDecision.mutate(ctx, m)
- case *PaymentAuditLogMutation:
- return c.PaymentAuditLog.mutate(ctx, m)
- case *PaymentOrderMutation:
- return c.PaymentOrder.mutate(ctx, m)
- case *PaymentProviderInstanceMutation:
- return c.PaymentProviderInstance.mutate(ctx, m)
- case *PendingAuthSessionMutation:
- return c.PendingAuthSession.mutate(ctx, m)
- case *PromoCodeMutation:
- return c.PromoCode.mutate(ctx, m)
- case *PromoCodeUsageMutation:
- return c.PromoCodeUsage.mutate(ctx, m)
- case *ProxyMutation:
- return c.Proxy.mutate(ctx, m)
- case *RedeemCodeMutation:
- return c.RedeemCode.mutate(ctx, m)
- case *SecurityPolicyKeywordMutation:
- return c.SecurityPolicyKeyword.mutate(ctx, m)
- case *SecuritySecretMutation:
- return c.SecuritySecret.mutate(ctx, m)
- case *SettingMutation:
- return c.Setting.mutate(ctx, m)
- case *SubscriptionPlanMutation:
- return c.SubscriptionPlan.mutate(ctx, m)
- case *TLSFingerprintProfileMutation:
- return c.TLSFingerprintProfile.mutate(ctx, m)
- case *UsageCleanupTaskMutation:
- return c.UsageCleanupTask.mutate(ctx, m)
- case *UsageLogMutation:
- return c.UsageLog.mutate(ctx, m)
- case *UserMutation:
- return c.User.mutate(ctx, m)
- case *UserAllowedGroupMutation:
- return c.UserAllowedGroup.mutate(ctx, m)
- case *UserAttributeDefinitionMutation:
- return c.UserAttributeDefinition.mutate(ctx, m)
- case *UserAttributeValueMutation:
- return c.UserAttributeValue.mutate(ctx, m)
- case *UserPlatformQuotaMutation:
- return c.UserPlatformQuota.mutate(ctx, m)
- case *UserSubscriptionMutation:
- return c.UserSubscription.mutate(ctx, m)
- default:
- return nil, fmt.Errorf("ent: unknown mutation type %T", m)
- }
- }
- // APIKeyClient is a client for the APIKey schema.
- type APIKeyClient struct {
- config
- }
- // NewAPIKeyClient returns a client for the APIKey from the given config.
- func NewAPIKeyClient(c config) *APIKeyClient {
- return &APIKeyClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `apikey.Hooks(f(g(h())))`.
- func (c *APIKeyClient) Use(hooks ...Hook) {
- c.hooks.APIKey = append(c.hooks.APIKey, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `apikey.Intercept(f(g(h())))`.
- func (c *APIKeyClient) Intercept(interceptors ...Interceptor) {
- c.inters.APIKey = append(c.inters.APIKey, interceptors...)
- }
- // Create returns a builder for creating a APIKey entity.
- func (c *APIKeyClient) Create() *APIKeyCreate {
- mutation := newAPIKeyMutation(c.config, OpCreate)
- return &APIKeyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of APIKey entities.
- func (c *APIKeyClient) CreateBulk(builders ...*APIKeyCreate) *APIKeyCreateBulk {
- return &APIKeyCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *APIKeyClient) MapCreateBulk(slice any, setFunc func(*APIKeyCreate, int)) *APIKeyCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &APIKeyCreateBulk{err: fmt.Errorf("calling to APIKeyClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*APIKeyCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &APIKeyCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for APIKey.
- func (c *APIKeyClient) Update() *APIKeyUpdate {
- mutation := newAPIKeyMutation(c.config, OpUpdate)
- return &APIKeyUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *APIKeyClient) UpdateOne(_m *APIKey) *APIKeyUpdateOne {
- mutation := newAPIKeyMutation(c.config, OpUpdateOne, withAPIKey(_m))
- return &APIKeyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *APIKeyClient) UpdateOneID(id int64) *APIKeyUpdateOne {
- mutation := newAPIKeyMutation(c.config, OpUpdateOne, withAPIKeyID(id))
- return &APIKeyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for APIKey.
- func (c *APIKeyClient) Delete() *APIKeyDelete {
- mutation := newAPIKeyMutation(c.config, OpDelete)
- return &APIKeyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *APIKeyClient) DeleteOne(_m *APIKey) *APIKeyDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *APIKeyClient) DeleteOneID(id int64) *APIKeyDeleteOne {
- builder := c.Delete().Where(apikey.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &APIKeyDeleteOne{builder}
- }
- // Query returns a query builder for APIKey.
- func (c *APIKeyClient) Query() *APIKeyQuery {
- return &APIKeyQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeAPIKey},
- inters: c.Interceptors(),
- }
- }
- // Get returns a APIKey entity by its id.
- func (c *APIKeyClient) Get(ctx context.Context, id int64) (*APIKey, error) {
- return c.Query().Where(apikey.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *APIKeyClient) GetX(ctx context.Context, id int64) *APIKey {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a APIKey.
- func (c *APIKeyClient) QueryUser(_m *APIKey) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(apikey.Table, apikey.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, apikey.UserTable, apikey.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryGroup queries the group edge of a APIKey.
- func (c *APIKeyClient) QueryGroup(_m *APIKey) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(apikey.Table, apikey.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, apikey.GroupTable, apikey.GroupColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUsageLogs queries the usage_logs edge of a APIKey.
- func (c *APIKeyClient) QueryUsageLogs(_m *APIKey) *UsageLogQuery {
- query := (&UsageLogClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(apikey.Table, apikey.FieldID, id),
- sqlgraph.To(usagelog.Table, usagelog.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, apikey.UsageLogsTable, apikey.UsageLogsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *APIKeyClient) Hooks() []Hook {
- hooks := c.hooks.APIKey
- return append(hooks[:len(hooks):len(hooks)], apikey.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *APIKeyClient) Interceptors() []Interceptor {
- inters := c.inters.APIKey
- return append(inters[:len(inters):len(inters)], apikey.Interceptors[:]...)
- }
- func (c *APIKeyClient) mutate(ctx context.Context, m *APIKeyMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&APIKeyCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&APIKeyUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&APIKeyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&APIKeyDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown APIKey mutation op: %q", m.Op())
- }
- }
- // AccountClient is a client for the Account schema.
- type AccountClient struct {
- config
- }
- // NewAccountClient returns a client for the Account from the given config.
- func NewAccountClient(c config) *AccountClient {
- return &AccountClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `account.Hooks(f(g(h())))`.
- func (c *AccountClient) Use(hooks ...Hook) {
- c.hooks.Account = append(c.hooks.Account, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `account.Intercept(f(g(h())))`.
- func (c *AccountClient) Intercept(interceptors ...Interceptor) {
- c.inters.Account = append(c.inters.Account, interceptors...)
- }
- // Create returns a builder for creating a Account entity.
- func (c *AccountClient) Create() *AccountCreate {
- mutation := newAccountMutation(c.config, OpCreate)
- return &AccountCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of Account entities.
- func (c *AccountClient) CreateBulk(builders ...*AccountCreate) *AccountCreateBulk {
- return &AccountCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *AccountClient) MapCreateBulk(slice any, setFunc func(*AccountCreate, int)) *AccountCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &AccountCreateBulk{err: fmt.Errorf("calling to AccountClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*AccountCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &AccountCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for Account.
- func (c *AccountClient) Update() *AccountUpdate {
- mutation := newAccountMutation(c.config, OpUpdate)
- return &AccountUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *AccountClient) UpdateOne(_m *Account) *AccountUpdateOne {
- mutation := newAccountMutation(c.config, OpUpdateOne, withAccount(_m))
- return &AccountUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *AccountClient) UpdateOneID(id int64) *AccountUpdateOne {
- mutation := newAccountMutation(c.config, OpUpdateOne, withAccountID(id))
- return &AccountUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for Account.
- func (c *AccountClient) Delete() *AccountDelete {
- mutation := newAccountMutation(c.config, OpDelete)
- return &AccountDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *AccountClient) DeleteOne(_m *Account) *AccountDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *AccountClient) DeleteOneID(id int64) *AccountDeleteOne {
- builder := c.Delete().Where(account.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &AccountDeleteOne{builder}
- }
- // Query returns a query builder for Account.
- func (c *AccountClient) Query() *AccountQuery {
- return &AccountQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeAccount},
- inters: c.Interceptors(),
- }
- }
- // Get returns a Account entity by its id.
- func (c *AccountClient) Get(ctx context.Context, id int64) (*Account, error) {
- return c.Query().Where(account.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *AccountClient) GetX(ctx context.Context, id int64) *Account {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryGroups queries the groups edge of a Account.
- func (c *AccountClient) QueryGroups(_m *Account) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(account.Table, account.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2M, false, account.GroupsTable, account.GroupsPrimaryKey...),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryProxy queries the proxy edge of a Account.
- func (c *AccountClient) QueryProxy(_m *Account) *ProxyQuery {
- query := (&ProxyClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(account.Table, account.FieldID, id),
- sqlgraph.To(proxy.Table, proxy.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, account.ProxyTable, account.ProxyColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryParent queries the parent edge of a Account.
- func (c *AccountClient) QueryParent(_m *Account) *AccountQuery {
- query := (&AccountClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(account.Table, account.FieldID, id),
- sqlgraph.To(account.Table, account.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, account.ParentTable, account.ParentColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryChildren queries the children edge of a Account.
- func (c *AccountClient) QueryChildren(_m *Account) *AccountQuery {
- query := (&AccountClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(account.Table, account.FieldID, id),
- sqlgraph.To(account.Table, account.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, account.ChildrenTable, account.ChildrenColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUsageLogs queries the usage_logs edge of a Account.
- func (c *AccountClient) QueryUsageLogs(_m *Account) *UsageLogQuery {
- query := (&UsageLogClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(account.Table, account.FieldID, id),
- sqlgraph.To(usagelog.Table, usagelog.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, account.UsageLogsTable, account.UsageLogsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAccountGroups queries the account_groups edge of a Account.
- func (c *AccountClient) QueryAccountGroups(_m *Account) *AccountGroupQuery {
- query := (&AccountGroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(account.Table, account.FieldID, id),
- sqlgraph.To(accountgroup.Table, accountgroup.AccountColumn),
- sqlgraph.Edge(sqlgraph.O2M, true, account.AccountGroupsTable, account.AccountGroupsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *AccountClient) Hooks() []Hook {
- hooks := c.hooks.Account
- return append(hooks[:len(hooks):len(hooks)], account.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *AccountClient) Interceptors() []Interceptor {
- inters := c.inters.Account
- return append(inters[:len(inters):len(inters)], account.Interceptors[:]...)
- }
- func (c *AccountClient) mutate(ctx context.Context, m *AccountMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&AccountCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&AccountUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&AccountUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&AccountDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown Account mutation op: %q", m.Op())
- }
- }
- // AccountGroupClient is a client for the AccountGroup schema.
- type AccountGroupClient struct {
- config
- }
- // NewAccountGroupClient returns a client for the AccountGroup from the given config.
- func NewAccountGroupClient(c config) *AccountGroupClient {
- return &AccountGroupClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `accountgroup.Hooks(f(g(h())))`.
- func (c *AccountGroupClient) Use(hooks ...Hook) {
- c.hooks.AccountGroup = append(c.hooks.AccountGroup, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `accountgroup.Intercept(f(g(h())))`.
- func (c *AccountGroupClient) Intercept(interceptors ...Interceptor) {
- c.inters.AccountGroup = append(c.inters.AccountGroup, interceptors...)
- }
- // Create returns a builder for creating a AccountGroup entity.
- func (c *AccountGroupClient) Create() *AccountGroupCreate {
- mutation := newAccountGroupMutation(c.config, OpCreate)
- return &AccountGroupCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of AccountGroup entities.
- func (c *AccountGroupClient) CreateBulk(builders ...*AccountGroupCreate) *AccountGroupCreateBulk {
- return &AccountGroupCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *AccountGroupClient) MapCreateBulk(slice any, setFunc func(*AccountGroupCreate, int)) *AccountGroupCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &AccountGroupCreateBulk{err: fmt.Errorf("calling to AccountGroupClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*AccountGroupCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &AccountGroupCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for AccountGroup.
- func (c *AccountGroupClient) Update() *AccountGroupUpdate {
- mutation := newAccountGroupMutation(c.config, OpUpdate)
- return &AccountGroupUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *AccountGroupClient) UpdateOne(_m *AccountGroup) *AccountGroupUpdateOne {
- mutation := newAccountGroupMutation(c.config, OpUpdateOne)
- mutation.account = &_m.AccountID
- mutation.group = &_m.GroupID
- return &AccountGroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for AccountGroup.
- func (c *AccountGroupClient) Delete() *AccountGroupDelete {
- mutation := newAccountGroupMutation(c.config, OpDelete)
- return &AccountGroupDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Query returns a query builder for AccountGroup.
- func (c *AccountGroupClient) Query() *AccountGroupQuery {
- return &AccountGroupQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeAccountGroup},
- inters: c.Interceptors(),
- }
- }
- // QueryAccount queries the account edge of a AccountGroup.
- func (c *AccountGroupClient) QueryAccount(_m *AccountGroup) *AccountQuery {
- return c.Query().
- Where(accountgroup.AccountID(_m.AccountID), accountgroup.GroupID(_m.GroupID)).
- QueryAccount()
- }
- // QueryGroup queries the group edge of a AccountGroup.
- func (c *AccountGroupClient) QueryGroup(_m *AccountGroup) *GroupQuery {
- return c.Query().
- Where(accountgroup.AccountID(_m.AccountID), accountgroup.GroupID(_m.GroupID)).
- QueryGroup()
- }
- // Hooks returns the client hooks.
- func (c *AccountGroupClient) Hooks() []Hook {
- return c.hooks.AccountGroup
- }
- // Interceptors returns the client interceptors.
- func (c *AccountGroupClient) Interceptors() []Interceptor {
- return c.inters.AccountGroup
- }
- func (c *AccountGroupClient) mutate(ctx context.Context, m *AccountGroupMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&AccountGroupCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&AccountGroupUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&AccountGroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&AccountGroupDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown AccountGroup mutation op: %q", m.Op())
- }
- }
- // AnnouncementClient is a client for the Announcement schema.
- type AnnouncementClient struct {
- config
- }
- // NewAnnouncementClient returns a client for the Announcement from the given config.
- func NewAnnouncementClient(c config) *AnnouncementClient {
- return &AnnouncementClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `announcement.Hooks(f(g(h())))`.
- func (c *AnnouncementClient) Use(hooks ...Hook) {
- c.hooks.Announcement = append(c.hooks.Announcement, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `announcement.Intercept(f(g(h())))`.
- func (c *AnnouncementClient) Intercept(interceptors ...Interceptor) {
- c.inters.Announcement = append(c.inters.Announcement, interceptors...)
- }
- // Create returns a builder for creating a Announcement entity.
- func (c *AnnouncementClient) Create() *AnnouncementCreate {
- mutation := newAnnouncementMutation(c.config, OpCreate)
- return &AnnouncementCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of Announcement entities.
- func (c *AnnouncementClient) CreateBulk(builders ...*AnnouncementCreate) *AnnouncementCreateBulk {
- return &AnnouncementCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *AnnouncementClient) MapCreateBulk(slice any, setFunc func(*AnnouncementCreate, int)) *AnnouncementCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &AnnouncementCreateBulk{err: fmt.Errorf("calling to AnnouncementClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*AnnouncementCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &AnnouncementCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for Announcement.
- func (c *AnnouncementClient) Update() *AnnouncementUpdate {
- mutation := newAnnouncementMutation(c.config, OpUpdate)
- return &AnnouncementUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *AnnouncementClient) UpdateOne(_m *Announcement) *AnnouncementUpdateOne {
- mutation := newAnnouncementMutation(c.config, OpUpdateOne, withAnnouncement(_m))
- return &AnnouncementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *AnnouncementClient) UpdateOneID(id int64) *AnnouncementUpdateOne {
- mutation := newAnnouncementMutation(c.config, OpUpdateOne, withAnnouncementID(id))
- return &AnnouncementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for Announcement.
- func (c *AnnouncementClient) Delete() *AnnouncementDelete {
- mutation := newAnnouncementMutation(c.config, OpDelete)
- return &AnnouncementDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *AnnouncementClient) DeleteOne(_m *Announcement) *AnnouncementDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *AnnouncementClient) DeleteOneID(id int64) *AnnouncementDeleteOne {
- builder := c.Delete().Where(announcement.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &AnnouncementDeleteOne{builder}
- }
- // Query returns a query builder for Announcement.
- func (c *AnnouncementClient) Query() *AnnouncementQuery {
- return &AnnouncementQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeAnnouncement},
- inters: c.Interceptors(),
- }
- }
- // Get returns a Announcement entity by its id.
- func (c *AnnouncementClient) Get(ctx context.Context, id int64) (*Announcement, error) {
- return c.Query().Where(announcement.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *AnnouncementClient) GetX(ctx context.Context, id int64) *Announcement {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryReads queries the reads edge of a Announcement.
- func (c *AnnouncementClient) QueryReads(_m *Announcement) *AnnouncementReadQuery {
- query := (&AnnouncementReadClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(announcement.Table, announcement.FieldID, id),
- sqlgraph.To(announcementread.Table, announcementread.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, announcement.ReadsTable, announcement.ReadsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *AnnouncementClient) Hooks() []Hook {
- return c.hooks.Announcement
- }
- // Interceptors returns the client interceptors.
- func (c *AnnouncementClient) Interceptors() []Interceptor {
- return c.inters.Announcement
- }
- func (c *AnnouncementClient) mutate(ctx context.Context, m *AnnouncementMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&AnnouncementCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&AnnouncementUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&AnnouncementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&AnnouncementDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown Announcement mutation op: %q", m.Op())
- }
- }
- // AnnouncementReadClient is a client for the AnnouncementRead schema.
- type AnnouncementReadClient struct {
- config
- }
- // NewAnnouncementReadClient returns a client for the AnnouncementRead from the given config.
- func NewAnnouncementReadClient(c config) *AnnouncementReadClient {
- return &AnnouncementReadClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `announcementread.Hooks(f(g(h())))`.
- func (c *AnnouncementReadClient) Use(hooks ...Hook) {
- c.hooks.AnnouncementRead = append(c.hooks.AnnouncementRead, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `announcementread.Intercept(f(g(h())))`.
- func (c *AnnouncementReadClient) Intercept(interceptors ...Interceptor) {
- c.inters.AnnouncementRead = append(c.inters.AnnouncementRead, interceptors...)
- }
- // Create returns a builder for creating a AnnouncementRead entity.
- func (c *AnnouncementReadClient) Create() *AnnouncementReadCreate {
- mutation := newAnnouncementReadMutation(c.config, OpCreate)
- return &AnnouncementReadCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of AnnouncementRead entities.
- func (c *AnnouncementReadClient) CreateBulk(builders ...*AnnouncementReadCreate) *AnnouncementReadCreateBulk {
- return &AnnouncementReadCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *AnnouncementReadClient) MapCreateBulk(slice any, setFunc func(*AnnouncementReadCreate, int)) *AnnouncementReadCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &AnnouncementReadCreateBulk{err: fmt.Errorf("calling to AnnouncementReadClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*AnnouncementReadCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &AnnouncementReadCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for AnnouncementRead.
- func (c *AnnouncementReadClient) Update() *AnnouncementReadUpdate {
- mutation := newAnnouncementReadMutation(c.config, OpUpdate)
- return &AnnouncementReadUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *AnnouncementReadClient) UpdateOne(_m *AnnouncementRead) *AnnouncementReadUpdateOne {
- mutation := newAnnouncementReadMutation(c.config, OpUpdateOne, withAnnouncementRead(_m))
- return &AnnouncementReadUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *AnnouncementReadClient) UpdateOneID(id int64) *AnnouncementReadUpdateOne {
- mutation := newAnnouncementReadMutation(c.config, OpUpdateOne, withAnnouncementReadID(id))
- return &AnnouncementReadUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for AnnouncementRead.
- func (c *AnnouncementReadClient) Delete() *AnnouncementReadDelete {
- mutation := newAnnouncementReadMutation(c.config, OpDelete)
- return &AnnouncementReadDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *AnnouncementReadClient) DeleteOne(_m *AnnouncementRead) *AnnouncementReadDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *AnnouncementReadClient) DeleteOneID(id int64) *AnnouncementReadDeleteOne {
- builder := c.Delete().Where(announcementread.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &AnnouncementReadDeleteOne{builder}
- }
- // Query returns a query builder for AnnouncementRead.
- func (c *AnnouncementReadClient) Query() *AnnouncementReadQuery {
- return &AnnouncementReadQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeAnnouncementRead},
- inters: c.Interceptors(),
- }
- }
- // Get returns a AnnouncementRead entity by its id.
- func (c *AnnouncementReadClient) Get(ctx context.Context, id int64) (*AnnouncementRead, error) {
- return c.Query().Where(announcementread.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *AnnouncementReadClient) GetX(ctx context.Context, id int64) *AnnouncementRead {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryAnnouncement queries the announcement edge of a AnnouncementRead.
- func (c *AnnouncementReadClient) QueryAnnouncement(_m *AnnouncementRead) *AnnouncementQuery {
- query := (&AnnouncementClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(announcementread.Table, announcementread.FieldID, id),
- sqlgraph.To(announcement.Table, announcement.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, announcementread.AnnouncementTable, announcementread.AnnouncementColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUser queries the user edge of a AnnouncementRead.
- func (c *AnnouncementReadClient) QueryUser(_m *AnnouncementRead) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(announcementread.Table, announcementread.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, announcementread.UserTable, announcementread.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *AnnouncementReadClient) Hooks() []Hook {
- return c.hooks.AnnouncementRead
- }
- // Interceptors returns the client interceptors.
- func (c *AnnouncementReadClient) Interceptors() []Interceptor {
- return c.inters.AnnouncementRead
- }
- func (c *AnnouncementReadClient) mutate(ctx context.Context, m *AnnouncementReadMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&AnnouncementReadCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&AnnouncementReadUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&AnnouncementReadUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&AnnouncementReadDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown AnnouncementRead mutation op: %q", m.Op())
- }
- }
- // AuthIdentityClient is a client for the AuthIdentity schema.
- type AuthIdentityClient struct {
- config
- }
- // NewAuthIdentityClient returns a client for the AuthIdentity from the given config.
- func NewAuthIdentityClient(c config) *AuthIdentityClient {
- return &AuthIdentityClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `authidentity.Hooks(f(g(h())))`.
- func (c *AuthIdentityClient) Use(hooks ...Hook) {
- c.hooks.AuthIdentity = append(c.hooks.AuthIdentity, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `authidentity.Intercept(f(g(h())))`.
- func (c *AuthIdentityClient) Intercept(interceptors ...Interceptor) {
- c.inters.AuthIdentity = append(c.inters.AuthIdentity, interceptors...)
- }
- // Create returns a builder for creating a AuthIdentity entity.
- func (c *AuthIdentityClient) Create() *AuthIdentityCreate {
- mutation := newAuthIdentityMutation(c.config, OpCreate)
- return &AuthIdentityCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of AuthIdentity entities.
- func (c *AuthIdentityClient) CreateBulk(builders ...*AuthIdentityCreate) *AuthIdentityCreateBulk {
- return &AuthIdentityCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *AuthIdentityClient) MapCreateBulk(slice any, setFunc func(*AuthIdentityCreate, int)) *AuthIdentityCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &AuthIdentityCreateBulk{err: fmt.Errorf("calling to AuthIdentityClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*AuthIdentityCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &AuthIdentityCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for AuthIdentity.
- func (c *AuthIdentityClient) Update() *AuthIdentityUpdate {
- mutation := newAuthIdentityMutation(c.config, OpUpdate)
- return &AuthIdentityUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *AuthIdentityClient) UpdateOne(_m *AuthIdentity) *AuthIdentityUpdateOne {
- mutation := newAuthIdentityMutation(c.config, OpUpdateOne, withAuthIdentity(_m))
- return &AuthIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *AuthIdentityClient) UpdateOneID(id int64) *AuthIdentityUpdateOne {
- mutation := newAuthIdentityMutation(c.config, OpUpdateOne, withAuthIdentityID(id))
- return &AuthIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for AuthIdentity.
- func (c *AuthIdentityClient) Delete() *AuthIdentityDelete {
- mutation := newAuthIdentityMutation(c.config, OpDelete)
- return &AuthIdentityDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *AuthIdentityClient) DeleteOne(_m *AuthIdentity) *AuthIdentityDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *AuthIdentityClient) DeleteOneID(id int64) *AuthIdentityDeleteOne {
- builder := c.Delete().Where(authidentity.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &AuthIdentityDeleteOne{builder}
- }
- // Query returns a query builder for AuthIdentity.
- func (c *AuthIdentityClient) Query() *AuthIdentityQuery {
- return &AuthIdentityQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeAuthIdentity},
- inters: c.Interceptors(),
- }
- }
- // Get returns a AuthIdentity entity by its id.
- func (c *AuthIdentityClient) Get(ctx context.Context, id int64) (*AuthIdentity, error) {
- return c.Query().Where(authidentity.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *AuthIdentityClient) GetX(ctx context.Context, id int64) *AuthIdentity {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a AuthIdentity.
- func (c *AuthIdentityClient) QueryUser(_m *AuthIdentity) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(authidentity.Table, authidentity.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, authidentity.UserTable, authidentity.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryChannels queries the channels edge of a AuthIdentity.
- func (c *AuthIdentityClient) QueryChannels(_m *AuthIdentity) *AuthIdentityChannelQuery {
- query := (&AuthIdentityChannelClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(authidentity.Table, authidentity.FieldID, id),
- sqlgraph.To(authidentitychannel.Table, authidentitychannel.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, authidentity.ChannelsTable, authidentity.ChannelsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAdoptionDecisions queries the adoption_decisions edge of a AuthIdentity.
- func (c *AuthIdentityClient) QueryAdoptionDecisions(_m *AuthIdentity) *IdentityAdoptionDecisionQuery {
- query := (&IdentityAdoptionDecisionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(authidentity.Table, authidentity.FieldID, id),
- sqlgraph.To(identityadoptiondecision.Table, identityadoptiondecision.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, authidentity.AdoptionDecisionsTable, authidentity.AdoptionDecisionsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *AuthIdentityClient) Hooks() []Hook {
- return c.hooks.AuthIdentity
- }
- // Interceptors returns the client interceptors.
- func (c *AuthIdentityClient) Interceptors() []Interceptor {
- return c.inters.AuthIdentity
- }
- func (c *AuthIdentityClient) mutate(ctx context.Context, m *AuthIdentityMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&AuthIdentityCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&AuthIdentityUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&AuthIdentityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&AuthIdentityDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown AuthIdentity mutation op: %q", m.Op())
- }
- }
- // AuthIdentityChannelClient is a client for the AuthIdentityChannel schema.
- type AuthIdentityChannelClient struct {
- config
- }
- // NewAuthIdentityChannelClient returns a client for the AuthIdentityChannel from the given config.
- func NewAuthIdentityChannelClient(c config) *AuthIdentityChannelClient {
- return &AuthIdentityChannelClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `authidentitychannel.Hooks(f(g(h())))`.
- func (c *AuthIdentityChannelClient) Use(hooks ...Hook) {
- c.hooks.AuthIdentityChannel = append(c.hooks.AuthIdentityChannel, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `authidentitychannel.Intercept(f(g(h())))`.
- func (c *AuthIdentityChannelClient) Intercept(interceptors ...Interceptor) {
- c.inters.AuthIdentityChannel = append(c.inters.AuthIdentityChannel, interceptors...)
- }
- // Create returns a builder for creating a AuthIdentityChannel entity.
- func (c *AuthIdentityChannelClient) Create() *AuthIdentityChannelCreate {
- mutation := newAuthIdentityChannelMutation(c.config, OpCreate)
- return &AuthIdentityChannelCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of AuthIdentityChannel entities.
- func (c *AuthIdentityChannelClient) CreateBulk(builders ...*AuthIdentityChannelCreate) *AuthIdentityChannelCreateBulk {
- return &AuthIdentityChannelCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *AuthIdentityChannelClient) MapCreateBulk(slice any, setFunc func(*AuthIdentityChannelCreate, int)) *AuthIdentityChannelCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &AuthIdentityChannelCreateBulk{err: fmt.Errorf("calling to AuthIdentityChannelClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*AuthIdentityChannelCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &AuthIdentityChannelCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for AuthIdentityChannel.
- func (c *AuthIdentityChannelClient) Update() *AuthIdentityChannelUpdate {
- mutation := newAuthIdentityChannelMutation(c.config, OpUpdate)
- return &AuthIdentityChannelUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *AuthIdentityChannelClient) UpdateOne(_m *AuthIdentityChannel) *AuthIdentityChannelUpdateOne {
- mutation := newAuthIdentityChannelMutation(c.config, OpUpdateOne, withAuthIdentityChannel(_m))
- return &AuthIdentityChannelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *AuthIdentityChannelClient) UpdateOneID(id int64) *AuthIdentityChannelUpdateOne {
- mutation := newAuthIdentityChannelMutation(c.config, OpUpdateOne, withAuthIdentityChannelID(id))
- return &AuthIdentityChannelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for AuthIdentityChannel.
- func (c *AuthIdentityChannelClient) Delete() *AuthIdentityChannelDelete {
- mutation := newAuthIdentityChannelMutation(c.config, OpDelete)
- return &AuthIdentityChannelDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *AuthIdentityChannelClient) DeleteOne(_m *AuthIdentityChannel) *AuthIdentityChannelDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *AuthIdentityChannelClient) DeleteOneID(id int64) *AuthIdentityChannelDeleteOne {
- builder := c.Delete().Where(authidentitychannel.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &AuthIdentityChannelDeleteOne{builder}
- }
- // Query returns a query builder for AuthIdentityChannel.
- func (c *AuthIdentityChannelClient) Query() *AuthIdentityChannelQuery {
- return &AuthIdentityChannelQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeAuthIdentityChannel},
- inters: c.Interceptors(),
- }
- }
- // Get returns a AuthIdentityChannel entity by its id.
- func (c *AuthIdentityChannelClient) Get(ctx context.Context, id int64) (*AuthIdentityChannel, error) {
- return c.Query().Where(authidentitychannel.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *AuthIdentityChannelClient) GetX(ctx context.Context, id int64) *AuthIdentityChannel {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryIdentity queries the identity edge of a AuthIdentityChannel.
- func (c *AuthIdentityChannelClient) QueryIdentity(_m *AuthIdentityChannel) *AuthIdentityQuery {
- query := (&AuthIdentityClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(authidentitychannel.Table, authidentitychannel.FieldID, id),
- sqlgraph.To(authidentity.Table, authidentity.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, authidentitychannel.IdentityTable, authidentitychannel.IdentityColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *AuthIdentityChannelClient) Hooks() []Hook {
- return c.hooks.AuthIdentityChannel
- }
- // Interceptors returns the client interceptors.
- func (c *AuthIdentityChannelClient) Interceptors() []Interceptor {
- return c.inters.AuthIdentityChannel
- }
- func (c *AuthIdentityChannelClient) mutate(ctx context.Context, m *AuthIdentityChannelMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&AuthIdentityChannelCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&AuthIdentityChannelUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&AuthIdentityChannelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&AuthIdentityChannelDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown AuthIdentityChannel mutation op: %q", m.Op())
- }
- }
- // BatchImageEventClient is a client for the BatchImageEvent schema.
- type BatchImageEventClient struct {
- config
- }
- // NewBatchImageEventClient returns a client for the BatchImageEvent from the given config.
- func NewBatchImageEventClient(c config) *BatchImageEventClient {
- return &BatchImageEventClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `batchimageevent.Hooks(f(g(h())))`.
- func (c *BatchImageEventClient) Use(hooks ...Hook) {
- c.hooks.BatchImageEvent = append(c.hooks.BatchImageEvent, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `batchimageevent.Intercept(f(g(h())))`.
- func (c *BatchImageEventClient) Intercept(interceptors ...Interceptor) {
- c.inters.BatchImageEvent = append(c.inters.BatchImageEvent, interceptors...)
- }
- // Create returns a builder for creating a BatchImageEvent entity.
- func (c *BatchImageEventClient) Create() *BatchImageEventCreate {
- mutation := newBatchImageEventMutation(c.config, OpCreate)
- return &BatchImageEventCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of BatchImageEvent entities.
- func (c *BatchImageEventClient) CreateBulk(builders ...*BatchImageEventCreate) *BatchImageEventCreateBulk {
- return &BatchImageEventCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *BatchImageEventClient) MapCreateBulk(slice any, setFunc func(*BatchImageEventCreate, int)) *BatchImageEventCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &BatchImageEventCreateBulk{err: fmt.Errorf("calling to BatchImageEventClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*BatchImageEventCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &BatchImageEventCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for BatchImageEvent.
- func (c *BatchImageEventClient) Update() *BatchImageEventUpdate {
- mutation := newBatchImageEventMutation(c.config, OpUpdate)
- return &BatchImageEventUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *BatchImageEventClient) UpdateOne(_m *BatchImageEvent) *BatchImageEventUpdateOne {
- mutation := newBatchImageEventMutation(c.config, OpUpdateOne, withBatchImageEvent(_m))
- return &BatchImageEventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *BatchImageEventClient) UpdateOneID(id int64) *BatchImageEventUpdateOne {
- mutation := newBatchImageEventMutation(c.config, OpUpdateOne, withBatchImageEventID(id))
- return &BatchImageEventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for BatchImageEvent.
- func (c *BatchImageEventClient) Delete() *BatchImageEventDelete {
- mutation := newBatchImageEventMutation(c.config, OpDelete)
- return &BatchImageEventDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *BatchImageEventClient) DeleteOne(_m *BatchImageEvent) *BatchImageEventDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *BatchImageEventClient) DeleteOneID(id int64) *BatchImageEventDeleteOne {
- builder := c.Delete().Where(batchimageevent.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &BatchImageEventDeleteOne{builder}
- }
- // Query returns a query builder for BatchImageEvent.
- func (c *BatchImageEventClient) Query() *BatchImageEventQuery {
- return &BatchImageEventQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeBatchImageEvent},
- inters: c.Interceptors(),
- }
- }
- // Get returns a BatchImageEvent entity by its id.
- func (c *BatchImageEventClient) Get(ctx context.Context, id int64) (*BatchImageEvent, error) {
- return c.Query().Where(batchimageevent.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *BatchImageEventClient) GetX(ctx context.Context, id int64) *BatchImageEvent {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *BatchImageEventClient) Hooks() []Hook {
- return c.hooks.BatchImageEvent
- }
- // Interceptors returns the client interceptors.
- func (c *BatchImageEventClient) Interceptors() []Interceptor {
- return c.inters.BatchImageEvent
- }
- func (c *BatchImageEventClient) mutate(ctx context.Context, m *BatchImageEventMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&BatchImageEventCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&BatchImageEventUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&BatchImageEventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&BatchImageEventDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown BatchImageEvent mutation op: %q", m.Op())
- }
- }
- // BatchImageItemClient is a client for the BatchImageItem schema.
- type BatchImageItemClient struct {
- config
- }
- // NewBatchImageItemClient returns a client for the BatchImageItem from the given config.
- func NewBatchImageItemClient(c config) *BatchImageItemClient {
- return &BatchImageItemClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `batchimageitem.Hooks(f(g(h())))`.
- func (c *BatchImageItemClient) Use(hooks ...Hook) {
- c.hooks.BatchImageItem = append(c.hooks.BatchImageItem, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `batchimageitem.Intercept(f(g(h())))`.
- func (c *BatchImageItemClient) Intercept(interceptors ...Interceptor) {
- c.inters.BatchImageItem = append(c.inters.BatchImageItem, interceptors...)
- }
- // Create returns a builder for creating a BatchImageItem entity.
- func (c *BatchImageItemClient) Create() *BatchImageItemCreate {
- mutation := newBatchImageItemMutation(c.config, OpCreate)
- return &BatchImageItemCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of BatchImageItem entities.
- func (c *BatchImageItemClient) CreateBulk(builders ...*BatchImageItemCreate) *BatchImageItemCreateBulk {
- return &BatchImageItemCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *BatchImageItemClient) MapCreateBulk(slice any, setFunc func(*BatchImageItemCreate, int)) *BatchImageItemCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &BatchImageItemCreateBulk{err: fmt.Errorf("calling to BatchImageItemClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*BatchImageItemCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &BatchImageItemCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for BatchImageItem.
- func (c *BatchImageItemClient) Update() *BatchImageItemUpdate {
- mutation := newBatchImageItemMutation(c.config, OpUpdate)
- return &BatchImageItemUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *BatchImageItemClient) UpdateOne(_m *BatchImageItem) *BatchImageItemUpdateOne {
- mutation := newBatchImageItemMutation(c.config, OpUpdateOne, withBatchImageItem(_m))
- return &BatchImageItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *BatchImageItemClient) UpdateOneID(id int64) *BatchImageItemUpdateOne {
- mutation := newBatchImageItemMutation(c.config, OpUpdateOne, withBatchImageItemID(id))
- return &BatchImageItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for BatchImageItem.
- func (c *BatchImageItemClient) Delete() *BatchImageItemDelete {
- mutation := newBatchImageItemMutation(c.config, OpDelete)
- return &BatchImageItemDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *BatchImageItemClient) DeleteOne(_m *BatchImageItem) *BatchImageItemDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *BatchImageItemClient) DeleteOneID(id int64) *BatchImageItemDeleteOne {
- builder := c.Delete().Where(batchimageitem.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &BatchImageItemDeleteOne{builder}
- }
- // Query returns a query builder for BatchImageItem.
- func (c *BatchImageItemClient) Query() *BatchImageItemQuery {
- return &BatchImageItemQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeBatchImageItem},
- inters: c.Interceptors(),
- }
- }
- // Get returns a BatchImageItem entity by its id.
- func (c *BatchImageItemClient) Get(ctx context.Context, id int64) (*BatchImageItem, error) {
- return c.Query().Where(batchimageitem.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *BatchImageItemClient) GetX(ctx context.Context, id int64) *BatchImageItem {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *BatchImageItemClient) Hooks() []Hook {
- return c.hooks.BatchImageItem
- }
- // Interceptors returns the client interceptors.
- func (c *BatchImageItemClient) Interceptors() []Interceptor {
- return c.inters.BatchImageItem
- }
- func (c *BatchImageItemClient) mutate(ctx context.Context, m *BatchImageItemMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&BatchImageItemCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&BatchImageItemUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&BatchImageItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&BatchImageItemDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown BatchImageItem mutation op: %q", m.Op())
- }
- }
- // BatchImageJobClient is a client for the BatchImageJob schema.
- type BatchImageJobClient struct {
- config
- }
- // NewBatchImageJobClient returns a client for the BatchImageJob from the given config.
- func NewBatchImageJobClient(c config) *BatchImageJobClient {
- return &BatchImageJobClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `batchimagejob.Hooks(f(g(h())))`.
- func (c *BatchImageJobClient) Use(hooks ...Hook) {
- c.hooks.BatchImageJob = append(c.hooks.BatchImageJob, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `batchimagejob.Intercept(f(g(h())))`.
- func (c *BatchImageJobClient) Intercept(interceptors ...Interceptor) {
- c.inters.BatchImageJob = append(c.inters.BatchImageJob, interceptors...)
- }
- // Create returns a builder for creating a BatchImageJob entity.
- func (c *BatchImageJobClient) Create() *BatchImageJobCreate {
- mutation := newBatchImageJobMutation(c.config, OpCreate)
- return &BatchImageJobCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of BatchImageJob entities.
- func (c *BatchImageJobClient) CreateBulk(builders ...*BatchImageJobCreate) *BatchImageJobCreateBulk {
- return &BatchImageJobCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *BatchImageJobClient) MapCreateBulk(slice any, setFunc func(*BatchImageJobCreate, int)) *BatchImageJobCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &BatchImageJobCreateBulk{err: fmt.Errorf("calling to BatchImageJobClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*BatchImageJobCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &BatchImageJobCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for BatchImageJob.
- func (c *BatchImageJobClient) Update() *BatchImageJobUpdate {
- mutation := newBatchImageJobMutation(c.config, OpUpdate)
- return &BatchImageJobUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *BatchImageJobClient) UpdateOne(_m *BatchImageJob) *BatchImageJobUpdateOne {
- mutation := newBatchImageJobMutation(c.config, OpUpdateOne, withBatchImageJob(_m))
- return &BatchImageJobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *BatchImageJobClient) UpdateOneID(id int64) *BatchImageJobUpdateOne {
- mutation := newBatchImageJobMutation(c.config, OpUpdateOne, withBatchImageJobID(id))
- return &BatchImageJobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for BatchImageJob.
- func (c *BatchImageJobClient) Delete() *BatchImageJobDelete {
- mutation := newBatchImageJobMutation(c.config, OpDelete)
- return &BatchImageJobDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *BatchImageJobClient) DeleteOne(_m *BatchImageJob) *BatchImageJobDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *BatchImageJobClient) DeleteOneID(id int64) *BatchImageJobDeleteOne {
- builder := c.Delete().Where(batchimagejob.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &BatchImageJobDeleteOne{builder}
- }
- // Query returns a query builder for BatchImageJob.
- func (c *BatchImageJobClient) Query() *BatchImageJobQuery {
- return &BatchImageJobQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeBatchImageJob},
- inters: c.Interceptors(),
- }
- }
- // Get returns a BatchImageJob entity by its id.
- func (c *BatchImageJobClient) Get(ctx context.Context, id int64) (*BatchImageJob, error) {
- return c.Query().Where(batchimagejob.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *BatchImageJobClient) GetX(ctx context.Context, id int64) *BatchImageJob {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *BatchImageJobClient) Hooks() []Hook {
- return c.hooks.BatchImageJob
- }
- // Interceptors returns the client interceptors.
- func (c *BatchImageJobClient) Interceptors() []Interceptor {
- return c.inters.BatchImageJob
- }
- func (c *BatchImageJobClient) mutate(ctx context.Context, m *BatchImageJobMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&BatchImageJobCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&BatchImageJobUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&BatchImageJobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&BatchImageJobDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown BatchImageJob mutation op: %q", m.Op())
- }
- }
- // ChannelMonitorClient is a client for the ChannelMonitor schema.
- type ChannelMonitorClient struct {
- config
- }
- // NewChannelMonitorClient returns a client for the ChannelMonitor from the given config.
- func NewChannelMonitorClient(c config) *ChannelMonitorClient {
- return &ChannelMonitorClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `channelmonitor.Hooks(f(g(h())))`.
- func (c *ChannelMonitorClient) Use(hooks ...Hook) {
- c.hooks.ChannelMonitor = append(c.hooks.ChannelMonitor, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `channelmonitor.Intercept(f(g(h())))`.
- func (c *ChannelMonitorClient) Intercept(interceptors ...Interceptor) {
- c.inters.ChannelMonitor = append(c.inters.ChannelMonitor, interceptors...)
- }
- // Create returns a builder for creating a ChannelMonitor entity.
- func (c *ChannelMonitorClient) Create() *ChannelMonitorCreate {
- mutation := newChannelMonitorMutation(c.config, OpCreate)
- return &ChannelMonitorCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of ChannelMonitor entities.
- func (c *ChannelMonitorClient) CreateBulk(builders ...*ChannelMonitorCreate) *ChannelMonitorCreateBulk {
- return &ChannelMonitorCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *ChannelMonitorClient) MapCreateBulk(slice any, setFunc func(*ChannelMonitorCreate, int)) *ChannelMonitorCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &ChannelMonitorCreateBulk{err: fmt.Errorf("calling to ChannelMonitorClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*ChannelMonitorCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &ChannelMonitorCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for ChannelMonitor.
- func (c *ChannelMonitorClient) Update() *ChannelMonitorUpdate {
- mutation := newChannelMonitorMutation(c.config, OpUpdate)
- return &ChannelMonitorUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *ChannelMonitorClient) UpdateOne(_m *ChannelMonitor) *ChannelMonitorUpdateOne {
- mutation := newChannelMonitorMutation(c.config, OpUpdateOne, withChannelMonitor(_m))
- return &ChannelMonitorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *ChannelMonitorClient) UpdateOneID(id int64) *ChannelMonitorUpdateOne {
- mutation := newChannelMonitorMutation(c.config, OpUpdateOne, withChannelMonitorID(id))
- return &ChannelMonitorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for ChannelMonitor.
- func (c *ChannelMonitorClient) Delete() *ChannelMonitorDelete {
- mutation := newChannelMonitorMutation(c.config, OpDelete)
- return &ChannelMonitorDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *ChannelMonitorClient) DeleteOne(_m *ChannelMonitor) *ChannelMonitorDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *ChannelMonitorClient) DeleteOneID(id int64) *ChannelMonitorDeleteOne {
- builder := c.Delete().Where(channelmonitor.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &ChannelMonitorDeleteOne{builder}
- }
- // Query returns a query builder for ChannelMonitor.
- func (c *ChannelMonitorClient) Query() *ChannelMonitorQuery {
- return &ChannelMonitorQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeChannelMonitor},
- inters: c.Interceptors(),
- }
- }
- // Get returns a ChannelMonitor entity by its id.
- func (c *ChannelMonitorClient) Get(ctx context.Context, id int64) (*ChannelMonitor, error) {
- return c.Query().Where(channelmonitor.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *ChannelMonitorClient) GetX(ctx context.Context, id int64) *ChannelMonitor {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryHistory queries the history edge of a ChannelMonitor.
- func (c *ChannelMonitorClient) QueryHistory(_m *ChannelMonitor) *ChannelMonitorHistoryQuery {
- query := (&ChannelMonitorHistoryClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(channelmonitor.Table, channelmonitor.FieldID, id),
- sqlgraph.To(channelmonitorhistory.Table, channelmonitorhistory.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, channelmonitor.HistoryTable, channelmonitor.HistoryColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryDailyRollups queries the daily_rollups edge of a ChannelMonitor.
- func (c *ChannelMonitorClient) QueryDailyRollups(_m *ChannelMonitor) *ChannelMonitorDailyRollupQuery {
- query := (&ChannelMonitorDailyRollupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(channelmonitor.Table, channelmonitor.FieldID, id),
- sqlgraph.To(channelmonitordailyrollup.Table, channelmonitordailyrollup.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, channelmonitor.DailyRollupsTable, channelmonitor.DailyRollupsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryRequestTemplate queries the request_template edge of a ChannelMonitor.
- func (c *ChannelMonitorClient) QueryRequestTemplate(_m *ChannelMonitor) *ChannelMonitorRequestTemplateQuery {
- query := (&ChannelMonitorRequestTemplateClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(channelmonitor.Table, channelmonitor.FieldID, id),
- sqlgraph.To(channelmonitorrequesttemplate.Table, channelmonitorrequesttemplate.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, channelmonitor.RequestTemplateTable, channelmonitor.RequestTemplateColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *ChannelMonitorClient) Hooks() []Hook {
- return c.hooks.ChannelMonitor
- }
- // Interceptors returns the client interceptors.
- func (c *ChannelMonitorClient) Interceptors() []Interceptor {
- return c.inters.ChannelMonitor
- }
- func (c *ChannelMonitorClient) mutate(ctx context.Context, m *ChannelMonitorMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&ChannelMonitorCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&ChannelMonitorUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&ChannelMonitorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&ChannelMonitorDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown ChannelMonitor mutation op: %q", m.Op())
- }
- }
- // ChannelMonitorDailyRollupClient is a client for the ChannelMonitorDailyRollup schema.
- type ChannelMonitorDailyRollupClient struct {
- config
- }
- // NewChannelMonitorDailyRollupClient returns a client for the ChannelMonitorDailyRollup from the given config.
- func NewChannelMonitorDailyRollupClient(c config) *ChannelMonitorDailyRollupClient {
- return &ChannelMonitorDailyRollupClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `channelmonitordailyrollup.Hooks(f(g(h())))`.
- func (c *ChannelMonitorDailyRollupClient) Use(hooks ...Hook) {
- c.hooks.ChannelMonitorDailyRollup = append(c.hooks.ChannelMonitorDailyRollup, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `channelmonitordailyrollup.Intercept(f(g(h())))`.
- func (c *ChannelMonitorDailyRollupClient) Intercept(interceptors ...Interceptor) {
- c.inters.ChannelMonitorDailyRollup = append(c.inters.ChannelMonitorDailyRollup, interceptors...)
- }
- // Create returns a builder for creating a ChannelMonitorDailyRollup entity.
- func (c *ChannelMonitorDailyRollupClient) Create() *ChannelMonitorDailyRollupCreate {
- mutation := newChannelMonitorDailyRollupMutation(c.config, OpCreate)
- return &ChannelMonitorDailyRollupCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of ChannelMonitorDailyRollup entities.
- func (c *ChannelMonitorDailyRollupClient) CreateBulk(builders ...*ChannelMonitorDailyRollupCreate) *ChannelMonitorDailyRollupCreateBulk {
- return &ChannelMonitorDailyRollupCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *ChannelMonitorDailyRollupClient) MapCreateBulk(slice any, setFunc func(*ChannelMonitorDailyRollupCreate, int)) *ChannelMonitorDailyRollupCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &ChannelMonitorDailyRollupCreateBulk{err: fmt.Errorf("calling to ChannelMonitorDailyRollupClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*ChannelMonitorDailyRollupCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &ChannelMonitorDailyRollupCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for ChannelMonitorDailyRollup.
- func (c *ChannelMonitorDailyRollupClient) Update() *ChannelMonitorDailyRollupUpdate {
- mutation := newChannelMonitorDailyRollupMutation(c.config, OpUpdate)
- return &ChannelMonitorDailyRollupUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *ChannelMonitorDailyRollupClient) UpdateOne(_m *ChannelMonitorDailyRollup) *ChannelMonitorDailyRollupUpdateOne {
- mutation := newChannelMonitorDailyRollupMutation(c.config, OpUpdateOne, withChannelMonitorDailyRollup(_m))
- return &ChannelMonitorDailyRollupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *ChannelMonitorDailyRollupClient) UpdateOneID(id int64) *ChannelMonitorDailyRollupUpdateOne {
- mutation := newChannelMonitorDailyRollupMutation(c.config, OpUpdateOne, withChannelMonitorDailyRollupID(id))
- return &ChannelMonitorDailyRollupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for ChannelMonitorDailyRollup.
- func (c *ChannelMonitorDailyRollupClient) Delete() *ChannelMonitorDailyRollupDelete {
- mutation := newChannelMonitorDailyRollupMutation(c.config, OpDelete)
- return &ChannelMonitorDailyRollupDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *ChannelMonitorDailyRollupClient) DeleteOne(_m *ChannelMonitorDailyRollup) *ChannelMonitorDailyRollupDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *ChannelMonitorDailyRollupClient) DeleteOneID(id int64) *ChannelMonitorDailyRollupDeleteOne {
- builder := c.Delete().Where(channelmonitordailyrollup.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &ChannelMonitorDailyRollupDeleteOne{builder}
- }
- // Query returns a query builder for ChannelMonitorDailyRollup.
- func (c *ChannelMonitorDailyRollupClient) Query() *ChannelMonitorDailyRollupQuery {
- return &ChannelMonitorDailyRollupQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeChannelMonitorDailyRollup},
- inters: c.Interceptors(),
- }
- }
- // Get returns a ChannelMonitorDailyRollup entity by its id.
- func (c *ChannelMonitorDailyRollupClient) Get(ctx context.Context, id int64) (*ChannelMonitorDailyRollup, error) {
- return c.Query().Where(channelmonitordailyrollup.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *ChannelMonitorDailyRollupClient) GetX(ctx context.Context, id int64) *ChannelMonitorDailyRollup {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryMonitor queries the monitor edge of a ChannelMonitorDailyRollup.
- func (c *ChannelMonitorDailyRollupClient) QueryMonitor(_m *ChannelMonitorDailyRollup) *ChannelMonitorQuery {
- query := (&ChannelMonitorClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(channelmonitordailyrollup.Table, channelmonitordailyrollup.FieldID, id),
- sqlgraph.To(channelmonitor.Table, channelmonitor.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, channelmonitordailyrollup.MonitorTable, channelmonitordailyrollup.MonitorColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *ChannelMonitorDailyRollupClient) Hooks() []Hook {
- return c.hooks.ChannelMonitorDailyRollup
- }
- // Interceptors returns the client interceptors.
- func (c *ChannelMonitorDailyRollupClient) Interceptors() []Interceptor {
- return c.inters.ChannelMonitorDailyRollup
- }
- func (c *ChannelMonitorDailyRollupClient) mutate(ctx context.Context, m *ChannelMonitorDailyRollupMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&ChannelMonitorDailyRollupCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&ChannelMonitorDailyRollupUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&ChannelMonitorDailyRollupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&ChannelMonitorDailyRollupDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown ChannelMonitorDailyRollup mutation op: %q", m.Op())
- }
- }
- // ChannelMonitorHistoryClient is a client for the ChannelMonitorHistory schema.
- type ChannelMonitorHistoryClient struct {
- config
- }
- // NewChannelMonitorHistoryClient returns a client for the ChannelMonitorHistory from the given config.
- func NewChannelMonitorHistoryClient(c config) *ChannelMonitorHistoryClient {
- return &ChannelMonitorHistoryClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `channelmonitorhistory.Hooks(f(g(h())))`.
- func (c *ChannelMonitorHistoryClient) Use(hooks ...Hook) {
- c.hooks.ChannelMonitorHistory = append(c.hooks.ChannelMonitorHistory, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `channelmonitorhistory.Intercept(f(g(h())))`.
- func (c *ChannelMonitorHistoryClient) Intercept(interceptors ...Interceptor) {
- c.inters.ChannelMonitorHistory = append(c.inters.ChannelMonitorHistory, interceptors...)
- }
- // Create returns a builder for creating a ChannelMonitorHistory entity.
- func (c *ChannelMonitorHistoryClient) Create() *ChannelMonitorHistoryCreate {
- mutation := newChannelMonitorHistoryMutation(c.config, OpCreate)
- return &ChannelMonitorHistoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of ChannelMonitorHistory entities.
- func (c *ChannelMonitorHistoryClient) CreateBulk(builders ...*ChannelMonitorHistoryCreate) *ChannelMonitorHistoryCreateBulk {
- return &ChannelMonitorHistoryCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *ChannelMonitorHistoryClient) MapCreateBulk(slice any, setFunc func(*ChannelMonitorHistoryCreate, int)) *ChannelMonitorHistoryCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &ChannelMonitorHistoryCreateBulk{err: fmt.Errorf("calling to ChannelMonitorHistoryClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*ChannelMonitorHistoryCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &ChannelMonitorHistoryCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for ChannelMonitorHistory.
- func (c *ChannelMonitorHistoryClient) Update() *ChannelMonitorHistoryUpdate {
- mutation := newChannelMonitorHistoryMutation(c.config, OpUpdate)
- return &ChannelMonitorHistoryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *ChannelMonitorHistoryClient) UpdateOne(_m *ChannelMonitorHistory) *ChannelMonitorHistoryUpdateOne {
- mutation := newChannelMonitorHistoryMutation(c.config, OpUpdateOne, withChannelMonitorHistory(_m))
- return &ChannelMonitorHistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *ChannelMonitorHistoryClient) UpdateOneID(id int64) *ChannelMonitorHistoryUpdateOne {
- mutation := newChannelMonitorHistoryMutation(c.config, OpUpdateOne, withChannelMonitorHistoryID(id))
- return &ChannelMonitorHistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for ChannelMonitorHistory.
- func (c *ChannelMonitorHistoryClient) Delete() *ChannelMonitorHistoryDelete {
- mutation := newChannelMonitorHistoryMutation(c.config, OpDelete)
- return &ChannelMonitorHistoryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *ChannelMonitorHistoryClient) DeleteOne(_m *ChannelMonitorHistory) *ChannelMonitorHistoryDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *ChannelMonitorHistoryClient) DeleteOneID(id int64) *ChannelMonitorHistoryDeleteOne {
- builder := c.Delete().Where(channelmonitorhistory.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &ChannelMonitorHistoryDeleteOne{builder}
- }
- // Query returns a query builder for ChannelMonitorHistory.
- func (c *ChannelMonitorHistoryClient) Query() *ChannelMonitorHistoryQuery {
- return &ChannelMonitorHistoryQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeChannelMonitorHistory},
- inters: c.Interceptors(),
- }
- }
- // Get returns a ChannelMonitorHistory entity by its id.
- func (c *ChannelMonitorHistoryClient) Get(ctx context.Context, id int64) (*ChannelMonitorHistory, error) {
- return c.Query().Where(channelmonitorhistory.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *ChannelMonitorHistoryClient) GetX(ctx context.Context, id int64) *ChannelMonitorHistory {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryMonitor queries the monitor edge of a ChannelMonitorHistory.
- func (c *ChannelMonitorHistoryClient) QueryMonitor(_m *ChannelMonitorHistory) *ChannelMonitorQuery {
- query := (&ChannelMonitorClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(channelmonitorhistory.Table, channelmonitorhistory.FieldID, id),
- sqlgraph.To(channelmonitor.Table, channelmonitor.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, channelmonitorhistory.MonitorTable, channelmonitorhistory.MonitorColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *ChannelMonitorHistoryClient) Hooks() []Hook {
- return c.hooks.ChannelMonitorHistory
- }
- // Interceptors returns the client interceptors.
- func (c *ChannelMonitorHistoryClient) Interceptors() []Interceptor {
- return c.inters.ChannelMonitorHistory
- }
- func (c *ChannelMonitorHistoryClient) mutate(ctx context.Context, m *ChannelMonitorHistoryMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&ChannelMonitorHistoryCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&ChannelMonitorHistoryUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&ChannelMonitorHistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&ChannelMonitorHistoryDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown ChannelMonitorHistory mutation op: %q", m.Op())
- }
- }
- // ChannelMonitorRequestTemplateClient is a client for the ChannelMonitorRequestTemplate schema.
- type ChannelMonitorRequestTemplateClient struct {
- config
- }
- // NewChannelMonitorRequestTemplateClient returns a client for the ChannelMonitorRequestTemplate from the given config.
- func NewChannelMonitorRequestTemplateClient(c config) *ChannelMonitorRequestTemplateClient {
- return &ChannelMonitorRequestTemplateClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `channelmonitorrequesttemplate.Hooks(f(g(h())))`.
- func (c *ChannelMonitorRequestTemplateClient) Use(hooks ...Hook) {
- c.hooks.ChannelMonitorRequestTemplate = append(c.hooks.ChannelMonitorRequestTemplate, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `channelmonitorrequesttemplate.Intercept(f(g(h())))`.
- func (c *ChannelMonitorRequestTemplateClient) Intercept(interceptors ...Interceptor) {
- c.inters.ChannelMonitorRequestTemplate = append(c.inters.ChannelMonitorRequestTemplate, interceptors...)
- }
- // Create returns a builder for creating a ChannelMonitorRequestTemplate entity.
- func (c *ChannelMonitorRequestTemplateClient) Create() *ChannelMonitorRequestTemplateCreate {
- mutation := newChannelMonitorRequestTemplateMutation(c.config, OpCreate)
- return &ChannelMonitorRequestTemplateCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of ChannelMonitorRequestTemplate entities.
- func (c *ChannelMonitorRequestTemplateClient) CreateBulk(builders ...*ChannelMonitorRequestTemplateCreate) *ChannelMonitorRequestTemplateCreateBulk {
- return &ChannelMonitorRequestTemplateCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *ChannelMonitorRequestTemplateClient) MapCreateBulk(slice any, setFunc func(*ChannelMonitorRequestTemplateCreate, int)) *ChannelMonitorRequestTemplateCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &ChannelMonitorRequestTemplateCreateBulk{err: fmt.Errorf("calling to ChannelMonitorRequestTemplateClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*ChannelMonitorRequestTemplateCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &ChannelMonitorRequestTemplateCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for ChannelMonitorRequestTemplate.
- func (c *ChannelMonitorRequestTemplateClient) Update() *ChannelMonitorRequestTemplateUpdate {
- mutation := newChannelMonitorRequestTemplateMutation(c.config, OpUpdate)
- return &ChannelMonitorRequestTemplateUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *ChannelMonitorRequestTemplateClient) UpdateOne(_m *ChannelMonitorRequestTemplate) *ChannelMonitorRequestTemplateUpdateOne {
- mutation := newChannelMonitorRequestTemplateMutation(c.config, OpUpdateOne, withChannelMonitorRequestTemplate(_m))
- return &ChannelMonitorRequestTemplateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *ChannelMonitorRequestTemplateClient) UpdateOneID(id int64) *ChannelMonitorRequestTemplateUpdateOne {
- mutation := newChannelMonitorRequestTemplateMutation(c.config, OpUpdateOne, withChannelMonitorRequestTemplateID(id))
- return &ChannelMonitorRequestTemplateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for ChannelMonitorRequestTemplate.
- func (c *ChannelMonitorRequestTemplateClient) Delete() *ChannelMonitorRequestTemplateDelete {
- mutation := newChannelMonitorRequestTemplateMutation(c.config, OpDelete)
- return &ChannelMonitorRequestTemplateDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *ChannelMonitorRequestTemplateClient) DeleteOne(_m *ChannelMonitorRequestTemplate) *ChannelMonitorRequestTemplateDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *ChannelMonitorRequestTemplateClient) DeleteOneID(id int64) *ChannelMonitorRequestTemplateDeleteOne {
- builder := c.Delete().Where(channelmonitorrequesttemplate.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &ChannelMonitorRequestTemplateDeleteOne{builder}
- }
- // Query returns a query builder for ChannelMonitorRequestTemplate.
- func (c *ChannelMonitorRequestTemplateClient) Query() *ChannelMonitorRequestTemplateQuery {
- return &ChannelMonitorRequestTemplateQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeChannelMonitorRequestTemplate},
- inters: c.Interceptors(),
- }
- }
- // Get returns a ChannelMonitorRequestTemplate entity by its id.
- func (c *ChannelMonitorRequestTemplateClient) Get(ctx context.Context, id int64) (*ChannelMonitorRequestTemplate, error) {
- return c.Query().Where(channelmonitorrequesttemplate.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *ChannelMonitorRequestTemplateClient) GetX(ctx context.Context, id int64) *ChannelMonitorRequestTemplate {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryMonitors queries the monitors edge of a ChannelMonitorRequestTemplate.
- func (c *ChannelMonitorRequestTemplateClient) QueryMonitors(_m *ChannelMonitorRequestTemplate) *ChannelMonitorQuery {
- query := (&ChannelMonitorClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(channelmonitorrequesttemplate.Table, channelmonitorrequesttemplate.FieldID, id),
- sqlgraph.To(channelmonitor.Table, channelmonitor.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, true, channelmonitorrequesttemplate.MonitorsTable, channelmonitorrequesttemplate.MonitorsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *ChannelMonitorRequestTemplateClient) Hooks() []Hook {
- return c.hooks.ChannelMonitorRequestTemplate
- }
- // Interceptors returns the client interceptors.
- func (c *ChannelMonitorRequestTemplateClient) Interceptors() []Interceptor {
- return c.inters.ChannelMonitorRequestTemplate
- }
- func (c *ChannelMonitorRequestTemplateClient) mutate(ctx context.Context, m *ChannelMonitorRequestTemplateMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&ChannelMonitorRequestTemplateCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&ChannelMonitorRequestTemplateUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&ChannelMonitorRequestTemplateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&ChannelMonitorRequestTemplateDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown ChannelMonitorRequestTemplate mutation op: %q", m.Op())
- }
- }
- // CompositeModelRouteClient is a client for the CompositeModelRoute schema.
- type CompositeModelRouteClient struct {
- config
- }
- // NewCompositeModelRouteClient returns a client for the CompositeModelRoute from the given config.
- func NewCompositeModelRouteClient(c config) *CompositeModelRouteClient {
- return &CompositeModelRouteClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `compositemodelroute.Hooks(f(g(h())))`.
- func (c *CompositeModelRouteClient) Use(hooks ...Hook) {
- c.hooks.CompositeModelRoute = append(c.hooks.CompositeModelRoute, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `compositemodelroute.Intercept(f(g(h())))`.
- func (c *CompositeModelRouteClient) Intercept(interceptors ...Interceptor) {
- c.inters.CompositeModelRoute = append(c.inters.CompositeModelRoute, interceptors...)
- }
- // Create returns a builder for creating a CompositeModelRoute entity.
- func (c *CompositeModelRouteClient) Create() *CompositeModelRouteCreate {
- mutation := newCompositeModelRouteMutation(c.config, OpCreate)
- return &CompositeModelRouteCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of CompositeModelRoute entities.
- func (c *CompositeModelRouteClient) CreateBulk(builders ...*CompositeModelRouteCreate) *CompositeModelRouteCreateBulk {
- return &CompositeModelRouteCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *CompositeModelRouteClient) MapCreateBulk(slice any, setFunc func(*CompositeModelRouteCreate, int)) *CompositeModelRouteCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &CompositeModelRouteCreateBulk{err: fmt.Errorf("calling to CompositeModelRouteClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*CompositeModelRouteCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &CompositeModelRouteCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for CompositeModelRoute.
- func (c *CompositeModelRouteClient) Update() *CompositeModelRouteUpdate {
- mutation := newCompositeModelRouteMutation(c.config, OpUpdate)
- return &CompositeModelRouteUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *CompositeModelRouteClient) UpdateOne(_m *CompositeModelRoute) *CompositeModelRouteUpdateOne {
- mutation := newCompositeModelRouteMutation(c.config, OpUpdateOne, withCompositeModelRoute(_m))
- return &CompositeModelRouteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *CompositeModelRouteClient) UpdateOneID(id int64) *CompositeModelRouteUpdateOne {
- mutation := newCompositeModelRouteMutation(c.config, OpUpdateOne, withCompositeModelRouteID(id))
- return &CompositeModelRouteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for CompositeModelRoute.
- func (c *CompositeModelRouteClient) Delete() *CompositeModelRouteDelete {
- mutation := newCompositeModelRouteMutation(c.config, OpDelete)
- return &CompositeModelRouteDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *CompositeModelRouteClient) DeleteOne(_m *CompositeModelRoute) *CompositeModelRouteDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *CompositeModelRouteClient) DeleteOneID(id int64) *CompositeModelRouteDeleteOne {
- builder := c.Delete().Where(compositemodelroute.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &CompositeModelRouteDeleteOne{builder}
- }
- // Query returns a query builder for CompositeModelRoute.
- func (c *CompositeModelRouteClient) Query() *CompositeModelRouteQuery {
- return &CompositeModelRouteQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeCompositeModelRoute},
- inters: c.Interceptors(),
- }
- }
- // Get returns a CompositeModelRoute entity by its id.
- func (c *CompositeModelRouteClient) Get(ctx context.Context, id int64) (*CompositeModelRoute, error) {
- return c.Query().Where(compositemodelroute.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *CompositeModelRouteClient) GetX(ctx context.Context, id int64) *CompositeModelRoute {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryGroup queries the group edge of a CompositeModelRoute.
- func (c *CompositeModelRouteClient) QueryGroup(_m *CompositeModelRoute) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(compositemodelroute.Table, compositemodelroute.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, compositemodelroute.GroupTable, compositemodelroute.GroupColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *CompositeModelRouteClient) Hooks() []Hook {
- hooks := c.hooks.CompositeModelRoute
- return append(hooks[:len(hooks):len(hooks)], compositemodelroute.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *CompositeModelRouteClient) Interceptors() []Interceptor {
- inters := c.inters.CompositeModelRoute
- return append(inters[:len(inters):len(inters)], compositemodelroute.Interceptors[:]...)
- }
- func (c *CompositeModelRouteClient) mutate(ctx context.Context, m *CompositeModelRouteMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&CompositeModelRouteCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&CompositeModelRouteUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&CompositeModelRouteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&CompositeModelRouteDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown CompositeModelRoute mutation op: %q", m.Op())
- }
- }
- // ErrorPassthroughRuleClient is a client for the ErrorPassthroughRule schema.
- type ErrorPassthroughRuleClient struct {
- config
- }
- // NewErrorPassthroughRuleClient returns a client for the ErrorPassthroughRule from the given config.
- func NewErrorPassthroughRuleClient(c config) *ErrorPassthroughRuleClient {
- return &ErrorPassthroughRuleClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `errorpassthroughrule.Hooks(f(g(h())))`.
- func (c *ErrorPassthroughRuleClient) Use(hooks ...Hook) {
- c.hooks.ErrorPassthroughRule = append(c.hooks.ErrorPassthroughRule, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `errorpassthroughrule.Intercept(f(g(h())))`.
- func (c *ErrorPassthroughRuleClient) Intercept(interceptors ...Interceptor) {
- c.inters.ErrorPassthroughRule = append(c.inters.ErrorPassthroughRule, interceptors...)
- }
- // Create returns a builder for creating a ErrorPassthroughRule entity.
- func (c *ErrorPassthroughRuleClient) Create() *ErrorPassthroughRuleCreate {
- mutation := newErrorPassthroughRuleMutation(c.config, OpCreate)
- return &ErrorPassthroughRuleCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of ErrorPassthroughRule entities.
- func (c *ErrorPassthroughRuleClient) CreateBulk(builders ...*ErrorPassthroughRuleCreate) *ErrorPassthroughRuleCreateBulk {
- return &ErrorPassthroughRuleCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *ErrorPassthroughRuleClient) MapCreateBulk(slice any, setFunc func(*ErrorPassthroughRuleCreate, int)) *ErrorPassthroughRuleCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &ErrorPassthroughRuleCreateBulk{err: fmt.Errorf("calling to ErrorPassthroughRuleClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*ErrorPassthroughRuleCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &ErrorPassthroughRuleCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for ErrorPassthroughRule.
- func (c *ErrorPassthroughRuleClient) Update() *ErrorPassthroughRuleUpdate {
- mutation := newErrorPassthroughRuleMutation(c.config, OpUpdate)
- return &ErrorPassthroughRuleUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *ErrorPassthroughRuleClient) UpdateOne(_m *ErrorPassthroughRule) *ErrorPassthroughRuleUpdateOne {
- mutation := newErrorPassthroughRuleMutation(c.config, OpUpdateOne, withErrorPassthroughRule(_m))
- return &ErrorPassthroughRuleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *ErrorPassthroughRuleClient) UpdateOneID(id int64) *ErrorPassthroughRuleUpdateOne {
- mutation := newErrorPassthroughRuleMutation(c.config, OpUpdateOne, withErrorPassthroughRuleID(id))
- return &ErrorPassthroughRuleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for ErrorPassthroughRule.
- func (c *ErrorPassthroughRuleClient) Delete() *ErrorPassthroughRuleDelete {
- mutation := newErrorPassthroughRuleMutation(c.config, OpDelete)
- return &ErrorPassthroughRuleDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *ErrorPassthroughRuleClient) DeleteOne(_m *ErrorPassthroughRule) *ErrorPassthroughRuleDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *ErrorPassthroughRuleClient) DeleteOneID(id int64) *ErrorPassthroughRuleDeleteOne {
- builder := c.Delete().Where(errorpassthroughrule.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &ErrorPassthroughRuleDeleteOne{builder}
- }
- // Query returns a query builder for ErrorPassthroughRule.
- func (c *ErrorPassthroughRuleClient) Query() *ErrorPassthroughRuleQuery {
- return &ErrorPassthroughRuleQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeErrorPassthroughRule},
- inters: c.Interceptors(),
- }
- }
- // Get returns a ErrorPassthroughRule entity by its id.
- func (c *ErrorPassthroughRuleClient) Get(ctx context.Context, id int64) (*ErrorPassthroughRule, error) {
- return c.Query().Where(errorpassthroughrule.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *ErrorPassthroughRuleClient) GetX(ctx context.Context, id int64) *ErrorPassthroughRule {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *ErrorPassthroughRuleClient) Hooks() []Hook {
- return c.hooks.ErrorPassthroughRule
- }
- // Interceptors returns the client interceptors.
- func (c *ErrorPassthroughRuleClient) Interceptors() []Interceptor {
- return c.inters.ErrorPassthroughRule
- }
- func (c *ErrorPassthroughRuleClient) mutate(ctx context.Context, m *ErrorPassthroughRuleMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&ErrorPassthroughRuleCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&ErrorPassthroughRuleUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&ErrorPassthroughRuleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&ErrorPassthroughRuleDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown ErrorPassthroughRule mutation op: %q", m.Op())
- }
- }
- // GroupClient is a client for the Group schema.
- type GroupClient struct {
- config
- }
- // NewGroupClient returns a client for the Group from the given config.
- func NewGroupClient(c config) *GroupClient {
- return &GroupClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `group.Hooks(f(g(h())))`.
- func (c *GroupClient) Use(hooks ...Hook) {
- c.hooks.Group = append(c.hooks.Group, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `group.Intercept(f(g(h())))`.
- func (c *GroupClient) Intercept(interceptors ...Interceptor) {
- c.inters.Group = append(c.inters.Group, interceptors...)
- }
- // Create returns a builder for creating a Group entity.
- func (c *GroupClient) Create() *GroupCreate {
- mutation := newGroupMutation(c.config, OpCreate)
- return &GroupCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of Group entities.
- func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk {
- return &GroupCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *GroupClient) MapCreateBulk(slice any, setFunc func(*GroupCreate, int)) *GroupCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &GroupCreateBulk{err: fmt.Errorf("calling to GroupClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*GroupCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &GroupCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for Group.
- func (c *GroupClient) Update() *GroupUpdate {
- mutation := newGroupMutation(c.config, OpUpdate)
- return &GroupUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *GroupClient) UpdateOne(_m *Group) *GroupUpdateOne {
- mutation := newGroupMutation(c.config, OpUpdateOne, withGroup(_m))
- return &GroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *GroupClient) UpdateOneID(id int64) *GroupUpdateOne {
- mutation := newGroupMutation(c.config, OpUpdateOne, withGroupID(id))
- return &GroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for Group.
- func (c *GroupClient) Delete() *GroupDelete {
- mutation := newGroupMutation(c.config, OpDelete)
- return &GroupDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *GroupClient) DeleteOne(_m *Group) *GroupDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *GroupClient) DeleteOneID(id int64) *GroupDeleteOne {
- builder := c.Delete().Where(group.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &GroupDeleteOne{builder}
- }
- // Query returns a query builder for Group.
- func (c *GroupClient) Query() *GroupQuery {
- return &GroupQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeGroup},
- inters: c.Interceptors(),
- }
- }
- // Get returns a Group entity by its id.
- func (c *GroupClient) Get(ctx context.Context, id int64) (*Group, error) {
- return c.Query().Where(group.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *GroupClient) GetX(ctx context.Context, id int64) *Group {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryAPIKeys queries the api_keys edge of a Group.
- func (c *GroupClient) QueryAPIKeys(_m *Group) *APIKeyQuery {
- query := (&APIKeyClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(apikey.Table, apikey.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, group.APIKeysTable, group.APIKeysColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryRedeemCodes queries the redeem_codes edge of a Group.
- func (c *GroupClient) QueryRedeemCodes(_m *Group) *RedeemCodeQuery {
- query := (&RedeemCodeClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(redeemcode.Table, redeemcode.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, group.RedeemCodesTable, group.RedeemCodesColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QuerySubscriptions queries the subscriptions edge of a Group.
- func (c *GroupClient) QuerySubscriptions(_m *Group) *UserSubscriptionQuery {
- query := (&UserSubscriptionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(usersubscription.Table, usersubscription.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, group.SubscriptionsTable, group.SubscriptionsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUsageLogs queries the usage_logs edge of a Group.
- func (c *GroupClient) QueryUsageLogs(_m *Group) *UsageLogQuery {
- query := (&UsageLogClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(usagelog.Table, usagelog.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, group.UsageLogsTable, group.UsageLogsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAccounts queries the accounts edge of a Group.
- func (c *GroupClient) QueryAccounts(_m *Group) *AccountQuery {
- query := (&AccountClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(account.Table, account.FieldID),
- sqlgraph.Edge(sqlgraph.M2M, true, group.AccountsTable, group.AccountsPrimaryKey...),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAllowedUsers queries the allowed_users edge of a Group.
- func (c *GroupClient) QueryAllowedUsers(_m *Group) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2M, true, group.AllowedUsersTable, group.AllowedUsersPrimaryKey...),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAccountGroups queries the account_groups edge of a Group.
- func (c *GroupClient) QueryAccountGroups(_m *Group) *AccountGroupQuery {
- query := (&AccountGroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(accountgroup.Table, accountgroup.GroupColumn),
- sqlgraph.Edge(sqlgraph.O2M, true, group.AccountGroupsTable, group.AccountGroupsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUserAllowedGroups queries the user_allowed_groups edge of a Group.
- func (c *GroupClient) QueryUserAllowedGroups(_m *Group) *UserAllowedGroupQuery {
- query := (&UserAllowedGroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(group.Table, group.FieldID, id),
- sqlgraph.To(userallowedgroup.Table, userallowedgroup.GroupColumn),
- sqlgraph.Edge(sqlgraph.O2M, true, group.UserAllowedGroupsTable, group.UserAllowedGroupsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *GroupClient) Hooks() []Hook {
- hooks := c.hooks.Group
- return append(hooks[:len(hooks):len(hooks)], group.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *GroupClient) Interceptors() []Interceptor {
- inters := c.inters.Group
- return append(inters[:len(inters):len(inters)], group.Interceptors[:]...)
- }
- func (c *GroupClient) mutate(ctx context.Context, m *GroupMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&GroupCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&GroupUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&GroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&GroupDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown Group mutation op: %q", m.Op())
- }
- }
- // IdempotencyRecordClient is a client for the IdempotencyRecord schema.
- type IdempotencyRecordClient struct {
- config
- }
- // NewIdempotencyRecordClient returns a client for the IdempotencyRecord from the given config.
- func NewIdempotencyRecordClient(c config) *IdempotencyRecordClient {
- return &IdempotencyRecordClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `idempotencyrecord.Hooks(f(g(h())))`.
- func (c *IdempotencyRecordClient) Use(hooks ...Hook) {
- c.hooks.IdempotencyRecord = append(c.hooks.IdempotencyRecord, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `idempotencyrecord.Intercept(f(g(h())))`.
- func (c *IdempotencyRecordClient) Intercept(interceptors ...Interceptor) {
- c.inters.IdempotencyRecord = append(c.inters.IdempotencyRecord, interceptors...)
- }
- // Create returns a builder for creating a IdempotencyRecord entity.
- func (c *IdempotencyRecordClient) Create() *IdempotencyRecordCreate {
- mutation := newIdempotencyRecordMutation(c.config, OpCreate)
- return &IdempotencyRecordCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of IdempotencyRecord entities.
- func (c *IdempotencyRecordClient) CreateBulk(builders ...*IdempotencyRecordCreate) *IdempotencyRecordCreateBulk {
- return &IdempotencyRecordCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *IdempotencyRecordClient) MapCreateBulk(slice any, setFunc func(*IdempotencyRecordCreate, int)) *IdempotencyRecordCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &IdempotencyRecordCreateBulk{err: fmt.Errorf("calling to IdempotencyRecordClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*IdempotencyRecordCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &IdempotencyRecordCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for IdempotencyRecord.
- func (c *IdempotencyRecordClient) Update() *IdempotencyRecordUpdate {
- mutation := newIdempotencyRecordMutation(c.config, OpUpdate)
- return &IdempotencyRecordUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *IdempotencyRecordClient) UpdateOne(_m *IdempotencyRecord) *IdempotencyRecordUpdateOne {
- mutation := newIdempotencyRecordMutation(c.config, OpUpdateOne, withIdempotencyRecord(_m))
- return &IdempotencyRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *IdempotencyRecordClient) UpdateOneID(id int64) *IdempotencyRecordUpdateOne {
- mutation := newIdempotencyRecordMutation(c.config, OpUpdateOne, withIdempotencyRecordID(id))
- return &IdempotencyRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for IdempotencyRecord.
- func (c *IdempotencyRecordClient) Delete() *IdempotencyRecordDelete {
- mutation := newIdempotencyRecordMutation(c.config, OpDelete)
- return &IdempotencyRecordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *IdempotencyRecordClient) DeleteOne(_m *IdempotencyRecord) *IdempotencyRecordDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *IdempotencyRecordClient) DeleteOneID(id int64) *IdempotencyRecordDeleteOne {
- builder := c.Delete().Where(idempotencyrecord.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &IdempotencyRecordDeleteOne{builder}
- }
- // Query returns a query builder for IdempotencyRecord.
- func (c *IdempotencyRecordClient) Query() *IdempotencyRecordQuery {
- return &IdempotencyRecordQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeIdempotencyRecord},
- inters: c.Interceptors(),
- }
- }
- // Get returns a IdempotencyRecord entity by its id.
- func (c *IdempotencyRecordClient) Get(ctx context.Context, id int64) (*IdempotencyRecord, error) {
- return c.Query().Where(idempotencyrecord.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *IdempotencyRecordClient) GetX(ctx context.Context, id int64) *IdempotencyRecord {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *IdempotencyRecordClient) Hooks() []Hook {
- return c.hooks.IdempotencyRecord
- }
- // Interceptors returns the client interceptors.
- func (c *IdempotencyRecordClient) Interceptors() []Interceptor {
- return c.inters.IdempotencyRecord
- }
- func (c *IdempotencyRecordClient) mutate(ctx context.Context, m *IdempotencyRecordMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&IdempotencyRecordCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&IdempotencyRecordUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&IdempotencyRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&IdempotencyRecordDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown IdempotencyRecord mutation op: %q", m.Op())
- }
- }
- // IdentityAdoptionDecisionClient is a client for the IdentityAdoptionDecision schema.
- type IdentityAdoptionDecisionClient struct {
- config
- }
- // NewIdentityAdoptionDecisionClient returns a client for the IdentityAdoptionDecision from the given config.
- func NewIdentityAdoptionDecisionClient(c config) *IdentityAdoptionDecisionClient {
- return &IdentityAdoptionDecisionClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `identityadoptiondecision.Hooks(f(g(h())))`.
- func (c *IdentityAdoptionDecisionClient) Use(hooks ...Hook) {
- c.hooks.IdentityAdoptionDecision = append(c.hooks.IdentityAdoptionDecision, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `identityadoptiondecision.Intercept(f(g(h())))`.
- func (c *IdentityAdoptionDecisionClient) Intercept(interceptors ...Interceptor) {
- c.inters.IdentityAdoptionDecision = append(c.inters.IdentityAdoptionDecision, interceptors...)
- }
- // Create returns a builder for creating a IdentityAdoptionDecision entity.
- func (c *IdentityAdoptionDecisionClient) Create() *IdentityAdoptionDecisionCreate {
- mutation := newIdentityAdoptionDecisionMutation(c.config, OpCreate)
- return &IdentityAdoptionDecisionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of IdentityAdoptionDecision entities.
- func (c *IdentityAdoptionDecisionClient) CreateBulk(builders ...*IdentityAdoptionDecisionCreate) *IdentityAdoptionDecisionCreateBulk {
- return &IdentityAdoptionDecisionCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *IdentityAdoptionDecisionClient) MapCreateBulk(slice any, setFunc func(*IdentityAdoptionDecisionCreate, int)) *IdentityAdoptionDecisionCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &IdentityAdoptionDecisionCreateBulk{err: fmt.Errorf("calling to IdentityAdoptionDecisionClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*IdentityAdoptionDecisionCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &IdentityAdoptionDecisionCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for IdentityAdoptionDecision.
- func (c *IdentityAdoptionDecisionClient) Update() *IdentityAdoptionDecisionUpdate {
- mutation := newIdentityAdoptionDecisionMutation(c.config, OpUpdate)
- return &IdentityAdoptionDecisionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *IdentityAdoptionDecisionClient) UpdateOne(_m *IdentityAdoptionDecision) *IdentityAdoptionDecisionUpdateOne {
- mutation := newIdentityAdoptionDecisionMutation(c.config, OpUpdateOne, withIdentityAdoptionDecision(_m))
- return &IdentityAdoptionDecisionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *IdentityAdoptionDecisionClient) UpdateOneID(id int64) *IdentityAdoptionDecisionUpdateOne {
- mutation := newIdentityAdoptionDecisionMutation(c.config, OpUpdateOne, withIdentityAdoptionDecisionID(id))
- return &IdentityAdoptionDecisionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for IdentityAdoptionDecision.
- func (c *IdentityAdoptionDecisionClient) Delete() *IdentityAdoptionDecisionDelete {
- mutation := newIdentityAdoptionDecisionMutation(c.config, OpDelete)
- return &IdentityAdoptionDecisionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *IdentityAdoptionDecisionClient) DeleteOne(_m *IdentityAdoptionDecision) *IdentityAdoptionDecisionDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *IdentityAdoptionDecisionClient) DeleteOneID(id int64) *IdentityAdoptionDecisionDeleteOne {
- builder := c.Delete().Where(identityadoptiondecision.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &IdentityAdoptionDecisionDeleteOne{builder}
- }
- // Query returns a query builder for IdentityAdoptionDecision.
- func (c *IdentityAdoptionDecisionClient) Query() *IdentityAdoptionDecisionQuery {
- return &IdentityAdoptionDecisionQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeIdentityAdoptionDecision},
- inters: c.Interceptors(),
- }
- }
- // Get returns a IdentityAdoptionDecision entity by its id.
- func (c *IdentityAdoptionDecisionClient) Get(ctx context.Context, id int64) (*IdentityAdoptionDecision, error) {
- return c.Query().Where(identityadoptiondecision.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *IdentityAdoptionDecisionClient) GetX(ctx context.Context, id int64) *IdentityAdoptionDecision {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryPendingAuthSession queries the pending_auth_session edge of a IdentityAdoptionDecision.
- func (c *IdentityAdoptionDecisionClient) QueryPendingAuthSession(_m *IdentityAdoptionDecision) *PendingAuthSessionQuery {
- query := (&PendingAuthSessionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(identityadoptiondecision.Table, identityadoptiondecision.FieldID, id),
- sqlgraph.To(pendingauthsession.Table, pendingauthsession.FieldID),
- sqlgraph.Edge(sqlgraph.O2O, true, identityadoptiondecision.PendingAuthSessionTable, identityadoptiondecision.PendingAuthSessionColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryIdentity queries the identity edge of a IdentityAdoptionDecision.
- func (c *IdentityAdoptionDecisionClient) QueryIdentity(_m *IdentityAdoptionDecision) *AuthIdentityQuery {
- query := (&AuthIdentityClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(identityadoptiondecision.Table, identityadoptiondecision.FieldID, id),
- sqlgraph.To(authidentity.Table, authidentity.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, identityadoptiondecision.IdentityTable, identityadoptiondecision.IdentityColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *IdentityAdoptionDecisionClient) Hooks() []Hook {
- return c.hooks.IdentityAdoptionDecision
- }
- // Interceptors returns the client interceptors.
- func (c *IdentityAdoptionDecisionClient) Interceptors() []Interceptor {
- return c.inters.IdentityAdoptionDecision
- }
- func (c *IdentityAdoptionDecisionClient) mutate(ctx context.Context, m *IdentityAdoptionDecisionMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&IdentityAdoptionDecisionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&IdentityAdoptionDecisionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&IdentityAdoptionDecisionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&IdentityAdoptionDecisionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown IdentityAdoptionDecision mutation op: %q", m.Op())
- }
- }
- // PaymentAuditLogClient is a client for the PaymentAuditLog schema.
- type PaymentAuditLogClient struct {
- config
- }
- // NewPaymentAuditLogClient returns a client for the PaymentAuditLog from the given config.
- func NewPaymentAuditLogClient(c config) *PaymentAuditLogClient {
- return &PaymentAuditLogClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `paymentauditlog.Hooks(f(g(h())))`.
- func (c *PaymentAuditLogClient) Use(hooks ...Hook) {
- c.hooks.PaymentAuditLog = append(c.hooks.PaymentAuditLog, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `paymentauditlog.Intercept(f(g(h())))`.
- func (c *PaymentAuditLogClient) Intercept(interceptors ...Interceptor) {
- c.inters.PaymentAuditLog = append(c.inters.PaymentAuditLog, interceptors...)
- }
- // Create returns a builder for creating a PaymentAuditLog entity.
- func (c *PaymentAuditLogClient) Create() *PaymentAuditLogCreate {
- mutation := newPaymentAuditLogMutation(c.config, OpCreate)
- return &PaymentAuditLogCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of PaymentAuditLog entities.
- func (c *PaymentAuditLogClient) CreateBulk(builders ...*PaymentAuditLogCreate) *PaymentAuditLogCreateBulk {
- return &PaymentAuditLogCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *PaymentAuditLogClient) MapCreateBulk(slice any, setFunc func(*PaymentAuditLogCreate, int)) *PaymentAuditLogCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &PaymentAuditLogCreateBulk{err: fmt.Errorf("calling to PaymentAuditLogClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*PaymentAuditLogCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &PaymentAuditLogCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for PaymentAuditLog.
- func (c *PaymentAuditLogClient) Update() *PaymentAuditLogUpdate {
- mutation := newPaymentAuditLogMutation(c.config, OpUpdate)
- return &PaymentAuditLogUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *PaymentAuditLogClient) UpdateOne(_m *PaymentAuditLog) *PaymentAuditLogUpdateOne {
- mutation := newPaymentAuditLogMutation(c.config, OpUpdateOne, withPaymentAuditLog(_m))
- return &PaymentAuditLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *PaymentAuditLogClient) UpdateOneID(id int64) *PaymentAuditLogUpdateOne {
- mutation := newPaymentAuditLogMutation(c.config, OpUpdateOne, withPaymentAuditLogID(id))
- return &PaymentAuditLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for PaymentAuditLog.
- func (c *PaymentAuditLogClient) Delete() *PaymentAuditLogDelete {
- mutation := newPaymentAuditLogMutation(c.config, OpDelete)
- return &PaymentAuditLogDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *PaymentAuditLogClient) DeleteOne(_m *PaymentAuditLog) *PaymentAuditLogDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *PaymentAuditLogClient) DeleteOneID(id int64) *PaymentAuditLogDeleteOne {
- builder := c.Delete().Where(paymentauditlog.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &PaymentAuditLogDeleteOne{builder}
- }
- // Query returns a query builder for PaymentAuditLog.
- func (c *PaymentAuditLogClient) Query() *PaymentAuditLogQuery {
- return &PaymentAuditLogQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypePaymentAuditLog},
- inters: c.Interceptors(),
- }
- }
- // Get returns a PaymentAuditLog entity by its id.
- func (c *PaymentAuditLogClient) Get(ctx context.Context, id int64) (*PaymentAuditLog, error) {
- return c.Query().Where(paymentauditlog.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *PaymentAuditLogClient) GetX(ctx context.Context, id int64) *PaymentAuditLog {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *PaymentAuditLogClient) Hooks() []Hook {
- return c.hooks.PaymentAuditLog
- }
- // Interceptors returns the client interceptors.
- func (c *PaymentAuditLogClient) Interceptors() []Interceptor {
- return c.inters.PaymentAuditLog
- }
- func (c *PaymentAuditLogClient) mutate(ctx context.Context, m *PaymentAuditLogMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&PaymentAuditLogCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&PaymentAuditLogUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&PaymentAuditLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&PaymentAuditLogDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown PaymentAuditLog mutation op: %q", m.Op())
- }
- }
- // PaymentOrderClient is a client for the PaymentOrder schema.
- type PaymentOrderClient struct {
- config
- }
- // NewPaymentOrderClient returns a client for the PaymentOrder from the given config.
- func NewPaymentOrderClient(c config) *PaymentOrderClient {
- return &PaymentOrderClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `paymentorder.Hooks(f(g(h())))`.
- func (c *PaymentOrderClient) Use(hooks ...Hook) {
- c.hooks.PaymentOrder = append(c.hooks.PaymentOrder, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `paymentorder.Intercept(f(g(h())))`.
- func (c *PaymentOrderClient) Intercept(interceptors ...Interceptor) {
- c.inters.PaymentOrder = append(c.inters.PaymentOrder, interceptors...)
- }
- // Create returns a builder for creating a PaymentOrder entity.
- func (c *PaymentOrderClient) Create() *PaymentOrderCreate {
- mutation := newPaymentOrderMutation(c.config, OpCreate)
- return &PaymentOrderCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of PaymentOrder entities.
- func (c *PaymentOrderClient) CreateBulk(builders ...*PaymentOrderCreate) *PaymentOrderCreateBulk {
- return &PaymentOrderCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *PaymentOrderClient) MapCreateBulk(slice any, setFunc func(*PaymentOrderCreate, int)) *PaymentOrderCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &PaymentOrderCreateBulk{err: fmt.Errorf("calling to PaymentOrderClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*PaymentOrderCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &PaymentOrderCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for PaymentOrder.
- func (c *PaymentOrderClient) Update() *PaymentOrderUpdate {
- mutation := newPaymentOrderMutation(c.config, OpUpdate)
- return &PaymentOrderUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *PaymentOrderClient) UpdateOne(_m *PaymentOrder) *PaymentOrderUpdateOne {
- mutation := newPaymentOrderMutation(c.config, OpUpdateOne, withPaymentOrder(_m))
- return &PaymentOrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *PaymentOrderClient) UpdateOneID(id int64) *PaymentOrderUpdateOne {
- mutation := newPaymentOrderMutation(c.config, OpUpdateOne, withPaymentOrderID(id))
- return &PaymentOrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for PaymentOrder.
- func (c *PaymentOrderClient) Delete() *PaymentOrderDelete {
- mutation := newPaymentOrderMutation(c.config, OpDelete)
- return &PaymentOrderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *PaymentOrderClient) DeleteOne(_m *PaymentOrder) *PaymentOrderDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *PaymentOrderClient) DeleteOneID(id int64) *PaymentOrderDeleteOne {
- builder := c.Delete().Where(paymentorder.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &PaymentOrderDeleteOne{builder}
- }
- // Query returns a query builder for PaymentOrder.
- func (c *PaymentOrderClient) Query() *PaymentOrderQuery {
- return &PaymentOrderQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypePaymentOrder},
- inters: c.Interceptors(),
- }
- }
- // Get returns a PaymentOrder entity by its id.
- func (c *PaymentOrderClient) Get(ctx context.Context, id int64) (*PaymentOrder, error) {
- return c.Query().Where(paymentorder.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *PaymentOrderClient) GetX(ctx context.Context, id int64) *PaymentOrder {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a PaymentOrder.
- func (c *PaymentOrderClient) QueryUser(_m *PaymentOrder) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(paymentorder.Table, paymentorder.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, paymentorder.UserTable, paymentorder.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *PaymentOrderClient) Hooks() []Hook {
- return c.hooks.PaymentOrder
- }
- // Interceptors returns the client interceptors.
- func (c *PaymentOrderClient) Interceptors() []Interceptor {
- return c.inters.PaymentOrder
- }
- func (c *PaymentOrderClient) mutate(ctx context.Context, m *PaymentOrderMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&PaymentOrderCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&PaymentOrderUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&PaymentOrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&PaymentOrderDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown PaymentOrder mutation op: %q", m.Op())
- }
- }
- // PaymentProviderInstanceClient is a client for the PaymentProviderInstance schema.
- type PaymentProviderInstanceClient struct {
- config
- }
- // NewPaymentProviderInstanceClient returns a client for the PaymentProviderInstance from the given config.
- func NewPaymentProviderInstanceClient(c config) *PaymentProviderInstanceClient {
- return &PaymentProviderInstanceClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `paymentproviderinstance.Hooks(f(g(h())))`.
- func (c *PaymentProviderInstanceClient) Use(hooks ...Hook) {
- c.hooks.PaymentProviderInstance = append(c.hooks.PaymentProviderInstance, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `paymentproviderinstance.Intercept(f(g(h())))`.
- func (c *PaymentProviderInstanceClient) Intercept(interceptors ...Interceptor) {
- c.inters.PaymentProviderInstance = append(c.inters.PaymentProviderInstance, interceptors...)
- }
- // Create returns a builder for creating a PaymentProviderInstance entity.
- func (c *PaymentProviderInstanceClient) Create() *PaymentProviderInstanceCreate {
- mutation := newPaymentProviderInstanceMutation(c.config, OpCreate)
- return &PaymentProviderInstanceCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of PaymentProviderInstance entities.
- func (c *PaymentProviderInstanceClient) CreateBulk(builders ...*PaymentProviderInstanceCreate) *PaymentProviderInstanceCreateBulk {
- return &PaymentProviderInstanceCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *PaymentProviderInstanceClient) MapCreateBulk(slice any, setFunc func(*PaymentProviderInstanceCreate, int)) *PaymentProviderInstanceCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &PaymentProviderInstanceCreateBulk{err: fmt.Errorf("calling to PaymentProviderInstanceClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*PaymentProviderInstanceCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &PaymentProviderInstanceCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for PaymentProviderInstance.
- func (c *PaymentProviderInstanceClient) Update() *PaymentProviderInstanceUpdate {
- mutation := newPaymentProviderInstanceMutation(c.config, OpUpdate)
- return &PaymentProviderInstanceUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *PaymentProviderInstanceClient) UpdateOne(_m *PaymentProviderInstance) *PaymentProviderInstanceUpdateOne {
- mutation := newPaymentProviderInstanceMutation(c.config, OpUpdateOne, withPaymentProviderInstance(_m))
- return &PaymentProviderInstanceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *PaymentProviderInstanceClient) UpdateOneID(id int64) *PaymentProviderInstanceUpdateOne {
- mutation := newPaymentProviderInstanceMutation(c.config, OpUpdateOne, withPaymentProviderInstanceID(id))
- return &PaymentProviderInstanceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for PaymentProviderInstance.
- func (c *PaymentProviderInstanceClient) Delete() *PaymentProviderInstanceDelete {
- mutation := newPaymentProviderInstanceMutation(c.config, OpDelete)
- return &PaymentProviderInstanceDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *PaymentProviderInstanceClient) DeleteOne(_m *PaymentProviderInstance) *PaymentProviderInstanceDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *PaymentProviderInstanceClient) DeleteOneID(id int64) *PaymentProviderInstanceDeleteOne {
- builder := c.Delete().Where(paymentproviderinstance.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &PaymentProviderInstanceDeleteOne{builder}
- }
- // Query returns a query builder for PaymentProviderInstance.
- func (c *PaymentProviderInstanceClient) Query() *PaymentProviderInstanceQuery {
- return &PaymentProviderInstanceQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypePaymentProviderInstance},
- inters: c.Interceptors(),
- }
- }
- // Get returns a PaymentProviderInstance entity by its id.
- func (c *PaymentProviderInstanceClient) Get(ctx context.Context, id int64) (*PaymentProviderInstance, error) {
- return c.Query().Where(paymentproviderinstance.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *PaymentProviderInstanceClient) GetX(ctx context.Context, id int64) *PaymentProviderInstance {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *PaymentProviderInstanceClient) Hooks() []Hook {
- return c.hooks.PaymentProviderInstance
- }
- // Interceptors returns the client interceptors.
- func (c *PaymentProviderInstanceClient) Interceptors() []Interceptor {
- return c.inters.PaymentProviderInstance
- }
- func (c *PaymentProviderInstanceClient) mutate(ctx context.Context, m *PaymentProviderInstanceMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&PaymentProviderInstanceCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&PaymentProviderInstanceUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&PaymentProviderInstanceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&PaymentProviderInstanceDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown PaymentProviderInstance mutation op: %q", m.Op())
- }
- }
- // PendingAuthSessionClient is a client for the PendingAuthSession schema.
- type PendingAuthSessionClient struct {
- config
- }
- // NewPendingAuthSessionClient returns a client for the PendingAuthSession from the given config.
- func NewPendingAuthSessionClient(c config) *PendingAuthSessionClient {
- return &PendingAuthSessionClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `pendingauthsession.Hooks(f(g(h())))`.
- func (c *PendingAuthSessionClient) Use(hooks ...Hook) {
- c.hooks.PendingAuthSession = append(c.hooks.PendingAuthSession, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `pendingauthsession.Intercept(f(g(h())))`.
- func (c *PendingAuthSessionClient) Intercept(interceptors ...Interceptor) {
- c.inters.PendingAuthSession = append(c.inters.PendingAuthSession, interceptors...)
- }
- // Create returns a builder for creating a PendingAuthSession entity.
- func (c *PendingAuthSessionClient) Create() *PendingAuthSessionCreate {
- mutation := newPendingAuthSessionMutation(c.config, OpCreate)
- return &PendingAuthSessionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of PendingAuthSession entities.
- func (c *PendingAuthSessionClient) CreateBulk(builders ...*PendingAuthSessionCreate) *PendingAuthSessionCreateBulk {
- return &PendingAuthSessionCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *PendingAuthSessionClient) MapCreateBulk(slice any, setFunc func(*PendingAuthSessionCreate, int)) *PendingAuthSessionCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &PendingAuthSessionCreateBulk{err: fmt.Errorf("calling to PendingAuthSessionClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*PendingAuthSessionCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &PendingAuthSessionCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for PendingAuthSession.
- func (c *PendingAuthSessionClient) Update() *PendingAuthSessionUpdate {
- mutation := newPendingAuthSessionMutation(c.config, OpUpdate)
- return &PendingAuthSessionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *PendingAuthSessionClient) UpdateOne(_m *PendingAuthSession) *PendingAuthSessionUpdateOne {
- mutation := newPendingAuthSessionMutation(c.config, OpUpdateOne, withPendingAuthSession(_m))
- return &PendingAuthSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *PendingAuthSessionClient) UpdateOneID(id int64) *PendingAuthSessionUpdateOne {
- mutation := newPendingAuthSessionMutation(c.config, OpUpdateOne, withPendingAuthSessionID(id))
- return &PendingAuthSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for PendingAuthSession.
- func (c *PendingAuthSessionClient) Delete() *PendingAuthSessionDelete {
- mutation := newPendingAuthSessionMutation(c.config, OpDelete)
- return &PendingAuthSessionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *PendingAuthSessionClient) DeleteOne(_m *PendingAuthSession) *PendingAuthSessionDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *PendingAuthSessionClient) DeleteOneID(id int64) *PendingAuthSessionDeleteOne {
- builder := c.Delete().Where(pendingauthsession.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &PendingAuthSessionDeleteOne{builder}
- }
- // Query returns a query builder for PendingAuthSession.
- func (c *PendingAuthSessionClient) Query() *PendingAuthSessionQuery {
- return &PendingAuthSessionQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypePendingAuthSession},
- inters: c.Interceptors(),
- }
- }
- // Get returns a PendingAuthSession entity by its id.
- func (c *PendingAuthSessionClient) Get(ctx context.Context, id int64) (*PendingAuthSession, error) {
- return c.Query().Where(pendingauthsession.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *PendingAuthSessionClient) GetX(ctx context.Context, id int64) *PendingAuthSession {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryTargetUser queries the target_user edge of a PendingAuthSession.
- func (c *PendingAuthSessionClient) QueryTargetUser(_m *PendingAuthSession) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(pendingauthsession.Table, pendingauthsession.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, pendingauthsession.TargetUserTable, pendingauthsession.TargetUserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAdoptionDecision queries the adoption_decision edge of a PendingAuthSession.
- func (c *PendingAuthSessionClient) QueryAdoptionDecision(_m *PendingAuthSession) *IdentityAdoptionDecisionQuery {
- query := (&IdentityAdoptionDecisionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(pendingauthsession.Table, pendingauthsession.FieldID, id),
- sqlgraph.To(identityadoptiondecision.Table, identityadoptiondecision.FieldID),
- sqlgraph.Edge(sqlgraph.O2O, false, pendingauthsession.AdoptionDecisionTable, pendingauthsession.AdoptionDecisionColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *PendingAuthSessionClient) Hooks() []Hook {
- return c.hooks.PendingAuthSession
- }
- // Interceptors returns the client interceptors.
- func (c *PendingAuthSessionClient) Interceptors() []Interceptor {
- return c.inters.PendingAuthSession
- }
- func (c *PendingAuthSessionClient) mutate(ctx context.Context, m *PendingAuthSessionMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&PendingAuthSessionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&PendingAuthSessionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&PendingAuthSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&PendingAuthSessionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown PendingAuthSession mutation op: %q", m.Op())
- }
- }
- // PromoCodeClient is a client for the PromoCode schema.
- type PromoCodeClient struct {
- config
- }
- // NewPromoCodeClient returns a client for the PromoCode from the given config.
- func NewPromoCodeClient(c config) *PromoCodeClient {
- return &PromoCodeClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `promocode.Hooks(f(g(h())))`.
- func (c *PromoCodeClient) Use(hooks ...Hook) {
- c.hooks.PromoCode = append(c.hooks.PromoCode, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `promocode.Intercept(f(g(h())))`.
- func (c *PromoCodeClient) Intercept(interceptors ...Interceptor) {
- c.inters.PromoCode = append(c.inters.PromoCode, interceptors...)
- }
- // Create returns a builder for creating a PromoCode entity.
- func (c *PromoCodeClient) Create() *PromoCodeCreate {
- mutation := newPromoCodeMutation(c.config, OpCreate)
- return &PromoCodeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of PromoCode entities.
- func (c *PromoCodeClient) CreateBulk(builders ...*PromoCodeCreate) *PromoCodeCreateBulk {
- return &PromoCodeCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *PromoCodeClient) MapCreateBulk(slice any, setFunc func(*PromoCodeCreate, int)) *PromoCodeCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &PromoCodeCreateBulk{err: fmt.Errorf("calling to PromoCodeClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*PromoCodeCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &PromoCodeCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for PromoCode.
- func (c *PromoCodeClient) Update() *PromoCodeUpdate {
- mutation := newPromoCodeMutation(c.config, OpUpdate)
- return &PromoCodeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *PromoCodeClient) UpdateOne(_m *PromoCode) *PromoCodeUpdateOne {
- mutation := newPromoCodeMutation(c.config, OpUpdateOne, withPromoCode(_m))
- return &PromoCodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *PromoCodeClient) UpdateOneID(id int64) *PromoCodeUpdateOne {
- mutation := newPromoCodeMutation(c.config, OpUpdateOne, withPromoCodeID(id))
- return &PromoCodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for PromoCode.
- func (c *PromoCodeClient) Delete() *PromoCodeDelete {
- mutation := newPromoCodeMutation(c.config, OpDelete)
- return &PromoCodeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *PromoCodeClient) DeleteOne(_m *PromoCode) *PromoCodeDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *PromoCodeClient) DeleteOneID(id int64) *PromoCodeDeleteOne {
- builder := c.Delete().Where(promocode.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &PromoCodeDeleteOne{builder}
- }
- // Query returns a query builder for PromoCode.
- func (c *PromoCodeClient) Query() *PromoCodeQuery {
- return &PromoCodeQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypePromoCode},
- inters: c.Interceptors(),
- }
- }
- // Get returns a PromoCode entity by its id.
- func (c *PromoCodeClient) Get(ctx context.Context, id int64) (*PromoCode, error) {
- return c.Query().Where(promocode.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *PromoCodeClient) GetX(ctx context.Context, id int64) *PromoCode {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUsageRecords queries the usage_records edge of a PromoCode.
- func (c *PromoCodeClient) QueryUsageRecords(_m *PromoCode) *PromoCodeUsageQuery {
- query := (&PromoCodeUsageClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(promocode.Table, promocode.FieldID, id),
- sqlgraph.To(promocodeusage.Table, promocodeusage.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, promocode.UsageRecordsTable, promocode.UsageRecordsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *PromoCodeClient) Hooks() []Hook {
- return c.hooks.PromoCode
- }
- // Interceptors returns the client interceptors.
- func (c *PromoCodeClient) Interceptors() []Interceptor {
- return c.inters.PromoCode
- }
- func (c *PromoCodeClient) mutate(ctx context.Context, m *PromoCodeMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&PromoCodeCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&PromoCodeUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&PromoCodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&PromoCodeDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown PromoCode mutation op: %q", m.Op())
- }
- }
- // PromoCodeUsageClient is a client for the PromoCodeUsage schema.
- type PromoCodeUsageClient struct {
- config
- }
- // NewPromoCodeUsageClient returns a client for the PromoCodeUsage from the given config.
- func NewPromoCodeUsageClient(c config) *PromoCodeUsageClient {
- return &PromoCodeUsageClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `promocodeusage.Hooks(f(g(h())))`.
- func (c *PromoCodeUsageClient) Use(hooks ...Hook) {
- c.hooks.PromoCodeUsage = append(c.hooks.PromoCodeUsage, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `promocodeusage.Intercept(f(g(h())))`.
- func (c *PromoCodeUsageClient) Intercept(interceptors ...Interceptor) {
- c.inters.PromoCodeUsage = append(c.inters.PromoCodeUsage, interceptors...)
- }
- // Create returns a builder for creating a PromoCodeUsage entity.
- func (c *PromoCodeUsageClient) Create() *PromoCodeUsageCreate {
- mutation := newPromoCodeUsageMutation(c.config, OpCreate)
- return &PromoCodeUsageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of PromoCodeUsage entities.
- func (c *PromoCodeUsageClient) CreateBulk(builders ...*PromoCodeUsageCreate) *PromoCodeUsageCreateBulk {
- return &PromoCodeUsageCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *PromoCodeUsageClient) MapCreateBulk(slice any, setFunc func(*PromoCodeUsageCreate, int)) *PromoCodeUsageCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &PromoCodeUsageCreateBulk{err: fmt.Errorf("calling to PromoCodeUsageClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*PromoCodeUsageCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &PromoCodeUsageCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for PromoCodeUsage.
- func (c *PromoCodeUsageClient) Update() *PromoCodeUsageUpdate {
- mutation := newPromoCodeUsageMutation(c.config, OpUpdate)
- return &PromoCodeUsageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *PromoCodeUsageClient) UpdateOne(_m *PromoCodeUsage) *PromoCodeUsageUpdateOne {
- mutation := newPromoCodeUsageMutation(c.config, OpUpdateOne, withPromoCodeUsage(_m))
- return &PromoCodeUsageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *PromoCodeUsageClient) UpdateOneID(id int64) *PromoCodeUsageUpdateOne {
- mutation := newPromoCodeUsageMutation(c.config, OpUpdateOne, withPromoCodeUsageID(id))
- return &PromoCodeUsageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for PromoCodeUsage.
- func (c *PromoCodeUsageClient) Delete() *PromoCodeUsageDelete {
- mutation := newPromoCodeUsageMutation(c.config, OpDelete)
- return &PromoCodeUsageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *PromoCodeUsageClient) DeleteOne(_m *PromoCodeUsage) *PromoCodeUsageDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *PromoCodeUsageClient) DeleteOneID(id int64) *PromoCodeUsageDeleteOne {
- builder := c.Delete().Where(promocodeusage.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &PromoCodeUsageDeleteOne{builder}
- }
- // Query returns a query builder for PromoCodeUsage.
- func (c *PromoCodeUsageClient) Query() *PromoCodeUsageQuery {
- return &PromoCodeUsageQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypePromoCodeUsage},
- inters: c.Interceptors(),
- }
- }
- // Get returns a PromoCodeUsage entity by its id.
- func (c *PromoCodeUsageClient) Get(ctx context.Context, id int64) (*PromoCodeUsage, error) {
- return c.Query().Where(promocodeusage.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *PromoCodeUsageClient) GetX(ctx context.Context, id int64) *PromoCodeUsage {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryPromoCode queries the promo_code edge of a PromoCodeUsage.
- func (c *PromoCodeUsageClient) QueryPromoCode(_m *PromoCodeUsage) *PromoCodeQuery {
- query := (&PromoCodeClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(promocodeusage.Table, promocodeusage.FieldID, id),
- sqlgraph.To(promocode.Table, promocode.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, promocodeusage.PromoCodeTable, promocodeusage.PromoCodeColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUser queries the user edge of a PromoCodeUsage.
- func (c *PromoCodeUsageClient) QueryUser(_m *PromoCodeUsage) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(promocodeusage.Table, promocodeusage.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, promocodeusage.UserTable, promocodeusage.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *PromoCodeUsageClient) Hooks() []Hook {
- return c.hooks.PromoCodeUsage
- }
- // Interceptors returns the client interceptors.
- func (c *PromoCodeUsageClient) Interceptors() []Interceptor {
- return c.inters.PromoCodeUsage
- }
- func (c *PromoCodeUsageClient) mutate(ctx context.Context, m *PromoCodeUsageMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&PromoCodeUsageCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&PromoCodeUsageUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&PromoCodeUsageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&PromoCodeUsageDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown PromoCodeUsage mutation op: %q", m.Op())
- }
- }
- // ProxyClient is a client for the Proxy schema.
- type ProxyClient struct {
- config
- }
- // NewProxyClient returns a client for the Proxy from the given config.
- func NewProxyClient(c config) *ProxyClient {
- return &ProxyClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `proxy.Hooks(f(g(h())))`.
- func (c *ProxyClient) Use(hooks ...Hook) {
- c.hooks.Proxy = append(c.hooks.Proxy, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `proxy.Intercept(f(g(h())))`.
- func (c *ProxyClient) Intercept(interceptors ...Interceptor) {
- c.inters.Proxy = append(c.inters.Proxy, interceptors...)
- }
- // Create returns a builder for creating a Proxy entity.
- func (c *ProxyClient) Create() *ProxyCreate {
- mutation := newProxyMutation(c.config, OpCreate)
- return &ProxyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of Proxy entities.
- func (c *ProxyClient) CreateBulk(builders ...*ProxyCreate) *ProxyCreateBulk {
- return &ProxyCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *ProxyClient) MapCreateBulk(slice any, setFunc func(*ProxyCreate, int)) *ProxyCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &ProxyCreateBulk{err: fmt.Errorf("calling to ProxyClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*ProxyCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &ProxyCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for Proxy.
- func (c *ProxyClient) Update() *ProxyUpdate {
- mutation := newProxyMutation(c.config, OpUpdate)
- return &ProxyUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *ProxyClient) UpdateOne(_m *Proxy) *ProxyUpdateOne {
- mutation := newProxyMutation(c.config, OpUpdateOne, withProxy(_m))
- return &ProxyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *ProxyClient) UpdateOneID(id int64) *ProxyUpdateOne {
- mutation := newProxyMutation(c.config, OpUpdateOne, withProxyID(id))
- return &ProxyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for Proxy.
- func (c *ProxyClient) Delete() *ProxyDelete {
- mutation := newProxyMutation(c.config, OpDelete)
- return &ProxyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *ProxyClient) DeleteOne(_m *Proxy) *ProxyDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *ProxyClient) DeleteOneID(id int64) *ProxyDeleteOne {
- builder := c.Delete().Where(proxy.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &ProxyDeleteOne{builder}
- }
- // Query returns a query builder for Proxy.
- func (c *ProxyClient) Query() *ProxyQuery {
- return &ProxyQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeProxy},
- inters: c.Interceptors(),
- }
- }
- // Get returns a Proxy entity by its id.
- func (c *ProxyClient) Get(ctx context.Context, id int64) (*Proxy, error) {
- return c.Query().Where(proxy.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *ProxyClient) GetX(ctx context.Context, id int64) *Proxy {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryAccounts queries the accounts edge of a Proxy.
- func (c *ProxyClient) QueryAccounts(_m *Proxy) *AccountQuery {
- query := (&AccountClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(proxy.Table, proxy.FieldID, id),
- sqlgraph.To(account.Table, account.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, true, proxy.AccountsTable, proxy.AccountsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryPrimaryProxies queries the primary_proxies edge of a Proxy.
- func (c *ProxyClient) QueryPrimaryProxies(_m *Proxy) *ProxyQuery {
- query := (&ProxyClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(proxy.Table, proxy.FieldID, id),
- sqlgraph.To(proxy.Table, proxy.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, true, proxy.PrimaryProxiesTable, proxy.PrimaryProxiesColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryBackupProxy queries the backup_proxy edge of a Proxy.
- func (c *ProxyClient) QueryBackupProxy(_m *Proxy) *ProxyQuery {
- query := (&ProxyClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(proxy.Table, proxy.FieldID, id),
- sqlgraph.To(proxy.Table, proxy.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, proxy.BackupProxyTable, proxy.BackupProxyColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *ProxyClient) Hooks() []Hook {
- hooks := c.hooks.Proxy
- return append(hooks[:len(hooks):len(hooks)], proxy.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *ProxyClient) Interceptors() []Interceptor {
- inters := c.inters.Proxy
- return append(inters[:len(inters):len(inters)], proxy.Interceptors[:]...)
- }
- func (c *ProxyClient) mutate(ctx context.Context, m *ProxyMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&ProxyCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&ProxyUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&ProxyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&ProxyDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown Proxy mutation op: %q", m.Op())
- }
- }
- // RedeemCodeClient is a client for the RedeemCode schema.
- type RedeemCodeClient struct {
- config
- }
- // NewRedeemCodeClient returns a client for the RedeemCode from the given config.
- func NewRedeemCodeClient(c config) *RedeemCodeClient {
- return &RedeemCodeClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `redeemcode.Hooks(f(g(h())))`.
- func (c *RedeemCodeClient) Use(hooks ...Hook) {
- c.hooks.RedeemCode = append(c.hooks.RedeemCode, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `redeemcode.Intercept(f(g(h())))`.
- func (c *RedeemCodeClient) Intercept(interceptors ...Interceptor) {
- c.inters.RedeemCode = append(c.inters.RedeemCode, interceptors...)
- }
- // Create returns a builder for creating a RedeemCode entity.
- func (c *RedeemCodeClient) Create() *RedeemCodeCreate {
- mutation := newRedeemCodeMutation(c.config, OpCreate)
- return &RedeemCodeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of RedeemCode entities.
- func (c *RedeemCodeClient) CreateBulk(builders ...*RedeemCodeCreate) *RedeemCodeCreateBulk {
- return &RedeemCodeCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *RedeemCodeClient) MapCreateBulk(slice any, setFunc func(*RedeemCodeCreate, int)) *RedeemCodeCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &RedeemCodeCreateBulk{err: fmt.Errorf("calling to RedeemCodeClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*RedeemCodeCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &RedeemCodeCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for RedeemCode.
- func (c *RedeemCodeClient) Update() *RedeemCodeUpdate {
- mutation := newRedeemCodeMutation(c.config, OpUpdate)
- return &RedeemCodeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *RedeemCodeClient) UpdateOne(_m *RedeemCode) *RedeemCodeUpdateOne {
- mutation := newRedeemCodeMutation(c.config, OpUpdateOne, withRedeemCode(_m))
- return &RedeemCodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *RedeemCodeClient) UpdateOneID(id int64) *RedeemCodeUpdateOne {
- mutation := newRedeemCodeMutation(c.config, OpUpdateOne, withRedeemCodeID(id))
- return &RedeemCodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for RedeemCode.
- func (c *RedeemCodeClient) Delete() *RedeemCodeDelete {
- mutation := newRedeemCodeMutation(c.config, OpDelete)
- return &RedeemCodeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *RedeemCodeClient) DeleteOne(_m *RedeemCode) *RedeemCodeDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *RedeemCodeClient) DeleteOneID(id int64) *RedeemCodeDeleteOne {
- builder := c.Delete().Where(redeemcode.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &RedeemCodeDeleteOne{builder}
- }
- // Query returns a query builder for RedeemCode.
- func (c *RedeemCodeClient) Query() *RedeemCodeQuery {
- return &RedeemCodeQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeRedeemCode},
- inters: c.Interceptors(),
- }
- }
- // Get returns a RedeemCode entity by its id.
- func (c *RedeemCodeClient) Get(ctx context.Context, id int64) (*RedeemCode, error) {
- return c.Query().Where(redeemcode.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *RedeemCodeClient) GetX(ctx context.Context, id int64) *RedeemCode {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a RedeemCode.
- func (c *RedeemCodeClient) QueryUser(_m *RedeemCode) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(redeemcode.Table, redeemcode.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, redeemcode.UserTable, redeemcode.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryGroup queries the group edge of a RedeemCode.
- func (c *RedeemCodeClient) QueryGroup(_m *RedeemCode) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(redeemcode.Table, redeemcode.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, redeemcode.GroupTable, redeemcode.GroupColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *RedeemCodeClient) Hooks() []Hook {
- return c.hooks.RedeemCode
- }
- // Interceptors returns the client interceptors.
- func (c *RedeemCodeClient) Interceptors() []Interceptor {
- return c.inters.RedeemCode
- }
- func (c *RedeemCodeClient) mutate(ctx context.Context, m *RedeemCodeMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&RedeemCodeCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&RedeemCodeUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&RedeemCodeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&RedeemCodeDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown RedeemCode mutation op: %q", m.Op())
- }
- }
- // SecurityPolicyKeywordClient is a client for the SecurityPolicyKeyword schema.
- type SecurityPolicyKeywordClient struct {
- config
- }
- // NewSecurityPolicyKeywordClient returns a client for the SecurityPolicyKeyword from the given config.
- func NewSecurityPolicyKeywordClient(c config) *SecurityPolicyKeywordClient {
- return &SecurityPolicyKeywordClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `securitypolicykeyword.Hooks(f(g(h())))`.
- func (c *SecurityPolicyKeywordClient) Use(hooks ...Hook) {
- c.hooks.SecurityPolicyKeyword = append(c.hooks.SecurityPolicyKeyword, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `securitypolicykeyword.Intercept(f(g(h())))`.
- func (c *SecurityPolicyKeywordClient) Intercept(interceptors ...Interceptor) {
- c.inters.SecurityPolicyKeyword = append(c.inters.SecurityPolicyKeyword, interceptors...)
- }
- // Create returns a builder for creating a SecurityPolicyKeyword entity.
- func (c *SecurityPolicyKeywordClient) Create() *SecurityPolicyKeywordCreate {
- mutation := newSecurityPolicyKeywordMutation(c.config, OpCreate)
- return &SecurityPolicyKeywordCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of SecurityPolicyKeyword entities.
- func (c *SecurityPolicyKeywordClient) CreateBulk(builders ...*SecurityPolicyKeywordCreate) *SecurityPolicyKeywordCreateBulk {
- return &SecurityPolicyKeywordCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *SecurityPolicyKeywordClient) MapCreateBulk(slice any, setFunc func(*SecurityPolicyKeywordCreate, int)) *SecurityPolicyKeywordCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &SecurityPolicyKeywordCreateBulk{err: fmt.Errorf("calling to SecurityPolicyKeywordClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*SecurityPolicyKeywordCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &SecurityPolicyKeywordCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for SecurityPolicyKeyword.
- func (c *SecurityPolicyKeywordClient) Update() *SecurityPolicyKeywordUpdate {
- mutation := newSecurityPolicyKeywordMutation(c.config, OpUpdate)
- return &SecurityPolicyKeywordUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *SecurityPolicyKeywordClient) UpdateOne(_m *SecurityPolicyKeyword) *SecurityPolicyKeywordUpdateOne {
- mutation := newSecurityPolicyKeywordMutation(c.config, OpUpdateOne, withSecurityPolicyKeyword(_m))
- return &SecurityPolicyKeywordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *SecurityPolicyKeywordClient) UpdateOneID(id int64) *SecurityPolicyKeywordUpdateOne {
- mutation := newSecurityPolicyKeywordMutation(c.config, OpUpdateOne, withSecurityPolicyKeywordID(id))
- return &SecurityPolicyKeywordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for SecurityPolicyKeyword.
- func (c *SecurityPolicyKeywordClient) Delete() *SecurityPolicyKeywordDelete {
- mutation := newSecurityPolicyKeywordMutation(c.config, OpDelete)
- return &SecurityPolicyKeywordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *SecurityPolicyKeywordClient) DeleteOne(_m *SecurityPolicyKeyword) *SecurityPolicyKeywordDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *SecurityPolicyKeywordClient) DeleteOneID(id int64) *SecurityPolicyKeywordDeleteOne {
- builder := c.Delete().Where(securitypolicykeyword.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &SecurityPolicyKeywordDeleteOne{builder}
- }
- // Query returns a query builder for SecurityPolicyKeyword.
- func (c *SecurityPolicyKeywordClient) Query() *SecurityPolicyKeywordQuery {
- return &SecurityPolicyKeywordQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeSecurityPolicyKeyword},
- inters: c.Interceptors(),
- }
- }
- // Get returns a SecurityPolicyKeyword entity by its id.
- func (c *SecurityPolicyKeywordClient) Get(ctx context.Context, id int64) (*SecurityPolicyKeyword, error) {
- return c.Query().Where(securitypolicykeyword.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *SecurityPolicyKeywordClient) GetX(ctx context.Context, id int64) *SecurityPolicyKeyword {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryGroup queries the group edge of a SecurityPolicyKeyword.
- func (c *SecurityPolicyKeywordClient) QueryGroup(_m *SecurityPolicyKeyword) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(securitypolicykeyword.Table, securitypolicykeyword.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, securitypolicykeyword.GroupTable, securitypolicykeyword.GroupColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *SecurityPolicyKeywordClient) Hooks() []Hook {
- hooks := c.hooks.SecurityPolicyKeyword
- return append(hooks[:len(hooks):len(hooks)], securitypolicykeyword.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *SecurityPolicyKeywordClient) Interceptors() []Interceptor {
- inters := c.inters.SecurityPolicyKeyword
- return append(inters[:len(inters):len(inters)], securitypolicykeyword.Interceptors[:]...)
- }
- func (c *SecurityPolicyKeywordClient) mutate(ctx context.Context, m *SecurityPolicyKeywordMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&SecurityPolicyKeywordCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&SecurityPolicyKeywordUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&SecurityPolicyKeywordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&SecurityPolicyKeywordDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown SecurityPolicyKeyword mutation op: %q", m.Op())
- }
- }
- // SecuritySecretClient is a client for the SecuritySecret schema.
- type SecuritySecretClient struct {
- config
- }
- // NewSecuritySecretClient returns a client for the SecuritySecret from the given config.
- func NewSecuritySecretClient(c config) *SecuritySecretClient {
- return &SecuritySecretClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `securitysecret.Hooks(f(g(h())))`.
- func (c *SecuritySecretClient) Use(hooks ...Hook) {
- c.hooks.SecuritySecret = append(c.hooks.SecuritySecret, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `securitysecret.Intercept(f(g(h())))`.
- func (c *SecuritySecretClient) Intercept(interceptors ...Interceptor) {
- c.inters.SecuritySecret = append(c.inters.SecuritySecret, interceptors...)
- }
- // Create returns a builder for creating a SecuritySecret entity.
- func (c *SecuritySecretClient) Create() *SecuritySecretCreate {
- mutation := newSecuritySecretMutation(c.config, OpCreate)
- return &SecuritySecretCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of SecuritySecret entities.
- func (c *SecuritySecretClient) CreateBulk(builders ...*SecuritySecretCreate) *SecuritySecretCreateBulk {
- return &SecuritySecretCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *SecuritySecretClient) MapCreateBulk(slice any, setFunc func(*SecuritySecretCreate, int)) *SecuritySecretCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &SecuritySecretCreateBulk{err: fmt.Errorf("calling to SecuritySecretClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*SecuritySecretCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &SecuritySecretCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for SecuritySecret.
- func (c *SecuritySecretClient) Update() *SecuritySecretUpdate {
- mutation := newSecuritySecretMutation(c.config, OpUpdate)
- return &SecuritySecretUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *SecuritySecretClient) UpdateOne(_m *SecuritySecret) *SecuritySecretUpdateOne {
- mutation := newSecuritySecretMutation(c.config, OpUpdateOne, withSecuritySecret(_m))
- return &SecuritySecretUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *SecuritySecretClient) UpdateOneID(id int64) *SecuritySecretUpdateOne {
- mutation := newSecuritySecretMutation(c.config, OpUpdateOne, withSecuritySecretID(id))
- return &SecuritySecretUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for SecuritySecret.
- func (c *SecuritySecretClient) Delete() *SecuritySecretDelete {
- mutation := newSecuritySecretMutation(c.config, OpDelete)
- return &SecuritySecretDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *SecuritySecretClient) DeleteOne(_m *SecuritySecret) *SecuritySecretDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *SecuritySecretClient) DeleteOneID(id int64) *SecuritySecretDeleteOne {
- builder := c.Delete().Where(securitysecret.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &SecuritySecretDeleteOne{builder}
- }
- // Query returns a query builder for SecuritySecret.
- func (c *SecuritySecretClient) Query() *SecuritySecretQuery {
- return &SecuritySecretQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeSecuritySecret},
- inters: c.Interceptors(),
- }
- }
- // Get returns a SecuritySecret entity by its id.
- func (c *SecuritySecretClient) Get(ctx context.Context, id int64) (*SecuritySecret, error) {
- return c.Query().Where(securitysecret.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *SecuritySecretClient) GetX(ctx context.Context, id int64) *SecuritySecret {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *SecuritySecretClient) Hooks() []Hook {
- return c.hooks.SecuritySecret
- }
- // Interceptors returns the client interceptors.
- func (c *SecuritySecretClient) Interceptors() []Interceptor {
- return c.inters.SecuritySecret
- }
- func (c *SecuritySecretClient) mutate(ctx context.Context, m *SecuritySecretMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&SecuritySecretCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&SecuritySecretUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&SecuritySecretUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&SecuritySecretDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown SecuritySecret mutation op: %q", m.Op())
- }
- }
- // SettingClient is a client for the Setting schema.
- type SettingClient struct {
- config
- }
- // NewSettingClient returns a client for the Setting from the given config.
- func NewSettingClient(c config) *SettingClient {
- return &SettingClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `setting.Hooks(f(g(h())))`.
- func (c *SettingClient) Use(hooks ...Hook) {
- c.hooks.Setting = append(c.hooks.Setting, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `setting.Intercept(f(g(h())))`.
- func (c *SettingClient) Intercept(interceptors ...Interceptor) {
- c.inters.Setting = append(c.inters.Setting, interceptors...)
- }
- // Create returns a builder for creating a Setting entity.
- func (c *SettingClient) Create() *SettingCreate {
- mutation := newSettingMutation(c.config, OpCreate)
- return &SettingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of Setting entities.
- func (c *SettingClient) CreateBulk(builders ...*SettingCreate) *SettingCreateBulk {
- return &SettingCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *SettingClient) MapCreateBulk(slice any, setFunc func(*SettingCreate, int)) *SettingCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &SettingCreateBulk{err: fmt.Errorf("calling to SettingClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*SettingCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &SettingCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for Setting.
- func (c *SettingClient) Update() *SettingUpdate {
- mutation := newSettingMutation(c.config, OpUpdate)
- return &SettingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *SettingClient) UpdateOne(_m *Setting) *SettingUpdateOne {
- mutation := newSettingMutation(c.config, OpUpdateOne, withSetting(_m))
- return &SettingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *SettingClient) UpdateOneID(id int64) *SettingUpdateOne {
- mutation := newSettingMutation(c.config, OpUpdateOne, withSettingID(id))
- return &SettingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for Setting.
- func (c *SettingClient) Delete() *SettingDelete {
- mutation := newSettingMutation(c.config, OpDelete)
- return &SettingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *SettingClient) DeleteOne(_m *Setting) *SettingDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *SettingClient) DeleteOneID(id int64) *SettingDeleteOne {
- builder := c.Delete().Where(setting.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &SettingDeleteOne{builder}
- }
- // Query returns a query builder for Setting.
- func (c *SettingClient) Query() *SettingQuery {
- return &SettingQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeSetting},
- inters: c.Interceptors(),
- }
- }
- // Get returns a Setting entity by its id.
- func (c *SettingClient) Get(ctx context.Context, id int64) (*Setting, error) {
- return c.Query().Where(setting.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *SettingClient) GetX(ctx context.Context, id int64) *Setting {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *SettingClient) Hooks() []Hook {
- return c.hooks.Setting
- }
- // Interceptors returns the client interceptors.
- func (c *SettingClient) Interceptors() []Interceptor {
- return c.inters.Setting
- }
- func (c *SettingClient) mutate(ctx context.Context, m *SettingMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&SettingCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&SettingUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&SettingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&SettingDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown Setting mutation op: %q", m.Op())
- }
- }
- // SubscriptionPlanClient is a client for the SubscriptionPlan schema.
- type SubscriptionPlanClient struct {
- config
- }
- // NewSubscriptionPlanClient returns a client for the SubscriptionPlan from the given config.
- func NewSubscriptionPlanClient(c config) *SubscriptionPlanClient {
- return &SubscriptionPlanClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `subscriptionplan.Hooks(f(g(h())))`.
- func (c *SubscriptionPlanClient) Use(hooks ...Hook) {
- c.hooks.SubscriptionPlan = append(c.hooks.SubscriptionPlan, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `subscriptionplan.Intercept(f(g(h())))`.
- func (c *SubscriptionPlanClient) Intercept(interceptors ...Interceptor) {
- c.inters.SubscriptionPlan = append(c.inters.SubscriptionPlan, interceptors...)
- }
- // Create returns a builder for creating a SubscriptionPlan entity.
- func (c *SubscriptionPlanClient) Create() *SubscriptionPlanCreate {
- mutation := newSubscriptionPlanMutation(c.config, OpCreate)
- return &SubscriptionPlanCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of SubscriptionPlan entities.
- func (c *SubscriptionPlanClient) CreateBulk(builders ...*SubscriptionPlanCreate) *SubscriptionPlanCreateBulk {
- return &SubscriptionPlanCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *SubscriptionPlanClient) MapCreateBulk(slice any, setFunc func(*SubscriptionPlanCreate, int)) *SubscriptionPlanCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &SubscriptionPlanCreateBulk{err: fmt.Errorf("calling to SubscriptionPlanClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*SubscriptionPlanCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &SubscriptionPlanCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for SubscriptionPlan.
- func (c *SubscriptionPlanClient) Update() *SubscriptionPlanUpdate {
- mutation := newSubscriptionPlanMutation(c.config, OpUpdate)
- return &SubscriptionPlanUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *SubscriptionPlanClient) UpdateOne(_m *SubscriptionPlan) *SubscriptionPlanUpdateOne {
- mutation := newSubscriptionPlanMutation(c.config, OpUpdateOne, withSubscriptionPlan(_m))
- return &SubscriptionPlanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *SubscriptionPlanClient) UpdateOneID(id int64) *SubscriptionPlanUpdateOne {
- mutation := newSubscriptionPlanMutation(c.config, OpUpdateOne, withSubscriptionPlanID(id))
- return &SubscriptionPlanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for SubscriptionPlan.
- func (c *SubscriptionPlanClient) Delete() *SubscriptionPlanDelete {
- mutation := newSubscriptionPlanMutation(c.config, OpDelete)
- return &SubscriptionPlanDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *SubscriptionPlanClient) DeleteOne(_m *SubscriptionPlan) *SubscriptionPlanDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *SubscriptionPlanClient) DeleteOneID(id int64) *SubscriptionPlanDeleteOne {
- builder := c.Delete().Where(subscriptionplan.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &SubscriptionPlanDeleteOne{builder}
- }
- // Query returns a query builder for SubscriptionPlan.
- func (c *SubscriptionPlanClient) Query() *SubscriptionPlanQuery {
- return &SubscriptionPlanQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeSubscriptionPlan},
- inters: c.Interceptors(),
- }
- }
- // Get returns a SubscriptionPlan entity by its id.
- func (c *SubscriptionPlanClient) Get(ctx context.Context, id int64) (*SubscriptionPlan, error) {
- return c.Query().Where(subscriptionplan.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *SubscriptionPlanClient) GetX(ctx context.Context, id int64) *SubscriptionPlan {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *SubscriptionPlanClient) Hooks() []Hook {
- return c.hooks.SubscriptionPlan
- }
- // Interceptors returns the client interceptors.
- func (c *SubscriptionPlanClient) Interceptors() []Interceptor {
- return c.inters.SubscriptionPlan
- }
- func (c *SubscriptionPlanClient) mutate(ctx context.Context, m *SubscriptionPlanMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&SubscriptionPlanCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&SubscriptionPlanUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&SubscriptionPlanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&SubscriptionPlanDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown SubscriptionPlan mutation op: %q", m.Op())
- }
- }
- // TLSFingerprintProfileClient is a client for the TLSFingerprintProfile schema.
- type TLSFingerprintProfileClient struct {
- config
- }
- // NewTLSFingerprintProfileClient returns a client for the TLSFingerprintProfile from the given config.
- func NewTLSFingerprintProfileClient(c config) *TLSFingerprintProfileClient {
- return &TLSFingerprintProfileClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `tlsfingerprintprofile.Hooks(f(g(h())))`.
- func (c *TLSFingerprintProfileClient) Use(hooks ...Hook) {
- c.hooks.TLSFingerprintProfile = append(c.hooks.TLSFingerprintProfile, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `tlsfingerprintprofile.Intercept(f(g(h())))`.
- func (c *TLSFingerprintProfileClient) Intercept(interceptors ...Interceptor) {
- c.inters.TLSFingerprintProfile = append(c.inters.TLSFingerprintProfile, interceptors...)
- }
- // Create returns a builder for creating a TLSFingerprintProfile entity.
- func (c *TLSFingerprintProfileClient) Create() *TLSFingerprintProfileCreate {
- mutation := newTLSFingerprintProfileMutation(c.config, OpCreate)
- return &TLSFingerprintProfileCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of TLSFingerprintProfile entities.
- func (c *TLSFingerprintProfileClient) CreateBulk(builders ...*TLSFingerprintProfileCreate) *TLSFingerprintProfileCreateBulk {
- return &TLSFingerprintProfileCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *TLSFingerprintProfileClient) MapCreateBulk(slice any, setFunc func(*TLSFingerprintProfileCreate, int)) *TLSFingerprintProfileCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &TLSFingerprintProfileCreateBulk{err: fmt.Errorf("calling to TLSFingerprintProfileClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*TLSFingerprintProfileCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &TLSFingerprintProfileCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for TLSFingerprintProfile.
- func (c *TLSFingerprintProfileClient) Update() *TLSFingerprintProfileUpdate {
- mutation := newTLSFingerprintProfileMutation(c.config, OpUpdate)
- return &TLSFingerprintProfileUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *TLSFingerprintProfileClient) UpdateOne(_m *TLSFingerprintProfile) *TLSFingerprintProfileUpdateOne {
- mutation := newTLSFingerprintProfileMutation(c.config, OpUpdateOne, withTLSFingerprintProfile(_m))
- return &TLSFingerprintProfileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *TLSFingerprintProfileClient) UpdateOneID(id int64) *TLSFingerprintProfileUpdateOne {
- mutation := newTLSFingerprintProfileMutation(c.config, OpUpdateOne, withTLSFingerprintProfileID(id))
- return &TLSFingerprintProfileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for TLSFingerprintProfile.
- func (c *TLSFingerprintProfileClient) Delete() *TLSFingerprintProfileDelete {
- mutation := newTLSFingerprintProfileMutation(c.config, OpDelete)
- return &TLSFingerprintProfileDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *TLSFingerprintProfileClient) DeleteOne(_m *TLSFingerprintProfile) *TLSFingerprintProfileDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *TLSFingerprintProfileClient) DeleteOneID(id int64) *TLSFingerprintProfileDeleteOne {
- builder := c.Delete().Where(tlsfingerprintprofile.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &TLSFingerprintProfileDeleteOne{builder}
- }
- // Query returns a query builder for TLSFingerprintProfile.
- func (c *TLSFingerprintProfileClient) Query() *TLSFingerprintProfileQuery {
- return &TLSFingerprintProfileQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeTLSFingerprintProfile},
- inters: c.Interceptors(),
- }
- }
- // Get returns a TLSFingerprintProfile entity by its id.
- func (c *TLSFingerprintProfileClient) Get(ctx context.Context, id int64) (*TLSFingerprintProfile, error) {
- return c.Query().Where(tlsfingerprintprofile.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *TLSFingerprintProfileClient) GetX(ctx context.Context, id int64) *TLSFingerprintProfile {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *TLSFingerprintProfileClient) Hooks() []Hook {
- return c.hooks.TLSFingerprintProfile
- }
- // Interceptors returns the client interceptors.
- func (c *TLSFingerprintProfileClient) Interceptors() []Interceptor {
- return c.inters.TLSFingerprintProfile
- }
- func (c *TLSFingerprintProfileClient) mutate(ctx context.Context, m *TLSFingerprintProfileMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&TLSFingerprintProfileCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&TLSFingerprintProfileUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&TLSFingerprintProfileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&TLSFingerprintProfileDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown TLSFingerprintProfile mutation op: %q", m.Op())
- }
- }
- // UsageCleanupTaskClient is a client for the UsageCleanupTask schema.
- type UsageCleanupTaskClient struct {
- config
- }
- // NewUsageCleanupTaskClient returns a client for the UsageCleanupTask from the given config.
- func NewUsageCleanupTaskClient(c config) *UsageCleanupTaskClient {
- return &UsageCleanupTaskClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `usagecleanuptask.Hooks(f(g(h())))`.
- func (c *UsageCleanupTaskClient) Use(hooks ...Hook) {
- c.hooks.UsageCleanupTask = append(c.hooks.UsageCleanupTask, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `usagecleanuptask.Intercept(f(g(h())))`.
- func (c *UsageCleanupTaskClient) Intercept(interceptors ...Interceptor) {
- c.inters.UsageCleanupTask = append(c.inters.UsageCleanupTask, interceptors...)
- }
- // Create returns a builder for creating a UsageCleanupTask entity.
- func (c *UsageCleanupTaskClient) Create() *UsageCleanupTaskCreate {
- mutation := newUsageCleanupTaskMutation(c.config, OpCreate)
- return &UsageCleanupTaskCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of UsageCleanupTask entities.
- func (c *UsageCleanupTaskClient) CreateBulk(builders ...*UsageCleanupTaskCreate) *UsageCleanupTaskCreateBulk {
- return &UsageCleanupTaskCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UsageCleanupTaskClient) MapCreateBulk(slice any, setFunc func(*UsageCleanupTaskCreate, int)) *UsageCleanupTaskCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UsageCleanupTaskCreateBulk{err: fmt.Errorf("calling to UsageCleanupTaskClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UsageCleanupTaskCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UsageCleanupTaskCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for UsageCleanupTask.
- func (c *UsageCleanupTaskClient) Update() *UsageCleanupTaskUpdate {
- mutation := newUsageCleanupTaskMutation(c.config, OpUpdate)
- return &UsageCleanupTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UsageCleanupTaskClient) UpdateOne(_m *UsageCleanupTask) *UsageCleanupTaskUpdateOne {
- mutation := newUsageCleanupTaskMutation(c.config, OpUpdateOne, withUsageCleanupTask(_m))
- return &UsageCleanupTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *UsageCleanupTaskClient) UpdateOneID(id int64) *UsageCleanupTaskUpdateOne {
- mutation := newUsageCleanupTaskMutation(c.config, OpUpdateOne, withUsageCleanupTaskID(id))
- return &UsageCleanupTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for UsageCleanupTask.
- func (c *UsageCleanupTaskClient) Delete() *UsageCleanupTaskDelete {
- mutation := newUsageCleanupTaskMutation(c.config, OpDelete)
- return &UsageCleanupTaskDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *UsageCleanupTaskClient) DeleteOne(_m *UsageCleanupTask) *UsageCleanupTaskDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *UsageCleanupTaskClient) DeleteOneID(id int64) *UsageCleanupTaskDeleteOne {
- builder := c.Delete().Where(usagecleanuptask.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &UsageCleanupTaskDeleteOne{builder}
- }
- // Query returns a query builder for UsageCleanupTask.
- func (c *UsageCleanupTaskClient) Query() *UsageCleanupTaskQuery {
- return &UsageCleanupTaskQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUsageCleanupTask},
- inters: c.Interceptors(),
- }
- }
- // Get returns a UsageCleanupTask entity by its id.
- func (c *UsageCleanupTaskClient) Get(ctx context.Context, id int64) (*UsageCleanupTask, error) {
- return c.Query().Where(usagecleanuptask.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *UsageCleanupTaskClient) GetX(ctx context.Context, id int64) *UsageCleanupTask {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // Hooks returns the client hooks.
- func (c *UsageCleanupTaskClient) Hooks() []Hook {
- return c.hooks.UsageCleanupTask
- }
- // Interceptors returns the client interceptors.
- func (c *UsageCleanupTaskClient) Interceptors() []Interceptor {
- return c.inters.UsageCleanupTask
- }
- func (c *UsageCleanupTaskClient) mutate(ctx context.Context, m *UsageCleanupTaskMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UsageCleanupTaskCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UsageCleanupTaskUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UsageCleanupTaskUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UsageCleanupTaskDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown UsageCleanupTask mutation op: %q", m.Op())
- }
- }
- // UsageLogClient is a client for the UsageLog schema.
- type UsageLogClient struct {
- config
- }
- // NewUsageLogClient returns a client for the UsageLog from the given config.
- func NewUsageLogClient(c config) *UsageLogClient {
- return &UsageLogClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `usagelog.Hooks(f(g(h())))`.
- func (c *UsageLogClient) Use(hooks ...Hook) {
- c.hooks.UsageLog = append(c.hooks.UsageLog, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `usagelog.Intercept(f(g(h())))`.
- func (c *UsageLogClient) Intercept(interceptors ...Interceptor) {
- c.inters.UsageLog = append(c.inters.UsageLog, interceptors...)
- }
- // Create returns a builder for creating a UsageLog entity.
- func (c *UsageLogClient) Create() *UsageLogCreate {
- mutation := newUsageLogMutation(c.config, OpCreate)
- return &UsageLogCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of UsageLog entities.
- func (c *UsageLogClient) CreateBulk(builders ...*UsageLogCreate) *UsageLogCreateBulk {
- return &UsageLogCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UsageLogClient) MapCreateBulk(slice any, setFunc func(*UsageLogCreate, int)) *UsageLogCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UsageLogCreateBulk{err: fmt.Errorf("calling to UsageLogClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UsageLogCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UsageLogCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for UsageLog.
- func (c *UsageLogClient) Update() *UsageLogUpdate {
- mutation := newUsageLogMutation(c.config, OpUpdate)
- return &UsageLogUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UsageLogClient) UpdateOne(_m *UsageLog) *UsageLogUpdateOne {
- mutation := newUsageLogMutation(c.config, OpUpdateOne, withUsageLog(_m))
- return &UsageLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *UsageLogClient) UpdateOneID(id int64) *UsageLogUpdateOne {
- mutation := newUsageLogMutation(c.config, OpUpdateOne, withUsageLogID(id))
- return &UsageLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for UsageLog.
- func (c *UsageLogClient) Delete() *UsageLogDelete {
- mutation := newUsageLogMutation(c.config, OpDelete)
- return &UsageLogDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *UsageLogClient) DeleteOne(_m *UsageLog) *UsageLogDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *UsageLogClient) DeleteOneID(id int64) *UsageLogDeleteOne {
- builder := c.Delete().Where(usagelog.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &UsageLogDeleteOne{builder}
- }
- // Query returns a query builder for UsageLog.
- func (c *UsageLogClient) Query() *UsageLogQuery {
- return &UsageLogQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUsageLog},
- inters: c.Interceptors(),
- }
- }
- // Get returns a UsageLog entity by its id.
- func (c *UsageLogClient) Get(ctx context.Context, id int64) (*UsageLog, error) {
- return c.Query().Where(usagelog.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *UsageLogClient) GetX(ctx context.Context, id int64) *UsageLog {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a UsageLog.
- func (c *UsageLogClient) QueryUser(_m *UsageLog) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usagelog.Table, usagelog.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usagelog.UserTable, usagelog.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAPIKey queries the api_key edge of a UsageLog.
- func (c *UsageLogClient) QueryAPIKey(_m *UsageLog) *APIKeyQuery {
- query := (&APIKeyClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usagelog.Table, usagelog.FieldID, id),
- sqlgraph.To(apikey.Table, apikey.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usagelog.APIKeyTable, usagelog.APIKeyColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAccount queries the account edge of a UsageLog.
- func (c *UsageLogClient) QueryAccount(_m *UsageLog) *AccountQuery {
- query := (&AccountClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usagelog.Table, usagelog.FieldID, id),
- sqlgraph.To(account.Table, account.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usagelog.AccountTable, usagelog.AccountColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryGroup queries the group edge of a UsageLog.
- func (c *UsageLogClient) QueryGroup(_m *UsageLog) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usagelog.Table, usagelog.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usagelog.GroupTable, usagelog.GroupColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QuerySubscription queries the subscription edge of a UsageLog.
- func (c *UsageLogClient) QuerySubscription(_m *UsageLog) *UserSubscriptionQuery {
- query := (&UserSubscriptionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usagelog.Table, usagelog.FieldID, id),
- sqlgraph.To(usersubscription.Table, usersubscription.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usagelog.SubscriptionTable, usagelog.SubscriptionColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *UsageLogClient) Hooks() []Hook {
- return c.hooks.UsageLog
- }
- // Interceptors returns the client interceptors.
- func (c *UsageLogClient) Interceptors() []Interceptor {
- return c.inters.UsageLog
- }
- func (c *UsageLogClient) mutate(ctx context.Context, m *UsageLogMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UsageLogCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UsageLogUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UsageLogUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UsageLogDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown UsageLog mutation op: %q", m.Op())
- }
- }
- // UserClient is a client for the User schema.
- type UserClient struct {
- config
- }
- // NewUserClient returns a client for the User from the given config.
- func NewUserClient(c config) *UserClient {
- return &UserClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
- func (c *UserClient) Use(hooks ...Hook) {
- c.hooks.User = append(c.hooks.User, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.
- func (c *UserClient) Intercept(interceptors ...Interceptor) {
- c.inters.User = append(c.inters.User, interceptors...)
- }
- // Create returns a builder for creating a User entity.
- func (c *UserClient) Create() *UserCreate {
- mutation := newUserMutation(c.config, OpCreate)
- return &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of User entities.
- func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {
- return &UserCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UserCreateBulk{err: fmt.Errorf("calling to UserClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UserCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UserCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for User.
- func (c *UserClient) Update() *UserUpdate {
- mutation := newUserMutation(c.config, OpUpdate)
- return &UserUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne {
- mutation := newUserMutation(c.config, OpUpdateOne, withUser(_m))
- return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne {
- mutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))
- return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for User.
- func (c *UserClient) Delete() *UserDelete {
- mutation := newUserMutation(c.config, OpDelete)
- return &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *UserClient) DeleteOneID(id int64) *UserDeleteOne {
- builder := c.Delete().Where(user.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &UserDeleteOne{builder}
- }
- // Query returns a query builder for User.
- func (c *UserClient) Query() *UserQuery {
- return &UserQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUser},
- inters: c.Interceptors(),
- }
- }
- // Get returns a User entity by its id.
- func (c *UserClient) Get(ctx context.Context, id int64) (*User, error) {
- return c.Query().Where(user.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *UserClient) GetX(ctx context.Context, id int64) *User {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryAPIKeys queries the api_keys edge of a User.
- func (c *UserClient) QueryAPIKeys(_m *User) *APIKeyQuery {
- query := (&APIKeyClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(apikey.Table, apikey.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.APIKeysTable, user.APIKeysColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryRedeemCodes queries the redeem_codes edge of a User.
- func (c *UserClient) QueryRedeemCodes(_m *User) *RedeemCodeQuery {
- query := (&RedeemCodeClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(redeemcode.Table, redeemcode.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.RedeemCodesTable, user.RedeemCodesColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QuerySubscriptions queries the subscriptions edge of a User.
- func (c *UserClient) QuerySubscriptions(_m *User) *UserSubscriptionQuery {
- query := (&UserSubscriptionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(usersubscription.Table, usersubscription.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.SubscriptionsTable, user.SubscriptionsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAssignedSubscriptions queries the assigned_subscriptions edge of a User.
- func (c *UserClient) QueryAssignedSubscriptions(_m *User) *UserSubscriptionQuery {
- query := (&UserSubscriptionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(usersubscription.Table, usersubscription.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.AssignedSubscriptionsTable, user.AssignedSubscriptionsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAnnouncementReads queries the announcement_reads edge of a User.
- func (c *UserClient) QueryAnnouncementReads(_m *User) *AnnouncementReadQuery {
- query := (&AnnouncementReadClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(announcementread.Table, announcementread.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.AnnouncementReadsTable, user.AnnouncementReadsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAllowedGroups queries the allowed_groups edge of a User.
- func (c *UserClient) QueryAllowedGroups(_m *User) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2M, false, user.AllowedGroupsTable, user.AllowedGroupsPrimaryKey...),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUsageLogs queries the usage_logs edge of a User.
- func (c *UserClient) QueryUsageLogs(_m *User) *UsageLogQuery {
- query := (&UsageLogClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(usagelog.Table, usagelog.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.UsageLogsTable, user.UsageLogsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAttributeValues queries the attribute_values edge of a User.
- func (c *UserClient) QueryAttributeValues(_m *User) *UserAttributeValueQuery {
- query := (&UserAttributeValueClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(userattributevalue.Table, userattributevalue.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.AttributeValuesTable, user.AttributeValuesColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryPromoCodeUsages queries the promo_code_usages edge of a User.
- func (c *UserClient) QueryPromoCodeUsages(_m *User) *PromoCodeUsageQuery {
- query := (&PromoCodeUsageClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(promocodeusage.Table, promocodeusage.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.PromoCodeUsagesTable, user.PromoCodeUsagesColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryPaymentOrders queries the payment_orders edge of a User.
- func (c *UserClient) QueryPaymentOrders(_m *User) *PaymentOrderQuery {
- query := (&PaymentOrderClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(paymentorder.Table, paymentorder.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.PaymentOrdersTable, user.PaymentOrdersColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAuthIdentities queries the auth_identities edge of a User.
- func (c *UserClient) QueryAuthIdentities(_m *User) *AuthIdentityQuery {
- query := (&AuthIdentityClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(authidentity.Table, authidentity.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.AuthIdentitiesTable, user.AuthIdentitiesColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryPendingAuthSessions queries the pending_auth_sessions edge of a User.
- func (c *UserClient) QueryPendingAuthSessions(_m *User) *PendingAuthSessionQuery {
- query := (&PendingAuthSessionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(pendingauthsession.Table, pendingauthsession.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.PendingAuthSessionsTable, user.PendingAuthSessionsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryPlatformQuotas queries the platform_quotas edge of a User.
- func (c *UserClient) QueryPlatformQuotas(_m *User) *UserPlatformQuotaQuery {
- query := (&UserPlatformQuotaClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(userplatformquota.Table, userplatformquota.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, user.PlatformQuotasTable, user.PlatformQuotasColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUserAllowedGroups queries the user_allowed_groups edge of a User.
- func (c *UserClient) QueryUserAllowedGroups(_m *User) *UserAllowedGroupQuery {
- query := (&UserAllowedGroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(user.Table, user.FieldID, id),
- sqlgraph.To(userallowedgroup.Table, userallowedgroup.UserColumn),
- sqlgraph.Edge(sqlgraph.O2M, true, user.UserAllowedGroupsTable, user.UserAllowedGroupsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *UserClient) Hooks() []Hook {
- hooks := c.hooks.User
- return append(hooks[:len(hooks):len(hooks)], user.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *UserClient) Interceptors() []Interceptor {
- inters := c.inters.User
- return append(inters[:len(inters):len(inters)], user.Interceptors[:]...)
- }
- func (c *UserClient) mutate(ctx context.Context, m *UserMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UserCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UserUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UserDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown User mutation op: %q", m.Op())
- }
- }
- // UserAllowedGroupClient is a client for the UserAllowedGroup schema.
- type UserAllowedGroupClient struct {
- config
- }
- // NewUserAllowedGroupClient returns a client for the UserAllowedGroup from the given config.
- func NewUserAllowedGroupClient(c config) *UserAllowedGroupClient {
- return &UserAllowedGroupClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `userallowedgroup.Hooks(f(g(h())))`.
- func (c *UserAllowedGroupClient) Use(hooks ...Hook) {
- c.hooks.UserAllowedGroup = append(c.hooks.UserAllowedGroup, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `userallowedgroup.Intercept(f(g(h())))`.
- func (c *UserAllowedGroupClient) Intercept(interceptors ...Interceptor) {
- c.inters.UserAllowedGroup = append(c.inters.UserAllowedGroup, interceptors...)
- }
- // Create returns a builder for creating a UserAllowedGroup entity.
- func (c *UserAllowedGroupClient) Create() *UserAllowedGroupCreate {
- mutation := newUserAllowedGroupMutation(c.config, OpCreate)
- return &UserAllowedGroupCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of UserAllowedGroup entities.
- func (c *UserAllowedGroupClient) CreateBulk(builders ...*UserAllowedGroupCreate) *UserAllowedGroupCreateBulk {
- return &UserAllowedGroupCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UserAllowedGroupClient) MapCreateBulk(slice any, setFunc func(*UserAllowedGroupCreate, int)) *UserAllowedGroupCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UserAllowedGroupCreateBulk{err: fmt.Errorf("calling to UserAllowedGroupClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UserAllowedGroupCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UserAllowedGroupCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for UserAllowedGroup.
- func (c *UserAllowedGroupClient) Update() *UserAllowedGroupUpdate {
- mutation := newUserAllowedGroupMutation(c.config, OpUpdate)
- return &UserAllowedGroupUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UserAllowedGroupClient) UpdateOne(_m *UserAllowedGroup) *UserAllowedGroupUpdateOne {
- mutation := newUserAllowedGroupMutation(c.config, OpUpdateOne)
- mutation.user = &_m.UserID
- mutation.group = &_m.GroupID
- return &UserAllowedGroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for UserAllowedGroup.
- func (c *UserAllowedGroupClient) Delete() *UserAllowedGroupDelete {
- mutation := newUserAllowedGroupMutation(c.config, OpDelete)
- return &UserAllowedGroupDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Query returns a query builder for UserAllowedGroup.
- func (c *UserAllowedGroupClient) Query() *UserAllowedGroupQuery {
- return &UserAllowedGroupQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUserAllowedGroup},
- inters: c.Interceptors(),
- }
- }
- // QueryUser queries the user edge of a UserAllowedGroup.
- func (c *UserAllowedGroupClient) QueryUser(_m *UserAllowedGroup) *UserQuery {
- return c.Query().
- Where(userallowedgroup.UserID(_m.UserID), userallowedgroup.GroupID(_m.GroupID)).
- QueryUser()
- }
- // QueryGroup queries the group edge of a UserAllowedGroup.
- func (c *UserAllowedGroupClient) QueryGroup(_m *UserAllowedGroup) *GroupQuery {
- return c.Query().
- Where(userallowedgroup.UserID(_m.UserID), userallowedgroup.GroupID(_m.GroupID)).
- QueryGroup()
- }
- // Hooks returns the client hooks.
- func (c *UserAllowedGroupClient) Hooks() []Hook {
- return c.hooks.UserAllowedGroup
- }
- // Interceptors returns the client interceptors.
- func (c *UserAllowedGroupClient) Interceptors() []Interceptor {
- return c.inters.UserAllowedGroup
- }
- func (c *UserAllowedGroupClient) mutate(ctx context.Context, m *UserAllowedGroupMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UserAllowedGroupCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UserAllowedGroupUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UserAllowedGroupUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UserAllowedGroupDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown UserAllowedGroup mutation op: %q", m.Op())
- }
- }
- // UserAttributeDefinitionClient is a client for the UserAttributeDefinition schema.
- type UserAttributeDefinitionClient struct {
- config
- }
- // NewUserAttributeDefinitionClient returns a client for the UserAttributeDefinition from the given config.
- func NewUserAttributeDefinitionClient(c config) *UserAttributeDefinitionClient {
- return &UserAttributeDefinitionClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `userattributedefinition.Hooks(f(g(h())))`.
- func (c *UserAttributeDefinitionClient) Use(hooks ...Hook) {
- c.hooks.UserAttributeDefinition = append(c.hooks.UserAttributeDefinition, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `userattributedefinition.Intercept(f(g(h())))`.
- func (c *UserAttributeDefinitionClient) Intercept(interceptors ...Interceptor) {
- c.inters.UserAttributeDefinition = append(c.inters.UserAttributeDefinition, interceptors...)
- }
- // Create returns a builder for creating a UserAttributeDefinition entity.
- func (c *UserAttributeDefinitionClient) Create() *UserAttributeDefinitionCreate {
- mutation := newUserAttributeDefinitionMutation(c.config, OpCreate)
- return &UserAttributeDefinitionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of UserAttributeDefinition entities.
- func (c *UserAttributeDefinitionClient) CreateBulk(builders ...*UserAttributeDefinitionCreate) *UserAttributeDefinitionCreateBulk {
- return &UserAttributeDefinitionCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UserAttributeDefinitionClient) MapCreateBulk(slice any, setFunc func(*UserAttributeDefinitionCreate, int)) *UserAttributeDefinitionCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UserAttributeDefinitionCreateBulk{err: fmt.Errorf("calling to UserAttributeDefinitionClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UserAttributeDefinitionCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UserAttributeDefinitionCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for UserAttributeDefinition.
- func (c *UserAttributeDefinitionClient) Update() *UserAttributeDefinitionUpdate {
- mutation := newUserAttributeDefinitionMutation(c.config, OpUpdate)
- return &UserAttributeDefinitionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UserAttributeDefinitionClient) UpdateOne(_m *UserAttributeDefinition) *UserAttributeDefinitionUpdateOne {
- mutation := newUserAttributeDefinitionMutation(c.config, OpUpdateOne, withUserAttributeDefinition(_m))
- return &UserAttributeDefinitionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *UserAttributeDefinitionClient) UpdateOneID(id int64) *UserAttributeDefinitionUpdateOne {
- mutation := newUserAttributeDefinitionMutation(c.config, OpUpdateOne, withUserAttributeDefinitionID(id))
- return &UserAttributeDefinitionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for UserAttributeDefinition.
- func (c *UserAttributeDefinitionClient) Delete() *UserAttributeDefinitionDelete {
- mutation := newUserAttributeDefinitionMutation(c.config, OpDelete)
- return &UserAttributeDefinitionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *UserAttributeDefinitionClient) DeleteOne(_m *UserAttributeDefinition) *UserAttributeDefinitionDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *UserAttributeDefinitionClient) DeleteOneID(id int64) *UserAttributeDefinitionDeleteOne {
- builder := c.Delete().Where(userattributedefinition.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &UserAttributeDefinitionDeleteOne{builder}
- }
- // Query returns a query builder for UserAttributeDefinition.
- func (c *UserAttributeDefinitionClient) Query() *UserAttributeDefinitionQuery {
- return &UserAttributeDefinitionQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUserAttributeDefinition},
- inters: c.Interceptors(),
- }
- }
- // Get returns a UserAttributeDefinition entity by its id.
- func (c *UserAttributeDefinitionClient) Get(ctx context.Context, id int64) (*UserAttributeDefinition, error) {
- return c.Query().Where(userattributedefinition.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *UserAttributeDefinitionClient) GetX(ctx context.Context, id int64) *UserAttributeDefinition {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryValues queries the values edge of a UserAttributeDefinition.
- func (c *UserAttributeDefinitionClient) QueryValues(_m *UserAttributeDefinition) *UserAttributeValueQuery {
- query := (&UserAttributeValueClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(userattributedefinition.Table, userattributedefinition.FieldID, id),
- sqlgraph.To(userattributevalue.Table, userattributevalue.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, userattributedefinition.ValuesTable, userattributedefinition.ValuesColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *UserAttributeDefinitionClient) Hooks() []Hook {
- hooks := c.hooks.UserAttributeDefinition
- return append(hooks[:len(hooks):len(hooks)], userattributedefinition.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *UserAttributeDefinitionClient) Interceptors() []Interceptor {
- inters := c.inters.UserAttributeDefinition
- return append(inters[:len(inters):len(inters)], userattributedefinition.Interceptors[:]...)
- }
- func (c *UserAttributeDefinitionClient) mutate(ctx context.Context, m *UserAttributeDefinitionMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UserAttributeDefinitionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UserAttributeDefinitionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UserAttributeDefinitionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UserAttributeDefinitionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown UserAttributeDefinition mutation op: %q", m.Op())
- }
- }
- // UserAttributeValueClient is a client for the UserAttributeValue schema.
- type UserAttributeValueClient struct {
- config
- }
- // NewUserAttributeValueClient returns a client for the UserAttributeValue from the given config.
- func NewUserAttributeValueClient(c config) *UserAttributeValueClient {
- return &UserAttributeValueClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `userattributevalue.Hooks(f(g(h())))`.
- func (c *UserAttributeValueClient) Use(hooks ...Hook) {
- c.hooks.UserAttributeValue = append(c.hooks.UserAttributeValue, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `userattributevalue.Intercept(f(g(h())))`.
- func (c *UserAttributeValueClient) Intercept(interceptors ...Interceptor) {
- c.inters.UserAttributeValue = append(c.inters.UserAttributeValue, interceptors...)
- }
- // Create returns a builder for creating a UserAttributeValue entity.
- func (c *UserAttributeValueClient) Create() *UserAttributeValueCreate {
- mutation := newUserAttributeValueMutation(c.config, OpCreate)
- return &UserAttributeValueCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of UserAttributeValue entities.
- func (c *UserAttributeValueClient) CreateBulk(builders ...*UserAttributeValueCreate) *UserAttributeValueCreateBulk {
- return &UserAttributeValueCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UserAttributeValueClient) MapCreateBulk(slice any, setFunc func(*UserAttributeValueCreate, int)) *UserAttributeValueCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UserAttributeValueCreateBulk{err: fmt.Errorf("calling to UserAttributeValueClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UserAttributeValueCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UserAttributeValueCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for UserAttributeValue.
- func (c *UserAttributeValueClient) Update() *UserAttributeValueUpdate {
- mutation := newUserAttributeValueMutation(c.config, OpUpdate)
- return &UserAttributeValueUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UserAttributeValueClient) UpdateOne(_m *UserAttributeValue) *UserAttributeValueUpdateOne {
- mutation := newUserAttributeValueMutation(c.config, OpUpdateOne, withUserAttributeValue(_m))
- return &UserAttributeValueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *UserAttributeValueClient) UpdateOneID(id int64) *UserAttributeValueUpdateOne {
- mutation := newUserAttributeValueMutation(c.config, OpUpdateOne, withUserAttributeValueID(id))
- return &UserAttributeValueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for UserAttributeValue.
- func (c *UserAttributeValueClient) Delete() *UserAttributeValueDelete {
- mutation := newUserAttributeValueMutation(c.config, OpDelete)
- return &UserAttributeValueDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *UserAttributeValueClient) DeleteOne(_m *UserAttributeValue) *UserAttributeValueDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *UserAttributeValueClient) DeleteOneID(id int64) *UserAttributeValueDeleteOne {
- builder := c.Delete().Where(userattributevalue.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &UserAttributeValueDeleteOne{builder}
- }
- // Query returns a query builder for UserAttributeValue.
- func (c *UserAttributeValueClient) Query() *UserAttributeValueQuery {
- return &UserAttributeValueQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUserAttributeValue},
- inters: c.Interceptors(),
- }
- }
- // Get returns a UserAttributeValue entity by its id.
- func (c *UserAttributeValueClient) Get(ctx context.Context, id int64) (*UserAttributeValue, error) {
- return c.Query().Where(userattributevalue.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *UserAttributeValueClient) GetX(ctx context.Context, id int64) *UserAttributeValue {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a UserAttributeValue.
- func (c *UserAttributeValueClient) QueryUser(_m *UserAttributeValue) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(userattributevalue.Table, userattributevalue.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, userattributevalue.UserTable, userattributevalue.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryDefinition queries the definition edge of a UserAttributeValue.
- func (c *UserAttributeValueClient) QueryDefinition(_m *UserAttributeValue) *UserAttributeDefinitionQuery {
- query := (&UserAttributeDefinitionClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(userattributevalue.Table, userattributevalue.FieldID, id),
- sqlgraph.To(userattributedefinition.Table, userattributedefinition.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, userattributevalue.DefinitionTable, userattributevalue.DefinitionColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *UserAttributeValueClient) Hooks() []Hook {
- return c.hooks.UserAttributeValue
- }
- // Interceptors returns the client interceptors.
- func (c *UserAttributeValueClient) Interceptors() []Interceptor {
- return c.inters.UserAttributeValue
- }
- func (c *UserAttributeValueClient) mutate(ctx context.Context, m *UserAttributeValueMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UserAttributeValueCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UserAttributeValueUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UserAttributeValueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UserAttributeValueDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown UserAttributeValue mutation op: %q", m.Op())
- }
- }
- // UserPlatformQuotaClient is a client for the UserPlatformQuota schema.
- type UserPlatformQuotaClient struct {
- config
- }
- // NewUserPlatformQuotaClient returns a client for the UserPlatformQuota from the given config.
- func NewUserPlatformQuotaClient(c config) *UserPlatformQuotaClient {
- return &UserPlatformQuotaClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `userplatformquota.Hooks(f(g(h())))`.
- func (c *UserPlatformQuotaClient) Use(hooks ...Hook) {
- c.hooks.UserPlatformQuota = append(c.hooks.UserPlatformQuota, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `userplatformquota.Intercept(f(g(h())))`.
- func (c *UserPlatformQuotaClient) Intercept(interceptors ...Interceptor) {
- c.inters.UserPlatformQuota = append(c.inters.UserPlatformQuota, interceptors...)
- }
- // Create returns a builder for creating a UserPlatformQuota entity.
- func (c *UserPlatformQuotaClient) Create() *UserPlatformQuotaCreate {
- mutation := newUserPlatformQuotaMutation(c.config, OpCreate)
- return &UserPlatformQuotaCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of UserPlatformQuota entities.
- func (c *UserPlatformQuotaClient) CreateBulk(builders ...*UserPlatformQuotaCreate) *UserPlatformQuotaCreateBulk {
- return &UserPlatformQuotaCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UserPlatformQuotaClient) MapCreateBulk(slice any, setFunc func(*UserPlatformQuotaCreate, int)) *UserPlatformQuotaCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UserPlatformQuotaCreateBulk{err: fmt.Errorf("calling to UserPlatformQuotaClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UserPlatformQuotaCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UserPlatformQuotaCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for UserPlatformQuota.
- func (c *UserPlatformQuotaClient) Update() *UserPlatformQuotaUpdate {
- mutation := newUserPlatformQuotaMutation(c.config, OpUpdate)
- return &UserPlatformQuotaUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UserPlatformQuotaClient) UpdateOne(_m *UserPlatformQuota) *UserPlatformQuotaUpdateOne {
- mutation := newUserPlatformQuotaMutation(c.config, OpUpdateOne, withUserPlatformQuota(_m))
- return &UserPlatformQuotaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *UserPlatformQuotaClient) UpdateOneID(id int64) *UserPlatformQuotaUpdateOne {
- mutation := newUserPlatformQuotaMutation(c.config, OpUpdateOne, withUserPlatformQuotaID(id))
- return &UserPlatformQuotaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for UserPlatformQuota.
- func (c *UserPlatformQuotaClient) Delete() *UserPlatformQuotaDelete {
- mutation := newUserPlatformQuotaMutation(c.config, OpDelete)
- return &UserPlatformQuotaDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *UserPlatformQuotaClient) DeleteOne(_m *UserPlatformQuota) *UserPlatformQuotaDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *UserPlatformQuotaClient) DeleteOneID(id int64) *UserPlatformQuotaDeleteOne {
- builder := c.Delete().Where(userplatformquota.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &UserPlatformQuotaDeleteOne{builder}
- }
- // Query returns a query builder for UserPlatformQuota.
- func (c *UserPlatformQuotaClient) Query() *UserPlatformQuotaQuery {
- return &UserPlatformQuotaQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUserPlatformQuota},
- inters: c.Interceptors(),
- }
- }
- // Get returns a UserPlatformQuota entity by its id.
- func (c *UserPlatformQuotaClient) Get(ctx context.Context, id int64) (*UserPlatformQuota, error) {
- return c.Query().Where(userplatformquota.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *UserPlatformQuotaClient) GetX(ctx context.Context, id int64) *UserPlatformQuota {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a UserPlatformQuota.
- func (c *UserPlatformQuotaClient) QueryUser(_m *UserPlatformQuota) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(userplatformquota.Table, userplatformquota.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, userplatformquota.UserTable, userplatformquota.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *UserPlatformQuotaClient) Hooks() []Hook {
- hooks := c.hooks.UserPlatformQuota
- return append(hooks[:len(hooks):len(hooks)], userplatformquota.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *UserPlatformQuotaClient) Interceptors() []Interceptor {
- inters := c.inters.UserPlatformQuota
- return append(inters[:len(inters):len(inters)], userplatformquota.Interceptors[:]...)
- }
- func (c *UserPlatformQuotaClient) mutate(ctx context.Context, m *UserPlatformQuotaMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UserPlatformQuotaCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UserPlatformQuotaUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UserPlatformQuotaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UserPlatformQuotaDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown UserPlatformQuota mutation op: %q", m.Op())
- }
- }
- // UserSubscriptionClient is a client for the UserSubscription schema.
- type UserSubscriptionClient struct {
- config
- }
- // NewUserSubscriptionClient returns a client for the UserSubscription from the given config.
- func NewUserSubscriptionClient(c config) *UserSubscriptionClient {
- return &UserSubscriptionClient{config: c}
- }
- // Use adds a list of mutation hooks to the hooks stack.
- // A call to `Use(f, g, h)` equals to `usersubscription.Hooks(f(g(h())))`.
- func (c *UserSubscriptionClient) Use(hooks ...Hook) {
- c.hooks.UserSubscription = append(c.hooks.UserSubscription, hooks...)
- }
- // Intercept adds a list of query interceptors to the interceptors stack.
- // A call to `Intercept(f, g, h)` equals to `usersubscription.Intercept(f(g(h())))`.
- func (c *UserSubscriptionClient) Intercept(interceptors ...Interceptor) {
- c.inters.UserSubscription = append(c.inters.UserSubscription, interceptors...)
- }
- // Create returns a builder for creating a UserSubscription entity.
- func (c *UserSubscriptionClient) Create() *UserSubscriptionCreate {
- mutation := newUserSubscriptionMutation(c.config, OpCreate)
- return &UserSubscriptionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // CreateBulk returns a builder for creating a bulk of UserSubscription entities.
- func (c *UserSubscriptionClient) CreateBulk(builders ...*UserSubscriptionCreate) *UserSubscriptionCreateBulk {
- return &UserSubscriptionCreateBulk{config: c.config, builders: builders}
- }
- // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
- // a builder and applies setFunc on it.
- func (c *UserSubscriptionClient) MapCreateBulk(slice any, setFunc func(*UserSubscriptionCreate, int)) *UserSubscriptionCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &UserSubscriptionCreateBulk{err: fmt.Errorf("calling to UserSubscriptionClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*UserSubscriptionCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &UserSubscriptionCreateBulk{config: c.config, builders: builders}
- }
- // Update returns an update builder for UserSubscription.
- func (c *UserSubscriptionClient) Update() *UserSubscriptionUpdate {
- mutation := newUserSubscriptionMutation(c.config, OpUpdate)
- return &UserSubscriptionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOne returns an update builder for the given entity.
- func (c *UserSubscriptionClient) UpdateOne(_m *UserSubscription) *UserSubscriptionUpdateOne {
- mutation := newUserSubscriptionMutation(c.config, OpUpdateOne, withUserSubscription(_m))
- return &UserSubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // UpdateOneID returns an update builder for the given id.
- func (c *UserSubscriptionClient) UpdateOneID(id int64) *UserSubscriptionUpdateOne {
- mutation := newUserSubscriptionMutation(c.config, OpUpdateOne, withUserSubscriptionID(id))
- return &UserSubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // Delete returns a delete builder for UserSubscription.
- func (c *UserSubscriptionClient) Delete() *UserSubscriptionDelete {
- mutation := newUserSubscriptionMutation(c.config, OpDelete)
- return &UserSubscriptionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
- }
- // DeleteOne returns a builder for deleting the given entity.
- func (c *UserSubscriptionClient) DeleteOne(_m *UserSubscription) *UserSubscriptionDeleteOne {
- return c.DeleteOneID(_m.ID)
- }
- // DeleteOneID returns a builder for deleting the given entity by its id.
- func (c *UserSubscriptionClient) DeleteOneID(id int64) *UserSubscriptionDeleteOne {
- builder := c.Delete().Where(usersubscription.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &UserSubscriptionDeleteOne{builder}
- }
- // Query returns a query builder for UserSubscription.
- func (c *UserSubscriptionClient) Query() *UserSubscriptionQuery {
- return &UserSubscriptionQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeUserSubscription},
- inters: c.Interceptors(),
- }
- }
- // Get returns a UserSubscription entity by its id.
- func (c *UserSubscriptionClient) Get(ctx context.Context, id int64) (*UserSubscription, error) {
- return c.Query().Where(usersubscription.ID(id)).Only(ctx)
- }
- // GetX is like Get, but panics if an error occurs.
- func (c *UserSubscriptionClient) GetX(ctx context.Context, id int64) *UserSubscription {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
- }
- // QueryUser queries the user edge of a UserSubscription.
- func (c *UserSubscriptionClient) QueryUser(_m *UserSubscription) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usersubscription.Table, usersubscription.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usersubscription.UserTable, usersubscription.UserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryGroup queries the group edge of a UserSubscription.
- func (c *UserSubscriptionClient) QueryGroup(_m *UserSubscription) *GroupQuery {
- query := (&GroupClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usersubscription.Table, usersubscription.FieldID, id),
- sqlgraph.To(group.Table, group.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usersubscription.GroupTable, usersubscription.GroupColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryAssignedByUser queries the assigned_by_user edge of a UserSubscription.
- func (c *UserSubscriptionClient) QueryAssignedByUser(_m *UserSubscription) *UserQuery {
- query := (&UserClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usersubscription.Table, usersubscription.FieldID, id),
- sqlgraph.To(user.Table, user.FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, usersubscription.AssignedByUserTable, usersubscription.AssignedByUserColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // QueryUsageLogs queries the usage_logs edge of a UserSubscription.
- func (c *UserSubscriptionClient) QueryUsageLogs(_m *UserSubscription) *UsageLogQuery {
- query := (&UsageLogClient{config: c.config}).Query()
- query.path = func(context.Context) (fromV *sql.Selector, _ error) {
- id := _m.ID
- step := sqlgraph.NewStep(
- sqlgraph.From(usersubscription.Table, usersubscription.FieldID, id),
- sqlgraph.To(usagelog.Table, usagelog.FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, usersubscription.UsageLogsTable, usersubscription.UsageLogsColumn),
- )
- fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
- return fromV, nil
- }
- return query
- }
- // Hooks returns the client hooks.
- func (c *UserSubscriptionClient) Hooks() []Hook {
- hooks := c.hooks.UserSubscription
- return append(hooks[:len(hooks):len(hooks)], usersubscription.Hooks[:]...)
- }
- // Interceptors returns the client interceptors.
- func (c *UserSubscriptionClient) Interceptors() []Interceptor {
- inters := c.inters.UserSubscription
- return append(inters[:len(inters):len(inters)], usersubscription.Interceptors[:]...)
- }
- func (c *UserSubscriptionClient) mutate(ctx context.Context, m *UserSubscriptionMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&UserSubscriptionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&UserSubscriptionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&UserSubscriptionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&UserSubscriptionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown UserSubscription mutation op: %q", m.Op())
- }
- }
- // hooks and interceptors per client, for fast access.
- type (
- hooks struct {
- APIKey, Account, AccountGroup, Announcement, AnnouncementRead, AuthIdentity,
- AuthIdentityChannel, BatchImageEvent, BatchImageItem, BatchImageJob,
- ChannelMonitor, ChannelMonitorDailyRollup, ChannelMonitorHistory,
- ChannelMonitorRequestTemplate, CompositeModelRoute, ErrorPassthroughRule,
- Group, IdempotencyRecord, IdentityAdoptionDecision, PaymentAuditLog,
- PaymentOrder, PaymentProviderInstance, PendingAuthSession, PromoCode,
- PromoCodeUsage, Proxy, RedeemCode, SecurityPolicyKeyword, SecuritySecret,
- Setting, SubscriptionPlan, TLSFingerprintProfile, UsageCleanupTask, UsageLog,
- User, UserAllowedGroup, UserAttributeDefinition, UserAttributeValue,
- UserPlatformQuota, UserSubscription []ent.Hook
- }
- inters struct {
- APIKey, Account, AccountGroup, Announcement, AnnouncementRead, AuthIdentity,
- AuthIdentityChannel, BatchImageEvent, BatchImageItem, BatchImageJob,
- ChannelMonitor, ChannelMonitorDailyRollup, ChannelMonitorHistory,
- ChannelMonitorRequestTemplate, CompositeModelRoute, ErrorPassthroughRule,
- Group, IdempotencyRecord, IdentityAdoptionDecision, PaymentAuditLog,
- PaymentOrder, PaymentProviderInstance, PendingAuthSession, PromoCode,
- PromoCodeUsage, Proxy, RedeemCode, SecurityPolicyKeyword, SecuritySecret,
- Setting, SubscriptionPlan, TLSFingerprintProfile, UsageCleanupTask, UsageLog,
- User, UserAllowedGroup, UserAttributeDefinition, UserAttributeValue,
- UserPlatformQuota, UserSubscription []ent.Interceptor
- }
- )
- // ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it.
- // See, database/sql#DB.ExecContext for more information.
- func (c *config) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error) {
- ex, ok := c.driver.(interface {
- ExecContext(context.Context, string, ...any) (stdsql.Result, error)
- })
- if !ok {
- return nil, fmt.Errorf("Driver.ExecContext is not supported")
- }
- return ex.ExecContext(ctx, query, args...)
- }
- // QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it.
- // See, database/sql#DB.QueryContext for more information.
- func (c *config) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error) {
- q, ok := c.driver.(interface {
- QueryContext(context.Context, string, ...any) (*stdsql.Rows, error)
- })
- if !ok {
- return nil, fmt.Errorf("Driver.QueryContext is not supported")
- }
- return q.QueryContext(ctx, query, args...)
- }
|