| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- "github.com/Wei-Shaw/sub2api/ent/account"
- "github.com/Wei-Shaw/sub2api/ent/group"
- "github.com/Wei-Shaw/sub2api/ent/proxy"
- "github.com/Wei-Shaw/sub2api/ent/usagelog"
- )
- // AccountCreate is the builder for creating a Account entity.
- type AccountCreate struct {
- config
- mutation *AccountMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (_c *AccountCreate) SetCreatedAt(v time.Time) *AccountCreate {
- _c.mutation.SetCreatedAt(v)
- return _c
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableCreatedAt(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetCreatedAt(*v)
- }
- return _c
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (_c *AccountCreate) SetUpdatedAt(v time.Time) *AccountCreate {
- _c.mutation.SetUpdatedAt(v)
- return _c
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableUpdatedAt(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetUpdatedAt(*v)
- }
- return _c
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (_c *AccountCreate) SetDeletedAt(v time.Time) *AccountCreate {
- _c.mutation.SetDeletedAt(v)
- return _c
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableDeletedAt(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetDeletedAt(*v)
- }
- return _c
- }
- // SetName sets the "name" field.
- func (_c *AccountCreate) SetName(v string) *AccountCreate {
- _c.mutation.SetName(v)
- return _c
- }
- // SetNotes sets the "notes" field.
- func (_c *AccountCreate) SetNotes(v string) *AccountCreate {
- _c.mutation.SetNotes(v)
- return _c
- }
- // SetNillableNotes sets the "notes" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableNotes(v *string) *AccountCreate {
- if v != nil {
- _c.SetNotes(*v)
- }
- return _c
- }
- // SetPlatform sets the "platform" field.
- func (_c *AccountCreate) SetPlatform(v string) *AccountCreate {
- _c.mutation.SetPlatform(v)
- return _c
- }
- // SetType sets the "type" field.
- func (_c *AccountCreate) SetType(v string) *AccountCreate {
- _c.mutation.SetType(v)
- return _c
- }
- // SetCredentials sets the "credentials" field.
- func (_c *AccountCreate) SetCredentials(v map[string]interface{}) *AccountCreate {
- _c.mutation.SetCredentials(v)
- return _c
- }
- // SetExtra sets the "extra" field.
- func (_c *AccountCreate) SetExtra(v map[string]interface{}) *AccountCreate {
- _c.mutation.SetExtra(v)
- return _c
- }
- // SetProxyID sets the "proxy_id" field.
- func (_c *AccountCreate) SetProxyID(v int64) *AccountCreate {
- _c.mutation.SetProxyID(v)
- return _c
- }
- // SetNillableProxyID sets the "proxy_id" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableProxyID(v *int64) *AccountCreate {
- if v != nil {
- _c.SetProxyID(*v)
- }
- return _c
- }
- // SetProxyFallbackOriginID sets the "proxy_fallback_origin_id" field.
- func (_c *AccountCreate) SetProxyFallbackOriginID(v int64) *AccountCreate {
- _c.mutation.SetProxyFallbackOriginID(v)
- return _c
- }
- // SetNillableProxyFallbackOriginID sets the "proxy_fallback_origin_id" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableProxyFallbackOriginID(v *int64) *AccountCreate {
- if v != nil {
- _c.SetProxyFallbackOriginID(*v)
- }
- return _c
- }
- // SetConcurrency sets the "concurrency" field.
- func (_c *AccountCreate) SetConcurrency(v int) *AccountCreate {
- _c.mutation.SetConcurrency(v)
- return _c
- }
- // SetNillableConcurrency sets the "concurrency" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableConcurrency(v *int) *AccountCreate {
- if v != nil {
- _c.SetConcurrency(*v)
- }
- return _c
- }
- // SetLoadFactor sets the "load_factor" field.
- func (_c *AccountCreate) SetLoadFactor(v int) *AccountCreate {
- _c.mutation.SetLoadFactor(v)
- return _c
- }
- // SetNillableLoadFactor sets the "load_factor" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableLoadFactor(v *int) *AccountCreate {
- if v != nil {
- _c.SetLoadFactor(*v)
- }
- return _c
- }
- // SetPriority sets the "priority" field.
- func (_c *AccountCreate) SetPriority(v int) *AccountCreate {
- _c.mutation.SetPriority(v)
- return _c
- }
- // SetNillablePriority sets the "priority" field if the given value is not nil.
- func (_c *AccountCreate) SetNillablePriority(v *int) *AccountCreate {
- if v != nil {
- _c.SetPriority(*v)
- }
- return _c
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (_c *AccountCreate) SetRateMultiplier(v float64) *AccountCreate {
- _c.mutation.SetRateMultiplier(v)
- return _c
- }
- // SetNillableRateMultiplier sets the "rate_multiplier" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableRateMultiplier(v *float64) *AccountCreate {
- if v != nil {
- _c.SetRateMultiplier(*v)
- }
- return _c
- }
- // SetStatus sets the "status" field.
- func (_c *AccountCreate) SetStatus(v string) *AccountCreate {
- _c.mutation.SetStatus(v)
- return _c
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableStatus(v *string) *AccountCreate {
- if v != nil {
- _c.SetStatus(*v)
- }
- return _c
- }
- // SetErrorMessage sets the "error_message" field.
- func (_c *AccountCreate) SetErrorMessage(v string) *AccountCreate {
- _c.mutation.SetErrorMessage(v)
- return _c
- }
- // SetNillableErrorMessage sets the "error_message" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableErrorMessage(v *string) *AccountCreate {
- if v != nil {
- _c.SetErrorMessage(*v)
- }
- return _c
- }
- // SetLastUsedAt sets the "last_used_at" field.
- func (_c *AccountCreate) SetLastUsedAt(v time.Time) *AccountCreate {
- _c.mutation.SetLastUsedAt(v)
- return _c
- }
- // SetNillableLastUsedAt sets the "last_used_at" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableLastUsedAt(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetLastUsedAt(*v)
- }
- return _c
- }
- // SetExpiresAt sets the "expires_at" field.
- func (_c *AccountCreate) SetExpiresAt(v time.Time) *AccountCreate {
- _c.mutation.SetExpiresAt(v)
- return _c
- }
- // SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableExpiresAt(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetExpiresAt(*v)
- }
- return _c
- }
- // SetAutoPauseOnExpired sets the "auto_pause_on_expired" field.
- func (_c *AccountCreate) SetAutoPauseOnExpired(v bool) *AccountCreate {
- _c.mutation.SetAutoPauseOnExpired(v)
- return _c
- }
- // SetNillableAutoPauseOnExpired sets the "auto_pause_on_expired" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableAutoPauseOnExpired(v *bool) *AccountCreate {
- if v != nil {
- _c.SetAutoPauseOnExpired(*v)
- }
- return _c
- }
- // SetSchedulable sets the "schedulable" field.
- func (_c *AccountCreate) SetSchedulable(v bool) *AccountCreate {
- _c.mutation.SetSchedulable(v)
- return _c
- }
- // SetNillableSchedulable sets the "schedulable" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableSchedulable(v *bool) *AccountCreate {
- if v != nil {
- _c.SetSchedulable(*v)
- }
- return _c
- }
- // SetRateLimitedAt sets the "rate_limited_at" field.
- func (_c *AccountCreate) SetRateLimitedAt(v time.Time) *AccountCreate {
- _c.mutation.SetRateLimitedAt(v)
- return _c
- }
- // SetNillableRateLimitedAt sets the "rate_limited_at" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableRateLimitedAt(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetRateLimitedAt(*v)
- }
- return _c
- }
- // SetRateLimitResetAt sets the "rate_limit_reset_at" field.
- func (_c *AccountCreate) SetRateLimitResetAt(v time.Time) *AccountCreate {
- _c.mutation.SetRateLimitResetAt(v)
- return _c
- }
- // SetNillableRateLimitResetAt sets the "rate_limit_reset_at" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableRateLimitResetAt(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetRateLimitResetAt(*v)
- }
- return _c
- }
- // SetOverloadUntil sets the "overload_until" field.
- func (_c *AccountCreate) SetOverloadUntil(v time.Time) *AccountCreate {
- _c.mutation.SetOverloadUntil(v)
- return _c
- }
- // SetNillableOverloadUntil sets the "overload_until" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableOverloadUntil(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetOverloadUntil(*v)
- }
- return _c
- }
- // SetTempUnschedulableUntil sets the "temp_unschedulable_until" field.
- func (_c *AccountCreate) SetTempUnschedulableUntil(v time.Time) *AccountCreate {
- _c.mutation.SetTempUnschedulableUntil(v)
- return _c
- }
- // SetNillableTempUnschedulableUntil sets the "temp_unschedulable_until" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableTempUnschedulableUntil(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetTempUnschedulableUntil(*v)
- }
- return _c
- }
- // SetTempUnschedulableReason sets the "temp_unschedulable_reason" field.
- func (_c *AccountCreate) SetTempUnschedulableReason(v string) *AccountCreate {
- _c.mutation.SetTempUnschedulableReason(v)
- return _c
- }
- // SetNillableTempUnschedulableReason sets the "temp_unschedulable_reason" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableTempUnschedulableReason(v *string) *AccountCreate {
- if v != nil {
- _c.SetTempUnschedulableReason(*v)
- }
- return _c
- }
- // SetSessionWindowStart sets the "session_window_start" field.
- func (_c *AccountCreate) SetSessionWindowStart(v time.Time) *AccountCreate {
- _c.mutation.SetSessionWindowStart(v)
- return _c
- }
- // SetNillableSessionWindowStart sets the "session_window_start" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableSessionWindowStart(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetSessionWindowStart(*v)
- }
- return _c
- }
- // SetSessionWindowEnd sets the "session_window_end" field.
- func (_c *AccountCreate) SetSessionWindowEnd(v time.Time) *AccountCreate {
- _c.mutation.SetSessionWindowEnd(v)
- return _c
- }
- // SetNillableSessionWindowEnd sets the "session_window_end" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableSessionWindowEnd(v *time.Time) *AccountCreate {
- if v != nil {
- _c.SetSessionWindowEnd(*v)
- }
- return _c
- }
- // SetSessionWindowStatus sets the "session_window_status" field.
- func (_c *AccountCreate) SetSessionWindowStatus(v string) *AccountCreate {
- _c.mutation.SetSessionWindowStatus(v)
- return _c
- }
- // SetNillableSessionWindowStatus sets the "session_window_status" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableSessionWindowStatus(v *string) *AccountCreate {
- if v != nil {
- _c.SetSessionWindowStatus(*v)
- }
- return _c
- }
- // SetParentAccountID sets the "parent_account_id" field.
- func (_c *AccountCreate) SetParentAccountID(v int64) *AccountCreate {
- _c.mutation.SetParentAccountID(v)
- return _c
- }
- // SetNillableParentAccountID sets the "parent_account_id" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableParentAccountID(v *int64) *AccountCreate {
- if v != nil {
- _c.SetParentAccountID(*v)
- }
- return _c
- }
- // SetQuotaDimension sets the "quota_dimension" field.
- func (_c *AccountCreate) SetQuotaDimension(v account.QuotaDimension) *AccountCreate {
- _c.mutation.SetQuotaDimension(v)
- return _c
- }
- // SetNillableQuotaDimension sets the "quota_dimension" field if the given value is not nil.
- func (_c *AccountCreate) SetNillableQuotaDimension(v *account.QuotaDimension) *AccountCreate {
- if v != nil {
- _c.SetQuotaDimension(*v)
- }
- return _c
- }
- // AddGroupIDs adds the "groups" edge to the Group entity by IDs.
- func (_c *AccountCreate) AddGroupIDs(ids ...int64) *AccountCreate {
- _c.mutation.AddGroupIDs(ids...)
- return _c
- }
- // AddGroups adds the "groups" edges to the Group entity.
- func (_c *AccountCreate) AddGroups(v ...*Group) *AccountCreate {
- ids := make([]int64, len(v))
- for i := range v {
- ids[i] = v[i].ID
- }
- return _c.AddGroupIDs(ids...)
- }
- // SetProxy sets the "proxy" edge to the Proxy entity.
- func (_c *AccountCreate) SetProxy(v *Proxy) *AccountCreate {
- return _c.SetProxyID(v.ID)
- }
- // SetParentID sets the "parent" edge to the Account entity by ID.
- func (_c *AccountCreate) SetParentID(id int64) *AccountCreate {
- _c.mutation.SetParentID(id)
- return _c
- }
- // SetNillableParentID sets the "parent" edge to the Account entity by ID if the given value is not nil.
- func (_c *AccountCreate) SetNillableParentID(id *int64) *AccountCreate {
- if id != nil {
- _c = _c.SetParentID(*id)
- }
- return _c
- }
- // SetParent sets the "parent" edge to the Account entity.
- func (_c *AccountCreate) SetParent(v *Account) *AccountCreate {
- return _c.SetParentID(v.ID)
- }
- // AddChildIDs adds the "children" edge to the Account entity by IDs.
- func (_c *AccountCreate) AddChildIDs(ids ...int64) *AccountCreate {
- _c.mutation.AddChildIDs(ids...)
- return _c
- }
- // AddChildren adds the "children" edges to the Account entity.
- func (_c *AccountCreate) AddChildren(v ...*Account) *AccountCreate {
- ids := make([]int64, len(v))
- for i := range v {
- ids[i] = v[i].ID
- }
- return _c.AddChildIDs(ids...)
- }
- // AddUsageLogIDs adds the "usage_logs" edge to the UsageLog entity by IDs.
- func (_c *AccountCreate) AddUsageLogIDs(ids ...int64) *AccountCreate {
- _c.mutation.AddUsageLogIDs(ids...)
- return _c
- }
- // AddUsageLogs adds the "usage_logs" edges to the UsageLog entity.
- func (_c *AccountCreate) AddUsageLogs(v ...*UsageLog) *AccountCreate {
- ids := make([]int64, len(v))
- for i := range v {
- ids[i] = v[i].ID
- }
- return _c.AddUsageLogIDs(ids...)
- }
- // Mutation returns the AccountMutation object of the builder.
- func (_c *AccountCreate) Mutation() *AccountMutation {
- return _c.mutation
- }
- // Save creates the Account in the database.
- func (_c *AccountCreate) Save(ctx context.Context) (*Account, error) {
- if err := _c.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (_c *AccountCreate) SaveX(ctx context.Context) *Account {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (_c *AccountCreate) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_c *AccountCreate) ExecX(ctx context.Context) {
- if err := _c.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (_c *AccountCreate) defaults() error {
- if _, ok := _c.mutation.CreatedAt(); !ok {
- if account.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized account.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := account.DefaultCreatedAt()
- _c.mutation.SetCreatedAt(v)
- }
- if _, ok := _c.mutation.UpdatedAt(); !ok {
- if account.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized account.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := account.DefaultUpdatedAt()
- _c.mutation.SetUpdatedAt(v)
- }
- if _, ok := _c.mutation.Credentials(); !ok {
- if account.DefaultCredentials == nil {
- return fmt.Errorf("ent: uninitialized account.DefaultCredentials (forgotten import ent/runtime?)")
- }
- v := account.DefaultCredentials()
- _c.mutation.SetCredentials(v)
- }
- if _, ok := _c.mutation.Extra(); !ok {
- if account.DefaultExtra == nil {
- return fmt.Errorf("ent: uninitialized account.DefaultExtra (forgotten import ent/runtime?)")
- }
- v := account.DefaultExtra()
- _c.mutation.SetExtra(v)
- }
- if _, ok := _c.mutation.Concurrency(); !ok {
- v := account.DefaultConcurrency
- _c.mutation.SetConcurrency(v)
- }
- if _, ok := _c.mutation.Priority(); !ok {
- v := account.DefaultPriority
- _c.mutation.SetPriority(v)
- }
- if _, ok := _c.mutation.RateMultiplier(); !ok {
- v := account.DefaultRateMultiplier
- _c.mutation.SetRateMultiplier(v)
- }
- if _, ok := _c.mutation.Status(); !ok {
- v := account.DefaultStatus
- _c.mutation.SetStatus(v)
- }
- if _, ok := _c.mutation.AutoPauseOnExpired(); !ok {
- v := account.DefaultAutoPauseOnExpired
- _c.mutation.SetAutoPauseOnExpired(v)
- }
- if _, ok := _c.mutation.Schedulable(); !ok {
- v := account.DefaultSchedulable
- _c.mutation.SetSchedulable(v)
- }
- if _, ok := _c.mutation.QuotaDimension(); !ok {
- v := account.DefaultQuotaDimension
- _c.mutation.SetQuotaDimension(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (_c *AccountCreate) check() error {
- if _, ok := _c.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Account.created_at"`)}
- }
- if _, ok := _c.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Account.updated_at"`)}
- }
- if _, ok := _c.mutation.Name(); !ok {
- return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Account.name"`)}
- }
- if v, ok := _c.mutation.Name(); ok {
- if err := account.NameValidator(v); err != nil {
- return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Account.name": %w`, err)}
- }
- }
- if _, ok := _c.mutation.Platform(); !ok {
- return &ValidationError{Name: "platform", err: errors.New(`ent: missing required field "Account.platform"`)}
- }
- if v, ok := _c.mutation.Platform(); ok {
- if err := account.PlatformValidator(v); err != nil {
- return &ValidationError{Name: "platform", err: fmt.Errorf(`ent: validator failed for field "Account.platform": %w`, err)}
- }
- }
- if _, ok := _c.mutation.GetType(); !ok {
- return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Account.type"`)}
- }
- if v, ok := _c.mutation.GetType(); ok {
- if err := account.TypeValidator(v); err != nil {
- return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Account.type": %w`, err)}
- }
- }
- if _, ok := _c.mutation.Credentials(); !ok {
- return &ValidationError{Name: "credentials", err: errors.New(`ent: missing required field "Account.credentials"`)}
- }
- if _, ok := _c.mutation.Extra(); !ok {
- return &ValidationError{Name: "extra", err: errors.New(`ent: missing required field "Account.extra"`)}
- }
- if _, ok := _c.mutation.Concurrency(); !ok {
- return &ValidationError{Name: "concurrency", err: errors.New(`ent: missing required field "Account.concurrency"`)}
- }
- if _, ok := _c.mutation.Priority(); !ok {
- return &ValidationError{Name: "priority", err: errors.New(`ent: missing required field "Account.priority"`)}
- }
- if _, ok := _c.mutation.RateMultiplier(); !ok {
- return &ValidationError{Name: "rate_multiplier", err: errors.New(`ent: missing required field "Account.rate_multiplier"`)}
- }
- if _, ok := _c.mutation.Status(); !ok {
- return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Account.status"`)}
- }
- if v, ok := _c.mutation.Status(); ok {
- if err := account.StatusValidator(v); err != nil {
- return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Account.status": %w`, err)}
- }
- }
- if _, ok := _c.mutation.AutoPauseOnExpired(); !ok {
- return &ValidationError{Name: "auto_pause_on_expired", err: errors.New(`ent: missing required field "Account.auto_pause_on_expired"`)}
- }
- if _, ok := _c.mutation.Schedulable(); !ok {
- return &ValidationError{Name: "schedulable", err: errors.New(`ent: missing required field "Account.schedulable"`)}
- }
- if v, ok := _c.mutation.SessionWindowStatus(); ok {
- if err := account.SessionWindowStatusValidator(v); err != nil {
- return &ValidationError{Name: "session_window_status", err: fmt.Errorf(`ent: validator failed for field "Account.session_window_status": %w`, err)}
- }
- }
- if _, ok := _c.mutation.QuotaDimension(); !ok {
- return &ValidationError{Name: "quota_dimension", err: errors.New(`ent: missing required field "Account.quota_dimension"`)}
- }
- if v, ok := _c.mutation.QuotaDimension(); ok {
- if err := account.QuotaDimensionValidator(v); err != nil {
- return &ValidationError{Name: "quota_dimension", err: fmt.Errorf(`ent: validator failed for field "Account.quota_dimension": %w`, err)}
- }
- }
- return nil
- }
- func (_c *AccountCreate) sqlSave(ctx context.Context) (*Account, error) {
- if err := _c.check(); err != nil {
- return nil, err
- }
- _node, _spec := _c.createSpec()
- if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- id := _spec.ID.Value.(int64)
- _node.ID = int64(id)
- _c.mutation.id = &_node.ID
- _c.mutation.done = true
- return _node, nil
- }
- func (_c *AccountCreate) createSpec() (*Account, *sqlgraph.CreateSpec) {
- var (
- _node = &Account{config: _c.config}
- _spec = sqlgraph.NewCreateSpec(account.Table, sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64))
- )
- _spec.OnConflict = _c.conflict
- if value, ok := _c.mutation.CreatedAt(); ok {
- _spec.SetField(account.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := _c.mutation.UpdatedAt(); ok {
- _spec.SetField(account.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := _c.mutation.DeletedAt(); ok {
- _spec.SetField(account.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = &value
- }
- if value, ok := _c.mutation.Name(); ok {
- _spec.SetField(account.FieldName, field.TypeString, value)
- _node.Name = value
- }
- if value, ok := _c.mutation.Notes(); ok {
- _spec.SetField(account.FieldNotes, field.TypeString, value)
- _node.Notes = &value
- }
- if value, ok := _c.mutation.Platform(); ok {
- _spec.SetField(account.FieldPlatform, field.TypeString, value)
- _node.Platform = value
- }
- if value, ok := _c.mutation.GetType(); ok {
- _spec.SetField(account.FieldType, field.TypeString, value)
- _node.Type = value
- }
- if value, ok := _c.mutation.Credentials(); ok {
- _spec.SetField(account.FieldCredentials, field.TypeJSON, value)
- _node.Credentials = value
- }
- if value, ok := _c.mutation.Extra(); ok {
- _spec.SetField(account.FieldExtra, field.TypeJSON, value)
- _node.Extra = value
- }
- if value, ok := _c.mutation.ProxyFallbackOriginID(); ok {
- _spec.SetField(account.FieldProxyFallbackOriginID, field.TypeInt64, value)
- _node.ProxyFallbackOriginID = &value
- }
- if value, ok := _c.mutation.Concurrency(); ok {
- _spec.SetField(account.FieldConcurrency, field.TypeInt, value)
- _node.Concurrency = value
- }
- if value, ok := _c.mutation.LoadFactor(); ok {
- _spec.SetField(account.FieldLoadFactor, field.TypeInt, value)
- _node.LoadFactor = &value
- }
- if value, ok := _c.mutation.Priority(); ok {
- _spec.SetField(account.FieldPriority, field.TypeInt, value)
- _node.Priority = value
- }
- if value, ok := _c.mutation.RateMultiplier(); ok {
- _spec.SetField(account.FieldRateMultiplier, field.TypeFloat64, value)
- _node.RateMultiplier = value
- }
- if value, ok := _c.mutation.Status(); ok {
- _spec.SetField(account.FieldStatus, field.TypeString, value)
- _node.Status = value
- }
- if value, ok := _c.mutation.ErrorMessage(); ok {
- _spec.SetField(account.FieldErrorMessage, field.TypeString, value)
- _node.ErrorMessage = &value
- }
- if value, ok := _c.mutation.LastUsedAt(); ok {
- _spec.SetField(account.FieldLastUsedAt, field.TypeTime, value)
- _node.LastUsedAt = &value
- }
- if value, ok := _c.mutation.ExpiresAt(); ok {
- _spec.SetField(account.FieldExpiresAt, field.TypeTime, value)
- _node.ExpiresAt = &value
- }
- if value, ok := _c.mutation.AutoPauseOnExpired(); ok {
- _spec.SetField(account.FieldAutoPauseOnExpired, field.TypeBool, value)
- _node.AutoPauseOnExpired = value
- }
- if value, ok := _c.mutation.Schedulable(); ok {
- _spec.SetField(account.FieldSchedulable, field.TypeBool, value)
- _node.Schedulable = value
- }
- if value, ok := _c.mutation.RateLimitedAt(); ok {
- _spec.SetField(account.FieldRateLimitedAt, field.TypeTime, value)
- _node.RateLimitedAt = &value
- }
- if value, ok := _c.mutation.RateLimitResetAt(); ok {
- _spec.SetField(account.FieldRateLimitResetAt, field.TypeTime, value)
- _node.RateLimitResetAt = &value
- }
- if value, ok := _c.mutation.OverloadUntil(); ok {
- _spec.SetField(account.FieldOverloadUntil, field.TypeTime, value)
- _node.OverloadUntil = &value
- }
- if value, ok := _c.mutation.TempUnschedulableUntil(); ok {
- _spec.SetField(account.FieldTempUnschedulableUntil, field.TypeTime, value)
- _node.TempUnschedulableUntil = &value
- }
- if value, ok := _c.mutation.TempUnschedulableReason(); ok {
- _spec.SetField(account.FieldTempUnschedulableReason, field.TypeString, value)
- _node.TempUnschedulableReason = &value
- }
- if value, ok := _c.mutation.SessionWindowStart(); ok {
- _spec.SetField(account.FieldSessionWindowStart, field.TypeTime, value)
- _node.SessionWindowStart = &value
- }
- if value, ok := _c.mutation.SessionWindowEnd(); ok {
- _spec.SetField(account.FieldSessionWindowEnd, field.TypeTime, value)
- _node.SessionWindowEnd = &value
- }
- if value, ok := _c.mutation.SessionWindowStatus(); ok {
- _spec.SetField(account.FieldSessionWindowStatus, field.TypeString, value)
- _node.SessionWindowStatus = &value
- }
- if value, ok := _c.mutation.QuotaDimension(); ok {
- _spec.SetField(account.FieldQuotaDimension, field.TypeEnum, value)
- _node.QuotaDimension = value
- }
- if nodes := _c.mutation.GroupsIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2M,
- Inverse: false,
- Table: account.GroupsTable,
- Columns: account.GroupsPrimaryKey,
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- createE := &AccountGroupCreate{config: _c.config, mutation: newAccountGroupMutation(_c.config, OpCreate)}
- createE.defaults()
- _, specE := createE.createSpec()
- edge.Target.Fields = specE.Fields
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.ProxyIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: false,
- Table: account.ProxyTable,
- Columns: []string{account.ProxyColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(proxy.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.ProxyID = &nodes[0]
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.ParentIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: true,
- Table: account.ParentTable,
- Columns: []string{account.ParentColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.ParentAccountID = &nodes[0]
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.ChildrenIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: account.ChildrenTable,
- Columns: []string{account.ChildrenColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := _c.mutation.UsageLogsIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: account.UsageLogsTable,
- Columns: []string{account.UsageLogsColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(usagelog.FieldID, field.TypeInt64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Account.Create().
- // SetCreatedAt(v).
- // OnConflict(
- // // Update the row with the new values
- // // the was proposed for insertion.
- // sql.ResolveWithNewValues(),
- // ).
- // // Override some of the fields with custom
- // // update values.
- // Update(func(u *ent.AccountUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (_c *AccountCreate) OnConflict(opts ...sql.ConflictOption) *AccountUpsertOne {
- _c.conflict = opts
- return &AccountUpsertOne{
- create: _c,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Account.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (_c *AccountCreate) OnConflictColumns(columns ...string) *AccountUpsertOne {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &AccountUpsertOne{
- create: _c,
- }
- }
- type (
- // AccountUpsertOne is the builder for "upsert"-ing
- // one Account node.
- AccountUpsertOne struct {
- create *AccountCreate
- }
- // AccountUpsert is the "OnConflict" setter.
- AccountUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AccountUpsert) SetUpdatedAt(v time.Time) *AccountUpsert {
- u.Set(account.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateUpdatedAt() *AccountUpsert {
- u.SetExcluded(account.FieldUpdatedAt)
- return u
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *AccountUpsert) SetDeletedAt(v time.Time) *AccountUpsert {
- u.Set(account.FieldDeletedAt, v)
- return u
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateDeletedAt() *AccountUpsert {
- u.SetExcluded(account.FieldDeletedAt)
- return u
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *AccountUpsert) ClearDeletedAt() *AccountUpsert {
- u.SetNull(account.FieldDeletedAt)
- return u
- }
- // SetName sets the "name" field.
- func (u *AccountUpsert) SetName(v string) *AccountUpsert {
- u.Set(account.FieldName, v)
- return u
- }
- // UpdateName sets the "name" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateName() *AccountUpsert {
- u.SetExcluded(account.FieldName)
- return u
- }
- // SetNotes sets the "notes" field.
- func (u *AccountUpsert) SetNotes(v string) *AccountUpsert {
- u.Set(account.FieldNotes, v)
- return u
- }
- // UpdateNotes sets the "notes" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateNotes() *AccountUpsert {
- u.SetExcluded(account.FieldNotes)
- return u
- }
- // ClearNotes clears the value of the "notes" field.
- func (u *AccountUpsert) ClearNotes() *AccountUpsert {
- u.SetNull(account.FieldNotes)
- return u
- }
- // SetPlatform sets the "platform" field.
- func (u *AccountUpsert) SetPlatform(v string) *AccountUpsert {
- u.Set(account.FieldPlatform, v)
- return u
- }
- // UpdatePlatform sets the "platform" field to the value that was provided on create.
- func (u *AccountUpsert) UpdatePlatform() *AccountUpsert {
- u.SetExcluded(account.FieldPlatform)
- return u
- }
- // SetType sets the "type" field.
- func (u *AccountUpsert) SetType(v string) *AccountUpsert {
- u.Set(account.FieldType, v)
- return u
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateType() *AccountUpsert {
- u.SetExcluded(account.FieldType)
- return u
- }
- // SetCredentials sets the "credentials" field.
- func (u *AccountUpsert) SetCredentials(v map[string]interface{}) *AccountUpsert {
- u.Set(account.FieldCredentials, v)
- return u
- }
- // UpdateCredentials sets the "credentials" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateCredentials() *AccountUpsert {
- u.SetExcluded(account.FieldCredentials)
- return u
- }
- // SetExtra sets the "extra" field.
- func (u *AccountUpsert) SetExtra(v map[string]interface{}) *AccountUpsert {
- u.Set(account.FieldExtra, v)
- return u
- }
- // UpdateExtra sets the "extra" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateExtra() *AccountUpsert {
- u.SetExcluded(account.FieldExtra)
- return u
- }
- // SetProxyID sets the "proxy_id" field.
- func (u *AccountUpsert) SetProxyID(v int64) *AccountUpsert {
- u.Set(account.FieldProxyID, v)
- return u
- }
- // UpdateProxyID sets the "proxy_id" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateProxyID() *AccountUpsert {
- u.SetExcluded(account.FieldProxyID)
- return u
- }
- // ClearProxyID clears the value of the "proxy_id" field.
- func (u *AccountUpsert) ClearProxyID() *AccountUpsert {
- u.SetNull(account.FieldProxyID)
- return u
- }
- // SetProxyFallbackOriginID sets the "proxy_fallback_origin_id" field.
- func (u *AccountUpsert) SetProxyFallbackOriginID(v int64) *AccountUpsert {
- u.Set(account.FieldProxyFallbackOriginID, v)
- return u
- }
- // UpdateProxyFallbackOriginID sets the "proxy_fallback_origin_id" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateProxyFallbackOriginID() *AccountUpsert {
- u.SetExcluded(account.FieldProxyFallbackOriginID)
- return u
- }
- // AddProxyFallbackOriginID adds v to the "proxy_fallback_origin_id" field.
- func (u *AccountUpsert) AddProxyFallbackOriginID(v int64) *AccountUpsert {
- u.Add(account.FieldProxyFallbackOriginID, v)
- return u
- }
- // ClearProxyFallbackOriginID clears the value of the "proxy_fallback_origin_id" field.
- func (u *AccountUpsert) ClearProxyFallbackOriginID() *AccountUpsert {
- u.SetNull(account.FieldProxyFallbackOriginID)
- return u
- }
- // SetConcurrency sets the "concurrency" field.
- func (u *AccountUpsert) SetConcurrency(v int) *AccountUpsert {
- u.Set(account.FieldConcurrency, v)
- return u
- }
- // UpdateConcurrency sets the "concurrency" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateConcurrency() *AccountUpsert {
- u.SetExcluded(account.FieldConcurrency)
- return u
- }
- // AddConcurrency adds v to the "concurrency" field.
- func (u *AccountUpsert) AddConcurrency(v int) *AccountUpsert {
- u.Add(account.FieldConcurrency, v)
- return u
- }
- // SetLoadFactor sets the "load_factor" field.
- func (u *AccountUpsert) SetLoadFactor(v int) *AccountUpsert {
- u.Set(account.FieldLoadFactor, v)
- return u
- }
- // UpdateLoadFactor sets the "load_factor" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateLoadFactor() *AccountUpsert {
- u.SetExcluded(account.FieldLoadFactor)
- return u
- }
- // AddLoadFactor adds v to the "load_factor" field.
- func (u *AccountUpsert) AddLoadFactor(v int) *AccountUpsert {
- u.Add(account.FieldLoadFactor, v)
- return u
- }
- // ClearLoadFactor clears the value of the "load_factor" field.
- func (u *AccountUpsert) ClearLoadFactor() *AccountUpsert {
- u.SetNull(account.FieldLoadFactor)
- return u
- }
- // SetPriority sets the "priority" field.
- func (u *AccountUpsert) SetPriority(v int) *AccountUpsert {
- u.Set(account.FieldPriority, v)
- return u
- }
- // UpdatePriority sets the "priority" field to the value that was provided on create.
- func (u *AccountUpsert) UpdatePriority() *AccountUpsert {
- u.SetExcluded(account.FieldPriority)
- return u
- }
- // AddPriority adds v to the "priority" field.
- func (u *AccountUpsert) AddPriority(v int) *AccountUpsert {
- u.Add(account.FieldPriority, v)
- return u
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (u *AccountUpsert) SetRateMultiplier(v float64) *AccountUpsert {
- u.Set(account.FieldRateMultiplier, v)
- return u
- }
- // UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateRateMultiplier() *AccountUpsert {
- u.SetExcluded(account.FieldRateMultiplier)
- return u
- }
- // AddRateMultiplier adds v to the "rate_multiplier" field.
- func (u *AccountUpsert) AddRateMultiplier(v float64) *AccountUpsert {
- u.Add(account.FieldRateMultiplier, v)
- return u
- }
- // SetStatus sets the "status" field.
- func (u *AccountUpsert) SetStatus(v string) *AccountUpsert {
- u.Set(account.FieldStatus, v)
- return u
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateStatus() *AccountUpsert {
- u.SetExcluded(account.FieldStatus)
- return u
- }
- // SetErrorMessage sets the "error_message" field.
- func (u *AccountUpsert) SetErrorMessage(v string) *AccountUpsert {
- u.Set(account.FieldErrorMessage, v)
- return u
- }
- // UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateErrorMessage() *AccountUpsert {
- u.SetExcluded(account.FieldErrorMessage)
- return u
- }
- // ClearErrorMessage clears the value of the "error_message" field.
- func (u *AccountUpsert) ClearErrorMessage() *AccountUpsert {
- u.SetNull(account.FieldErrorMessage)
- return u
- }
- // SetLastUsedAt sets the "last_used_at" field.
- func (u *AccountUpsert) SetLastUsedAt(v time.Time) *AccountUpsert {
- u.Set(account.FieldLastUsedAt, v)
- return u
- }
- // UpdateLastUsedAt sets the "last_used_at" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateLastUsedAt() *AccountUpsert {
- u.SetExcluded(account.FieldLastUsedAt)
- return u
- }
- // ClearLastUsedAt clears the value of the "last_used_at" field.
- func (u *AccountUpsert) ClearLastUsedAt() *AccountUpsert {
- u.SetNull(account.FieldLastUsedAt)
- return u
- }
- // SetExpiresAt sets the "expires_at" field.
- func (u *AccountUpsert) SetExpiresAt(v time.Time) *AccountUpsert {
- u.Set(account.FieldExpiresAt, v)
- return u
- }
- // UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateExpiresAt() *AccountUpsert {
- u.SetExcluded(account.FieldExpiresAt)
- return u
- }
- // ClearExpiresAt clears the value of the "expires_at" field.
- func (u *AccountUpsert) ClearExpiresAt() *AccountUpsert {
- u.SetNull(account.FieldExpiresAt)
- return u
- }
- // SetAutoPauseOnExpired sets the "auto_pause_on_expired" field.
- func (u *AccountUpsert) SetAutoPauseOnExpired(v bool) *AccountUpsert {
- u.Set(account.FieldAutoPauseOnExpired, v)
- return u
- }
- // UpdateAutoPauseOnExpired sets the "auto_pause_on_expired" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateAutoPauseOnExpired() *AccountUpsert {
- u.SetExcluded(account.FieldAutoPauseOnExpired)
- return u
- }
- // SetSchedulable sets the "schedulable" field.
- func (u *AccountUpsert) SetSchedulable(v bool) *AccountUpsert {
- u.Set(account.FieldSchedulable, v)
- return u
- }
- // UpdateSchedulable sets the "schedulable" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateSchedulable() *AccountUpsert {
- u.SetExcluded(account.FieldSchedulable)
- return u
- }
- // SetRateLimitedAt sets the "rate_limited_at" field.
- func (u *AccountUpsert) SetRateLimitedAt(v time.Time) *AccountUpsert {
- u.Set(account.FieldRateLimitedAt, v)
- return u
- }
- // UpdateRateLimitedAt sets the "rate_limited_at" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateRateLimitedAt() *AccountUpsert {
- u.SetExcluded(account.FieldRateLimitedAt)
- return u
- }
- // ClearRateLimitedAt clears the value of the "rate_limited_at" field.
- func (u *AccountUpsert) ClearRateLimitedAt() *AccountUpsert {
- u.SetNull(account.FieldRateLimitedAt)
- return u
- }
- // SetRateLimitResetAt sets the "rate_limit_reset_at" field.
- func (u *AccountUpsert) SetRateLimitResetAt(v time.Time) *AccountUpsert {
- u.Set(account.FieldRateLimitResetAt, v)
- return u
- }
- // UpdateRateLimitResetAt sets the "rate_limit_reset_at" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateRateLimitResetAt() *AccountUpsert {
- u.SetExcluded(account.FieldRateLimitResetAt)
- return u
- }
- // ClearRateLimitResetAt clears the value of the "rate_limit_reset_at" field.
- func (u *AccountUpsert) ClearRateLimitResetAt() *AccountUpsert {
- u.SetNull(account.FieldRateLimitResetAt)
- return u
- }
- // SetOverloadUntil sets the "overload_until" field.
- func (u *AccountUpsert) SetOverloadUntil(v time.Time) *AccountUpsert {
- u.Set(account.FieldOverloadUntil, v)
- return u
- }
- // UpdateOverloadUntil sets the "overload_until" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateOverloadUntil() *AccountUpsert {
- u.SetExcluded(account.FieldOverloadUntil)
- return u
- }
- // ClearOverloadUntil clears the value of the "overload_until" field.
- func (u *AccountUpsert) ClearOverloadUntil() *AccountUpsert {
- u.SetNull(account.FieldOverloadUntil)
- return u
- }
- // SetTempUnschedulableUntil sets the "temp_unschedulable_until" field.
- func (u *AccountUpsert) SetTempUnschedulableUntil(v time.Time) *AccountUpsert {
- u.Set(account.FieldTempUnschedulableUntil, v)
- return u
- }
- // UpdateTempUnschedulableUntil sets the "temp_unschedulable_until" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateTempUnschedulableUntil() *AccountUpsert {
- u.SetExcluded(account.FieldTempUnschedulableUntil)
- return u
- }
- // ClearTempUnschedulableUntil clears the value of the "temp_unschedulable_until" field.
- func (u *AccountUpsert) ClearTempUnschedulableUntil() *AccountUpsert {
- u.SetNull(account.FieldTempUnschedulableUntil)
- return u
- }
- // SetTempUnschedulableReason sets the "temp_unschedulable_reason" field.
- func (u *AccountUpsert) SetTempUnschedulableReason(v string) *AccountUpsert {
- u.Set(account.FieldTempUnschedulableReason, v)
- return u
- }
- // UpdateTempUnschedulableReason sets the "temp_unschedulable_reason" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateTempUnschedulableReason() *AccountUpsert {
- u.SetExcluded(account.FieldTempUnschedulableReason)
- return u
- }
- // ClearTempUnschedulableReason clears the value of the "temp_unschedulable_reason" field.
- func (u *AccountUpsert) ClearTempUnschedulableReason() *AccountUpsert {
- u.SetNull(account.FieldTempUnschedulableReason)
- return u
- }
- // SetSessionWindowStart sets the "session_window_start" field.
- func (u *AccountUpsert) SetSessionWindowStart(v time.Time) *AccountUpsert {
- u.Set(account.FieldSessionWindowStart, v)
- return u
- }
- // UpdateSessionWindowStart sets the "session_window_start" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateSessionWindowStart() *AccountUpsert {
- u.SetExcluded(account.FieldSessionWindowStart)
- return u
- }
- // ClearSessionWindowStart clears the value of the "session_window_start" field.
- func (u *AccountUpsert) ClearSessionWindowStart() *AccountUpsert {
- u.SetNull(account.FieldSessionWindowStart)
- return u
- }
- // SetSessionWindowEnd sets the "session_window_end" field.
- func (u *AccountUpsert) SetSessionWindowEnd(v time.Time) *AccountUpsert {
- u.Set(account.FieldSessionWindowEnd, v)
- return u
- }
- // UpdateSessionWindowEnd sets the "session_window_end" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateSessionWindowEnd() *AccountUpsert {
- u.SetExcluded(account.FieldSessionWindowEnd)
- return u
- }
- // ClearSessionWindowEnd clears the value of the "session_window_end" field.
- func (u *AccountUpsert) ClearSessionWindowEnd() *AccountUpsert {
- u.SetNull(account.FieldSessionWindowEnd)
- return u
- }
- // SetSessionWindowStatus sets the "session_window_status" field.
- func (u *AccountUpsert) SetSessionWindowStatus(v string) *AccountUpsert {
- u.Set(account.FieldSessionWindowStatus, v)
- return u
- }
- // UpdateSessionWindowStatus sets the "session_window_status" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateSessionWindowStatus() *AccountUpsert {
- u.SetExcluded(account.FieldSessionWindowStatus)
- return u
- }
- // ClearSessionWindowStatus clears the value of the "session_window_status" field.
- func (u *AccountUpsert) ClearSessionWindowStatus() *AccountUpsert {
- u.SetNull(account.FieldSessionWindowStatus)
- return u
- }
- // SetParentAccountID sets the "parent_account_id" field.
- func (u *AccountUpsert) SetParentAccountID(v int64) *AccountUpsert {
- u.Set(account.FieldParentAccountID, v)
- return u
- }
- // UpdateParentAccountID sets the "parent_account_id" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateParentAccountID() *AccountUpsert {
- u.SetExcluded(account.FieldParentAccountID)
- return u
- }
- // ClearParentAccountID clears the value of the "parent_account_id" field.
- func (u *AccountUpsert) ClearParentAccountID() *AccountUpsert {
- u.SetNull(account.FieldParentAccountID)
- return u
- }
- // SetQuotaDimension sets the "quota_dimension" field.
- func (u *AccountUpsert) SetQuotaDimension(v account.QuotaDimension) *AccountUpsert {
- u.Set(account.FieldQuotaDimension, v)
- return u
- }
- // UpdateQuotaDimension sets the "quota_dimension" field to the value that was provided on create.
- func (u *AccountUpsert) UpdateQuotaDimension() *AccountUpsert {
- u.SetExcluded(account.FieldQuotaDimension)
- return u
- }
- // UpdateNewValues updates the mutable fields using the new values that were set on create.
- // Using this option is equivalent to using:
- //
- // client.Account.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // ).
- // Exec(ctx)
- func (u *AccountUpsertOne) UpdateNewValues() *AccountUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(account.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Account.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *AccountUpsertOne) Ignore() *AccountUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- // DoNothing configures the conflict_action to `DO NOTHING`.
- // Supported only by SQLite and PostgreSQL.
- func (u *AccountUpsertOne) DoNothing() *AccountUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the AccountCreate.OnConflict
- // documentation for more info.
- func (u *AccountUpsertOne) Update(set func(*AccountUpsert)) *AccountUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&AccountUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AccountUpsertOne) SetUpdatedAt(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateUpdatedAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *AccountUpsertOne) SetDeletedAt(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateDeletedAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *AccountUpsertOne) ClearDeletedAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetName sets the "name" field.
- func (u *AccountUpsertOne) SetName(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetName(v)
- })
- }
- // UpdateName sets the "name" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateName() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateName()
- })
- }
- // SetNotes sets the "notes" field.
- func (u *AccountUpsertOne) SetNotes(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetNotes(v)
- })
- }
- // UpdateNotes sets the "notes" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateNotes() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateNotes()
- })
- }
- // ClearNotes clears the value of the "notes" field.
- func (u *AccountUpsertOne) ClearNotes() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearNotes()
- })
- }
- // SetPlatform sets the "platform" field.
- func (u *AccountUpsertOne) SetPlatform(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetPlatform(v)
- })
- }
- // UpdatePlatform sets the "platform" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdatePlatform() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdatePlatform()
- })
- }
- // SetType sets the "type" field.
- func (u *AccountUpsertOne) SetType(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetType(v)
- })
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateType() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateType()
- })
- }
- // SetCredentials sets the "credentials" field.
- func (u *AccountUpsertOne) SetCredentials(v map[string]interface{}) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetCredentials(v)
- })
- }
- // UpdateCredentials sets the "credentials" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateCredentials() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateCredentials()
- })
- }
- // SetExtra sets the "extra" field.
- func (u *AccountUpsertOne) SetExtra(v map[string]interface{}) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetExtra(v)
- })
- }
- // UpdateExtra sets the "extra" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateExtra() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateExtra()
- })
- }
- // SetProxyID sets the "proxy_id" field.
- func (u *AccountUpsertOne) SetProxyID(v int64) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetProxyID(v)
- })
- }
- // UpdateProxyID sets the "proxy_id" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateProxyID() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateProxyID()
- })
- }
- // ClearProxyID clears the value of the "proxy_id" field.
- func (u *AccountUpsertOne) ClearProxyID() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearProxyID()
- })
- }
- // SetProxyFallbackOriginID sets the "proxy_fallback_origin_id" field.
- func (u *AccountUpsertOne) SetProxyFallbackOriginID(v int64) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetProxyFallbackOriginID(v)
- })
- }
- // AddProxyFallbackOriginID adds v to the "proxy_fallback_origin_id" field.
- func (u *AccountUpsertOne) AddProxyFallbackOriginID(v int64) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.AddProxyFallbackOriginID(v)
- })
- }
- // UpdateProxyFallbackOriginID sets the "proxy_fallback_origin_id" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateProxyFallbackOriginID() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateProxyFallbackOriginID()
- })
- }
- // ClearProxyFallbackOriginID clears the value of the "proxy_fallback_origin_id" field.
- func (u *AccountUpsertOne) ClearProxyFallbackOriginID() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearProxyFallbackOriginID()
- })
- }
- // SetConcurrency sets the "concurrency" field.
- func (u *AccountUpsertOne) SetConcurrency(v int) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetConcurrency(v)
- })
- }
- // AddConcurrency adds v to the "concurrency" field.
- func (u *AccountUpsertOne) AddConcurrency(v int) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.AddConcurrency(v)
- })
- }
- // UpdateConcurrency sets the "concurrency" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateConcurrency() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateConcurrency()
- })
- }
- // SetLoadFactor sets the "load_factor" field.
- func (u *AccountUpsertOne) SetLoadFactor(v int) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetLoadFactor(v)
- })
- }
- // AddLoadFactor adds v to the "load_factor" field.
- func (u *AccountUpsertOne) AddLoadFactor(v int) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.AddLoadFactor(v)
- })
- }
- // UpdateLoadFactor sets the "load_factor" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateLoadFactor() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateLoadFactor()
- })
- }
- // ClearLoadFactor clears the value of the "load_factor" field.
- func (u *AccountUpsertOne) ClearLoadFactor() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearLoadFactor()
- })
- }
- // SetPriority sets the "priority" field.
- func (u *AccountUpsertOne) SetPriority(v int) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetPriority(v)
- })
- }
- // AddPriority adds v to the "priority" field.
- func (u *AccountUpsertOne) AddPriority(v int) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.AddPriority(v)
- })
- }
- // UpdatePriority sets the "priority" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdatePriority() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdatePriority()
- })
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (u *AccountUpsertOne) SetRateMultiplier(v float64) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetRateMultiplier(v)
- })
- }
- // AddRateMultiplier adds v to the "rate_multiplier" field.
- func (u *AccountUpsertOne) AddRateMultiplier(v float64) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.AddRateMultiplier(v)
- })
- }
- // UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateRateMultiplier() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateRateMultiplier()
- })
- }
- // SetStatus sets the "status" field.
- func (u *AccountUpsertOne) SetStatus(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateStatus() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateStatus()
- })
- }
- // SetErrorMessage sets the "error_message" field.
- func (u *AccountUpsertOne) SetErrorMessage(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetErrorMessage(v)
- })
- }
- // UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateErrorMessage() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateErrorMessage()
- })
- }
- // ClearErrorMessage clears the value of the "error_message" field.
- func (u *AccountUpsertOne) ClearErrorMessage() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearErrorMessage()
- })
- }
- // SetLastUsedAt sets the "last_used_at" field.
- func (u *AccountUpsertOne) SetLastUsedAt(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetLastUsedAt(v)
- })
- }
- // UpdateLastUsedAt sets the "last_used_at" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateLastUsedAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateLastUsedAt()
- })
- }
- // ClearLastUsedAt clears the value of the "last_used_at" field.
- func (u *AccountUpsertOne) ClearLastUsedAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearLastUsedAt()
- })
- }
- // SetExpiresAt sets the "expires_at" field.
- func (u *AccountUpsertOne) SetExpiresAt(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetExpiresAt(v)
- })
- }
- // UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateExpiresAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateExpiresAt()
- })
- }
- // ClearExpiresAt clears the value of the "expires_at" field.
- func (u *AccountUpsertOne) ClearExpiresAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearExpiresAt()
- })
- }
- // SetAutoPauseOnExpired sets the "auto_pause_on_expired" field.
- func (u *AccountUpsertOne) SetAutoPauseOnExpired(v bool) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetAutoPauseOnExpired(v)
- })
- }
- // UpdateAutoPauseOnExpired sets the "auto_pause_on_expired" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateAutoPauseOnExpired() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateAutoPauseOnExpired()
- })
- }
- // SetSchedulable sets the "schedulable" field.
- func (u *AccountUpsertOne) SetSchedulable(v bool) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetSchedulable(v)
- })
- }
- // UpdateSchedulable sets the "schedulable" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateSchedulable() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSchedulable()
- })
- }
- // SetRateLimitedAt sets the "rate_limited_at" field.
- func (u *AccountUpsertOne) SetRateLimitedAt(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetRateLimitedAt(v)
- })
- }
- // UpdateRateLimitedAt sets the "rate_limited_at" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateRateLimitedAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateRateLimitedAt()
- })
- }
- // ClearRateLimitedAt clears the value of the "rate_limited_at" field.
- func (u *AccountUpsertOne) ClearRateLimitedAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearRateLimitedAt()
- })
- }
- // SetRateLimitResetAt sets the "rate_limit_reset_at" field.
- func (u *AccountUpsertOne) SetRateLimitResetAt(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetRateLimitResetAt(v)
- })
- }
- // UpdateRateLimitResetAt sets the "rate_limit_reset_at" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateRateLimitResetAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateRateLimitResetAt()
- })
- }
- // ClearRateLimitResetAt clears the value of the "rate_limit_reset_at" field.
- func (u *AccountUpsertOne) ClearRateLimitResetAt() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearRateLimitResetAt()
- })
- }
- // SetOverloadUntil sets the "overload_until" field.
- func (u *AccountUpsertOne) SetOverloadUntil(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetOverloadUntil(v)
- })
- }
- // UpdateOverloadUntil sets the "overload_until" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateOverloadUntil() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateOverloadUntil()
- })
- }
- // ClearOverloadUntil clears the value of the "overload_until" field.
- func (u *AccountUpsertOne) ClearOverloadUntil() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearOverloadUntil()
- })
- }
- // SetTempUnschedulableUntil sets the "temp_unschedulable_until" field.
- func (u *AccountUpsertOne) SetTempUnschedulableUntil(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetTempUnschedulableUntil(v)
- })
- }
- // UpdateTempUnschedulableUntil sets the "temp_unschedulable_until" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateTempUnschedulableUntil() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateTempUnschedulableUntil()
- })
- }
- // ClearTempUnschedulableUntil clears the value of the "temp_unschedulable_until" field.
- func (u *AccountUpsertOne) ClearTempUnschedulableUntil() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearTempUnschedulableUntil()
- })
- }
- // SetTempUnschedulableReason sets the "temp_unschedulable_reason" field.
- func (u *AccountUpsertOne) SetTempUnschedulableReason(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetTempUnschedulableReason(v)
- })
- }
- // UpdateTempUnschedulableReason sets the "temp_unschedulable_reason" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateTempUnschedulableReason() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateTempUnschedulableReason()
- })
- }
- // ClearTempUnschedulableReason clears the value of the "temp_unschedulable_reason" field.
- func (u *AccountUpsertOne) ClearTempUnschedulableReason() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearTempUnschedulableReason()
- })
- }
- // SetSessionWindowStart sets the "session_window_start" field.
- func (u *AccountUpsertOne) SetSessionWindowStart(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetSessionWindowStart(v)
- })
- }
- // UpdateSessionWindowStart sets the "session_window_start" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateSessionWindowStart() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSessionWindowStart()
- })
- }
- // ClearSessionWindowStart clears the value of the "session_window_start" field.
- func (u *AccountUpsertOne) ClearSessionWindowStart() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearSessionWindowStart()
- })
- }
- // SetSessionWindowEnd sets the "session_window_end" field.
- func (u *AccountUpsertOne) SetSessionWindowEnd(v time.Time) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetSessionWindowEnd(v)
- })
- }
- // UpdateSessionWindowEnd sets the "session_window_end" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateSessionWindowEnd() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSessionWindowEnd()
- })
- }
- // ClearSessionWindowEnd clears the value of the "session_window_end" field.
- func (u *AccountUpsertOne) ClearSessionWindowEnd() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearSessionWindowEnd()
- })
- }
- // SetSessionWindowStatus sets the "session_window_status" field.
- func (u *AccountUpsertOne) SetSessionWindowStatus(v string) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetSessionWindowStatus(v)
- })
- }
- // UpdateSessionWindowStatus sets the "session_window_status" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateSessionWindowStatus() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSessionWindowStatus()
- })
- }
- // ClearSessionWindowStatus clears the value of the "session_window_status" field.
- func (u *AccountUpsertOne) ClearSessionWindowStatus() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearSessionWindowStatus()
- })
- }
- // SetParentAccountID sets the "parent_account_id" field.
- func (u *AccountUpsertOne) SetParentAccountID(v int64) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetParentAccountID(v)
- })
- }
- // UpdateParentAccountID sets the "parent_account_id" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateParentAccountID() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateParentAccountID()
- })
- }
- // ClearParentAccountID clears the value of the "parent_account_id" field.
- func (u *AccountUpsertOne) ClearParentAccountID() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.ClearParentAccountID()
- })
- }
- // SetQuotaDimension sets the "quota_dimension" field.
- func (u *AccountUpsertOne) SetQuotaDimension(v account.QuotaDimension) *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.SetQuotaDimension(v)
- })
- }
- // UpdateQuotaDimension sets the "quota_dimension" field to the value that was provided on create.
- func (u *AccountUpsertOne) UpdateQuotaDimension() *AccountUpsertOne {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateQuotaDimension()
- })
- }
- // Exec executes the query.
- func (u *AccountUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for AccountCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *AccountUpsertOne) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // Exec executes the UPSERT query and returns the inserted/updated ID.
- func (u *AccountUpsertOne) ID(ctx context.Context) (id int64, err error) {
- node, err := u.create.Save(ctx)
- if err != nil {
- return id, err
- }
- return node.ID, nil
- }
- // IDX is like ID, but panics if an error occurs.
- func (u *AccountUpsertOne) IDX(ctx context.Context) int64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // AccountCreateBulk is the builder for creating many Account entities in bulk.
- type AccountCreateBulk struct {
- config
- err error
- builders []*AccountCreate
- conflict []sql.ConflictOption
- }
- // Save creates the Account entities in the database.
- func (_c *AccountCreateBulk) Save(ctx context.Context) ([]*Account, error) {
- if _c.err != nil {
- return nil, _c.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
- nodes := make([]*Account, len(_c.builders))
- mutators := make([]Mutator, len(_c.builders))
- for i := range _c.builders {
- func(i int, root context.Context) {
- builder := _c.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*AccountMutation)
- if !ok {
- return nil, fmt.Errorf("unexpected mutation type %T", m)
- }
- if err := builder.check(); err != nil {
- return nil, err
- }
- builder.mutation = mutation
- var err error
- nodes[i], specs[i] = builder.createSpec()
- if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = _c.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- }
- }
- if err != nil {
- return nil, err
- }
- mutation.id = &nodes[i].ID
- if specs[i].ID.Value != nil {
- id := specs[i].ID.Value.(int64)
- nodes[i].ID = int64(id)
- }
- mutation.done = true
- return nodes[i], nil
- })
- for i := len(builder.hooks) - 1; i >= 0; i-- {
- mut = builder.hooks[i](mut)
- }
- mutators[i] = mut
- }(i, ctx)
- }
- if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (_c *AccountCreateBulk) SaveX(ctx context.Context) []*Account {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (_c *AccountCreateBulk) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_c *AccountCreateBulk) ExecX(ctx context.Context) {
- if err := _c.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Account.CreateBulk(builders...).
- // OnConflict(
- // // Update the row with the new values
- // // the was proposed for insertion.
- // sql.ResolveWithNewValues(),
- // ).
- // // Override some of the fields with custom
- // // update values.
- // Update(func(u *ent.AccountUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (_c *AccountCreateBulk) OnConflict(opts ...sql.ConflictOption) *AccountUpsertBulk {
- _c.conflict = opts
- return &AccountUpsertBulk{
- create: _c,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Account.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (_c *AccountCreateBulk) OnConflictColumns(columns ...string) *AccountUpsertBulk {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &AccountUpsertBulk{
- create: _c,
- }
- }
- // AccountUpsertBulk is the builder for "upsert"-ing
- // a bulk of Account nodes.
- type AccountUpsertBulk struct {
- create *AccountCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.Account.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // ).
- // Exec(ctx)
- func (u *AccountUpsertBulk) UpdateNewValues() *AccountUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- for _, b := range u.create.builders {
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(account.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Account.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *AccountUpsertBulk) Ignore() *AccountUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- // DoNothing configures the conflict_action to `DO NOTHING`.
- // Supported only by SQLite and PostgreSQL.
- func (u *AccountUpsertBulk) DoNothing() *AccountUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the AccountCreateBulk.OnConflict
- // documentation for more info.
- func (u *AccountUpsertBulk) Update(set func(*AccountUpsert)) *AccountUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&AccountUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AccountUpsertBulk) SetUpdatedAt(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateUpdatedAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *AccountUpsertBulk) SetDeletedAt(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateDeletedAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *AccountUpsertBulk) ClearDeletedAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetName sets the "name" field.
- func (u *AccountUpsertBulk) SetName(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetName(v)
- })
- }
- // UpdateName sets the "name" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateName() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateName()
- })
- }
- // SetNotes sets the "notes" field.
- func (u *AccountUpsertBulk) SetNotes(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetNotes(v)
- })
- }
- // UpdateNotes sets the "notes" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateNotes() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateNotes()
- })
- }
- // ClearNotes clears the value of the "notes" field.
- func (u *AccountUpsertBulk) ClearNotes() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearNotes()
- })
- }
- // SetPlatform sets the "platform" field.
- func (u *AccountUpsertBulk) SetPlatform(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetPlatform(v)
- })
- }
- // UpdatePlatform sets the "platform" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdatePlatform() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdatePlatform()
- })
- }
- // SetType sets the "type" field.
- func (u *AccountUpsertBulk) SetType(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetType(v)
- })
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateType() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateType()
- })
- }
- // SetCredentials sets the "credentials" field.
- func (u *AccountUpsertBulk) SetCredentials(v map[string]interface{}) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetCredentials(v)
- })
- }
- // UpdateCredentials sets the "credentials" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateCredentials() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateCredentials()
- })
- }
- // SetExtra sets the "extra" field.
- func (u *AccountUpsertBulk) SetExtra(v map[string]interface{}) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetExtra(v)
- })
- }
- // UpdateExtra sets the "extra" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateExtra() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateExtra()
- })
- }
- // SetProxyID sets the "proxy_id" field.
- func (u *AccountUpsertBulk) SetProxyID(v int64) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetProxyID(v)
- })
- }
- // UpdateProxyID sets the "proxy_id" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateProxyID() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateProxyID()
- })
- }
- // ClearProxyID clears the value of the "proxy_id" field.
- func (u *AccountUpsertBulk) ClearProxyID() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearProxyID()
- })
- }
- // SetProxyFallbackOriginID sets the "proxy_fallback_origin_id" field.
- func (u *AccountUpsertBulk) SetProxyFallbackOriginID(v int64) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetProxyFallbackOriginID(v)
- })
- }
- // AddProxyFallbackOriginID adds v to the "proxy_fallback_origin_id" field.
- func (u *AccountUpsertBulk) AddProxyFallbackOriginID(v int64) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.AddProxyFallbackOriginID(v)
- })
- }
- // UpdateProxyFallbackOriginID sets the "proxy_fallback_origin_id" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateProxyFallbackOriginID() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateProxyFallbackOriginID()
- })
- }
- // ClearProxyFallbackOriginID clears the value of the "proxy_fallback_origin_id" field.
- func (u *AccountUpsertBulk) ClearProxyFallbackOriginID() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearProxyFallbackOriginID()
- })
- }
- // SetConcurrency sets the "concurrency" field.
- func (u *AccountUpsertBulk) SetConcurrency(v int) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetConcurrency(v)
- })
- }
- // AddConcurrency adds v to the "concurrency" field.
- func (u *AccountUpsertBulk) AddConcurrency(v int) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.AddConcurrency(v)
- })
- }
- // UpdateConcurrency sets the "concurrency" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateConcurrency() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateConcurrency()
- })
- }
- // SetLoadFactor sets the "load_factor" field.
- func (u *AccountUpsertBulk) SetLoadFactor(v int) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetLoadFactor(v)
- })
- }
- // AddLoadFactor adds v to the "load_factor" field.
- func (u *AccountUpsertBulk) AddLoadFactor(v int) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.AddLoadFactor(v)
- })
- }
- // UpdateLoadFactor sets the "load_factor" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateLoadFactor() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateLoadFactor()
- })
- }
- // ClearLoadFactor clears the value of the "load_factor" field.
- func (u *AccountUpsertBulk) ClearLoadFactor() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearLoadFactor()
- })
- }
- // SetPriority sets the "priority" field.
- func (u *AccountUpsertBulk) SetPriority(v int) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetPriority(v)
- })
- }
- // AddPriority adds v to the "priority" field.
- func (u *AccountUpsertBulk) AddPriority(v int) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.AddPriority(v)
- })
- }
- // UpdatePriority sets the "priority" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdatePriority() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdatePriority()
- })
- }
- // SetRateMultiplier sets the "rate_multiplier" field.
- func (u *AccountUpsertBulk) SetRateMultiplier(v float64) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetRateMultiplier(v)
- })
- }
- // AddRateMultiplier adds v to the "rate_multiplier" field.
- func (u *AccountUpsertBulk) AddRateMultiplier(v float64) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.AddRateMultiplier(v)
- })
- }
- // UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateRateMultiplier() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateRateMultiplier()
- })
- }
- // SetStatus sets the "status" field.
- func (u *AccountUpsertBulk) SetStatus(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateStatus() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateStatus()
- })
- }
- // SetErrorMessage sets the "error_message" field.
- func (u *AccountUpsertBulk) SetErrorMessage(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetErrorMessage(v)
- })
- }
- // UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateErrorMessage() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateErrorMessage()
- })
- }
- // ClearErrorMessage clears the value of the "error_message" field.
- func (u *AccountUpsertBulk) ClearErrorMessage() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearErrorMessage()
- })
- }
- // SetLastUsedAt sets the "last_used_at" field.
- func (u *AccountUpsertBulk) SetLastUsedAt(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetLastUsedAt(v)
- })
- }
- // UpdateLastUsedAt sets the "last_used_at" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateLastUsedAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateLastUsedAt()
- })
- }
- // ClearLastUsedAt clears the value of the "last_used_at" field.
- func (u *AccountUpsertBulk) ClearLastUsedAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearLastUsedAt()
- })
- }
- // SetExpiresAt sets the "expires_at" field.
- func (u *AccountUpsertBulk) SetExpiresAt(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetExpiresAt(v)
- })
- }
- // UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateExpiresAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateExpiresAt()
- })
- }
- // ClearExpiresAt clears the value of the "expires_at" field.
- func (u *AccountUpsertBulk) ClearExpiresAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearExpiresAt()
- })
- }
- // SetAutoPauseOnExpired sets the "auto_pause_on_expired" field.
- func (u *AccountUpsertBulk) SetAutoPauseOnExpired(v bool) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetAutoPauseOnExpired(v)
- })
- }
- // UpdateAutoPauseOnExpired sets the "auto_pause_on_expired" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateAutoPauseOnExpired() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateAutoPauseOnExpired()
- })
- }
- // SetSchedulable sets the "schedulable" field.
- func (u *AccountUpsertBulk) SetSchedulable(v bool) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetSchedulable(v)
- })
- }
- // UpdateSchedulable sets the "schedulable" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateSchedulable() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSchedulable()
- })
- }
- // SetRateLimitedAt sets the "rate_limited_at" field.
- func (u *AccountUpsertBulk) SetRateLimitedAt(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetRateLimitedAt(v)
- })
- }
- // UpdateRateLimitedAt sets the "rate_limited_at" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateRateLimitedAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateRateLimitedAt()
- })
- }
- // ClearRateLimitedAt clears the value of the "rate_limited_at" field.
- func (u *AccountUpsertBulk) ClearRateLimitedAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearRateLimitedAt()
- })
- }
- // SetRateLimitResetAt sets the "rate_limit_reset_at" field.
- func (u *AccountUpsertBulk) SetRateLimitResetAt(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetRateLimitResetAt(v)
- })
- }
- // UpdateRateLimitResetAt sets the "rate_limit_reset_at" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateRateLimitResetAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateRateLimitResetAt()
- })
- }
- // ClearRateLimitResetAt clears the value of the "rate_limit_reset_at" field.
- func (u *AccountUpsertBulk) ClearRateLimitResetAt() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearRateLimitResetAt()
- })
- }
- // SetOverloadUntil sets the "overload_until" field.
- func (u *AccountUpsertBulk) SetOverloadUntil(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetOverloadUntil(v)
- })
- }
- // UpdateOverloadUntil sets the "overload_until" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateOverloadUntil() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateOverloadUntil()
- })
- }
- // ClearOverloadUntil clears the value of the "overload_until" field.
- func (u *AccountUpsertBulk) ClearOverloadUntil() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearOverloadUntil()
- })
- }
- // SetTempUnschedulableUntil sets the "temp_unschedulable_until" field.
- func (u *AccountUpsertBulk) SetTempUnschedulableUntil(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetTempUnschedulableUntil(v)
- })
- }
- // UpdateTempUnschedulableUntil sets the "temp_unschedulable_until" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateTempUnschedulableUntil() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateTempUnschedulableUntil()
- })
- }
- // ClearTempUnschedulableUntil clears the value of the "temp_unschedulable_until" field.
- func (u *AccountUpsertBulk) ClearTempUnschedulableUntil() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearTempUnschedulableUntil()
- })
- }
- // SetTempUnschedulableReason sets the "temp_unschedulable_reason" field.
- func (u *AccountUpsertBulk) SetTempUnschedulableReason(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetTempUnschedulableReason(v)
- })
- }
- // UpdateTempUnschedulableReason sets the "temp_unschedulable_reason" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateTempUnschedulableReason() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateTempUnschedulableReason()
- })
- }
- // ClearTempUnschedulableReason clears the value of the "temp_unschedulable_reason" field.
- func (u *AccountUpsertBulk) ClearTempUnschedulableReason() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearTempUnschedulableReason()
- })
- }
- // SetSessionWindowStart sets the "session_window_start" field.
- func (u *AccountUpsertBulk) SetSessionWindowStart(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetSessionWindowStart(v)
- })
- }
- // UpdateSessionWindowStart sets the "session_window_start" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateSessionWindowStart() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSessionWindowStart()
- })
- }
- // ClearSessionWindowStart clears the value of the "session_window_start" field.
- func (u *AccountUpsertBulk) ClearSessionWindowStart() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearSessionWindowStart()
- })
- }
- // SetSessionWindowEnd sets the "session_window_end" field.
- func (u *AccountUpsertBulk) SetSessionWindowEnd(v time.Time) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetSessionWindowEnd(v)
- })
- }
- // UpdateSessionWindowEnd sets the "session_window_end" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateSessionWindowEnd() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSessionWindowEnd()
- })
- }
- // ClearSessionWindowEnd clears the value of the "session_window_end" field.
- func (u *AccountUpsertBulk) ClearSessionWindowEnd() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearSessionWindowEnd()
- })
- }
- // SetSessionWindowStatus sets the "session_window_status" field.
- func (u *AccountUpsertBulk) SetSessionWindowStatus(v string) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetSessionWindowStatus(v)
- })
- }
- // UpdateSessionWindowStatus sets the "session_window_status" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateSessionWindowStatus() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateSessionWindowStatus()
- })
- }
- // ClearSessionWindowStatus clears the value of the "session_window_status" field.
- func (u *AccountUpsertBulk) ClearSessionWindowStatus() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearSessionWindowStatus()
- })
- }
- // SetParentAccountID sets the "parent_account_id" field.
- func (u *AccountUpsertBulk) SetParentAccountID(v int64) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetParentAccountID(v)
- })
- }
- // UpdateParentAccountID sets the "parent_account_id" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateParentAccountID() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateParentAccountID()
- })
- }
- // ClearParentAccountID clears the value of the "parent_account_id" field.
- func (u *AccountUpsertBulk) ClearParentAccountID() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.ClearParentAccountID()
- })
- }
- // SetQuotaDimension sets the "quota_dimension" field.
- func (u *AccountUpsertBulk) SetQuotaDimension(v account.QuotaDimension) *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.SetQuotaDimension(v)
- })
- }
- // UpdateQuotaDimension sets the "quota_dimension" field to the value that was provided on create.
- func (u *AccountUpsertBulk) UpdateQuotaDimension() *AccountUpsertBulk {
- return u.Update(func(s *AccountUpsert) {
- s.UpdateQuotaDimension()
- })
- }
- // Exec executes the query.
- func (u *AccountUpsertBulk) Exec(ctx context.Context) error {
- if u.create.err != nil {
- return u.create.err
- }
- for i, b := range u.create.builders {
- if len(b.conflict) != 0 {
- return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the AccountCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for AccountCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *AccountUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|