| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308 |
- // 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/batchimagejob"
- "github.com/Wei-Shaw/sub2api/ent/predicate"
- )
- // BatchImageJobUpdate is the builder for updating BatchImageJob entities.
- type BatchImageJobUpdate struct {
- config
- hooks []Hook
- mutation *BatchImageJobMutation
- }
- // Where appends a list predicates to the BatchImageJobUpdate builder.
- func (_u *BatchImageJobUpdate) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdate {
- _u.mutation.Where(ps...)
- return _u
- }
- // SetUserID sets the "user_id" field.
- func (_u *BatchImageJobUpdate) SetUserID(v int64) *BatchImageJobUpdate {
- _u.mutation.ResetUserID()
- _u.mutation.SetUserID(v)
- return _u
- }
- // SetNillableUserID sets the "user_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableUserID(v *int64) *BatchImageJobUpdate {
- if v != nil {
- _u.SetUserID(*v)
- }
- return _u
- }
- // AddUserID adds value to the "user_id" field.
- func (_u *BatchImageJobUpdate) AddUserID(v int64) *BatchImageJobUpdate {
- _u.mutation.AddUserID(v)
- return _u
- }
- // SetAPIKeyID sets the "api_key_id" field.
- func (_u *BatchImageJobUpdate) SetAPIKeyID(v int64) *BatchImageJobUpdate {
- _u.mutation.ResetAPIKeyID()
- _u.mutation.SetAPIKeyID(v)
- return _u
- }
- // SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdate {
- if v != nil {
- _u.SetAPIKeyID(*v)
- }
- return _u
- }
- // AddAPIKeyID adds value to the "api_key_id" field.
- func (_u *BatchImageJobUpdate) AddAPIKeyID(v int64) *BatchImageJobUpdate {
- _u.mutation.AddAPIKeyID(v)
- return _u
- }
- // ClearAPIKeyID clears the value of the "api_key_id" field.
- func (_u *BatchImageJobUpdate) ClearAPIKeyID() *BatchImageJobUpdate {
- _u.mutation.ClearAPIKeyID()
- return _u
- }
- // SetAccountID sets the "account_id" field.
- func (_u *BatchImageJobUpdate) SetAccountID(v int64) *BatchImageJobUpdate {
- _u.mutation.ResetAccountID()
- _u.mutation.SetAccountID(v)
- return _u
- }
- // SetNillableAccountID sets the "account_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableAccountID(v *int64) *BatchImageJobUpdate {
- if v != nil {
- _u.SetAccountID(*v)
- }
- return _u
- }
- // AddAccountID adds value to the "account_id" field.
- func (_u *BatchImageJobUpdate) AddAccountID(v int64) *BatchImageJobUpdate {
- _u.mutation.AddAccountID(v)
- return _u
- }
- // ClearAccountID clears the value of the "account_id" field.
- func (_u *BatchImageJobUpdate) ClearAccountID() *BatchImageJobUpdate {
- _u.mutation.ClearAccountID()
- return _u
- }
- // SetProvider sets the "provider" field.
- func (_u *BatchImageJobUpdate) SetProvider(v string) *BatchImageJobUpdate {
- _u.mutation.SetProvider(v)
- return _u
- }
- // SetNillableProvider sets the "provider" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableProvider(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetProvider(*v)
- }
- return _u
- }
- // SetModel sets the "model" field.
- func (_u *BatchImageJobUpdate) SetModel(v string) *BatchImageJobUpdate {
- _u.mutation.SetModel(v)
- return _u
- }
- // SetNillableModel sets the "model" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableModel(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetModel(*v)
- }
- return _u
- }
- // SetTaskName sets the "task_name" field.
- func (_u *BatchImageJobUpdate) SetTaskName(v string) *BatchImageJobUpdate {
- _u.mutation.SetTaskName(v)
- return _u
- }
- // SetNillableTaskName sets the "task_name" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableTaskName(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetTaskName(*v)
- }
- return _u
- }
- // SetStatus sets the "status" field.
- func (_u *BatchImageJobUpdate) SetStatus(v string) *BatchImageJobUpdate {
- _u.mutation.SetStatus(v)
- return _u
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableStatus(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetStatus(*v)
- }
- return _u
- }
- // SetProviderJobName sets the "provider_job_name" field.
- func (_u *BatchImageJobUpdate) SetProviderJobName(v string) *BatchImageJobUpdate {
- _u.mutation.SetProviderJobName(v)
- return _u
- }
- // SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableProviderJobName(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetProviderJobName(*v)
- }
- return _u
- }
- // ClearProviderJobName clears the value of the "provider_job_name" field.
- func (_u *BatchImageJobUpdate) ClearProviderJobName() *BatchImageJobUpdate {
- _u.mutation.ClearProviderJobName()
- return _u
- }
- // SetProviderInputRef sets the "provider_input_ref" field.
- func (_u *BatchImageJobUpdate) SetProviderInputRef(v string) *BatchImageJobUpdate {
- _u.mutation.SetProviderInputRef(v)
- return _u
- }
- // SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableProviderInputRef(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetProviderInputRef(*v)
- }
- return _u
- }
- // ClearProviderInputRef clears the value of the "provider_input_ref" field.
- func (_u *BatchImageJobUpdate) ClearProviderInputRef() *BatchImageJobUpdate {
- _u.mutation.ClearProviderInputRef()
- return _u
- }
- // SetProviderOutputRef sets the "provider_output_ref" field.
- func (_u *BatchImageJobUpdate) SetProviderOutputRef(v string) *BatchImageJobUpdate {
- _u.mutation.SetProviderOutputRef(v)
- return _u
- }
- // SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetProviderOutputRef(*v)
- }
- return _u
- }
- // ClearProviderOutputRef clears the value of the "provider_output_ref" field.
- func (_u *BatchImageJobUpdate) ClearProviderOutputRef() *BatchImageJobUpdate {
- _u.mutation.ClearProviderOutputRef()
- return _u
- }
- // SetGcsInputURI sets the "gcs_input_uri" field.
- func (_u *BatchImageJobUpdate) SetGcsInputURI(v string) *BatchImageJobUpdate {
- _u.mutation.SetGcsInputURI(v)
- return _u
- }
- // SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableGcsInputURI(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetGcsInputURI(*v)
- }
- return _u
- }
- // ClearGcsInputURI clears the value of the "gcs_input_uri" field.
- func (_u *BatchImageJobUpdate) ClearGcsInputURI() *BatchImageJobUpdate {
- _u.mutation.ClearGcsInputURI()
- return _u
- }
- // SetGcsOutputURI sets the "gcs_output_uri" field.
- func (_u *BatchImageJobUpdate) SetGcsOutputURI(v string) *BatchImageJobUpdate {
- _u.mutation.SetGcsOutputURI(v)
- return _u
- }
- // SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetGcsOutputURI(*v)
- }
- return _u
- }
- // ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
- func (_u *BatchImageJobUpdate) ClearGcsOutputURI() *BatchImageJobUpdate {
- _u.mutation.ClearGcsOutputURI()
- return _u
- }
- // SetItemCount sets the "item_count" field.
- func (_u *BatchImageJobUpdate) SetItemCount(v int) *BatchImageJobUpdate {
- _u.mutation.ResetItemCount()
- _u.mutation.SetItemCount(v)
- return _u
- }
- // SetNillableItemCount sets the "item_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableItemCount(v *int) *BatchImageJobUpdate {
- if v != nil {
- _u.SetItemCount(*v)
- }
- return _u
- }
- // AddItemCount adds value to the "item_count" field.
- func (_u *BatchImageJobUpdate) AddItemCount(v int) *BatchImageJobUpdate {
- _u.mutation.AddItemCount(v)
- return _u
- }
- // SetSuccessCount sets the "success_count" field.
- func (_u *BatchImageJobUpdate) SetSuccessCount(v int) *BatchImageJobUpdate {
- _u.mutation.ResetSuccessCount()
- _u.mutation.SetSuccessCount(v)
- return _u
- }
- // SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableSuccessCount(v *int) *BatchImageJobUpdate {
- if v != nil {
- _u.SetSuccessCount(*v)
- }
- return _u
- }
- // AddSuccessCount adds value to the "success_count" field.
- func (_u *BatchImageJobUpdate) AddSuccessCount(v int) *BatchImageJobUpdate {
- _u.mutation.AddSuccessCount(v)
- return _u
- }
- // SetFailCount sets the "fail_count" field.
- func (_u *BatchImageJobUpdate) SetFailCount(v int) *BatchImageJobUpdate {
- _u.mutation.ResetFailCount()
- _u.mutation.SetFailCount(v)
- return _u
- }
- // SetNillableFailCount sets the "fail_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableFailCount(v *int) *BatchImageJobUpdate {
- if v != nil {
- _u.SetFailCount(*v)
- }
- return _u
- }
- // AddFailCount adds value to the "fail_count" field.
- func (_u *BatchImageJobUpdate) AddFailCount(v int) *BatchImageJobUpdate {
- _u.mutation.AddFailCount(v)
- return _u
- }
- // SetCancelledCount sets the "cancelled_count" field.
- func (_u *BatchImageJobUpdate) SetCancelledCount(v int) *BatchImageJobUpdate {
- _u.mutation.ResetCancelledCount()
- _u.mutation.SetCancelledCount(v)
- return _u
- }
- // SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableCancelledCount(v *int) *BatchImageJobUpdate {
- if v != nil {
- _u.SetCancelledCount(*v)
- }
- return _u
- }
- // AddCancelledCount adds value to the "cancelled_count" field.
- func (_u *BatchImageJobUpdate) AddCancelledCount(v int) *BatchImageJobUpdate {
- _u.mutation.AddCancelledCount(v)
- return _u
- }
- // SetEstimatedCost sets the "estimated_cost" field.
- func (_u *BatchImageJobUpdate) SetEstimatedCost(v float64) *BatchImageJobUpdate {
- _u.mutation.ResetEstimatedCost()
- _u.mutation.SetEstimatedCost(v)
- return _u
- }
- // SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdate {
- if v != nil {
- _u.SetEstimatedCost(*v)
- }
- return _u
- }
- // AddEstimatedCost adds value to the "estimated_cost" field.
- func (_u *BatchImageJobUpdate) AddEstimatedCost(v float64) *BatchImageJobUpdate {
- _u.mutation.AddEstimatedCost(v)
- return _u
- }
- // SetHoldAmount sets the "hold_amount" field.
- func (_u *BatchImageJobUpdate) SetHoldAmount(v float64) *BatchImageJobUpdate {
- _u.mutation.ResetHoldAmount()
- _u.mutation.SetHoldAmount(v)
- return _u
- }
- // SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableHoldAmount(v *float64) *BatchImageJobUpdate {
- if v != nil {
- _u.SetHoldAmount(*v)
- }
- return _u
- }
- // AddHoldAmount adds value to the "hold_amount" field.
- func (_u *BatchImageJobUpdate) AddHoldAmount(v float64) *BatchImageJobUpdate {
- _u.mutation.AddHoldAmount(v)
- return _u
- }
- // ClearHoldAmount clears the value of the "hold_amount" field.
- func (_u *BatchImageJobUpdate) ClearHoldAmount() *BatchImageJobUpdate {
- _u.mutation.ClearHoldAmount()
- return _u
- }
- // SetActualCost sets the "actual_cost" field.
- func (_u *BatchImageJobUpdate) SetActualCost(v float64) *BatchImageJobUpdate {
- _u.mutation.ResetActualCost()
- _u.mutation.SetActualCost(v)
- return _u
- }
- // SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableActualCost(v *float64) *BatchImageJobUpdate {
- if v != nil {
- _u.SetActualCost(*v)
- }
- return _u
- }
- // AddActualCost adds value to the "actual_cost" field.
- func (_u *BatchImageJobUpdate) AddActualCost(v float64) *BatchImageJobUpdate {
- _u.mutation.AddActualCost(v)
- return _u
- }
- // ClearActualCost clears the value of the "actual_cost" field.
- func (_u *BatchImageJobUpdate) ClearActualCost() *BatchImageJobUpdate {
- _u.mutation.ClearActualCost()
- return _u
- }
- // SetCurrency sets the "currency" field.
- func (_u *BatchImageJobUpdate) SetCurrency(v string) *BatchImageJobUpdate {
- _u.mutation.SetCurrency(v)
- return _u
- }
- // SetNillableCurrency sets the "currency" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableCurrency(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetCurrency(*v)
- }
- return _u
- }
- // SetHoldID sets the "hold_id" field.
- func (_u *BatchImageJobUpdate) SetHoldID(v string) *BatchImageJobUpdate {
- _u.mutation.SetHoldID(v)
- return _u
- }
- // SetNillableHoldID sets the "hold_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableHoldID(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetHoldID(*v)
- }
- return _u
- }
- // ClearHoldID clears the value of the "hold_id" field.
- func (_u *BatchImageJobUpdate) ClearHoldID() *BatchImageJobUpdate {
- _u.mutation.ClearHoldID()
- return _u
- }
- // SetIdempotencyKey sets the "idempotency_key" field.
- func (_u *BatchImageJobUpdate) SetIdempotencyKey(v string) *BatchImageJobUpdate {
- _u.mutation.SetIdempotencyKey(v)
- return _u
- }
- // SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetIdempotencyKey(*v)
- }
- return _u
- }
- // ClearIdempotencyKey clears the value of the "idempotency_key" field.
- func (_u *BatchImageJobUpdate) ClearIdempotencyKey() *BatchImageJobUpdate {
- _u.mutation.ClearIdempotencyKey()
- return _u
- }
- // SetRequestHash sets the "request_hash" field.
- func (_u *BatchImageJobUpdate) SetRequestHash(v string) *BatchImageJobUpdate {
- _u.mutation.SetRequestHash(v)
- return _u
- }
- // SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableRequestHash(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetRequestHash(*v)
- }
- return _u
- }
- // ClearRequestHash clears the value of the "request_hash" field.
- func (_u *BatchImageJobUpdate) ClearRequestHash() *BatchImageJobUpdate {
- _u.mutation.ClearRequestHash()
- return _u
- }
- // SetManifestHash sets the "manifest_hash" field.
- func (_u *BatchImageJobUpdate) SetManifestHash(v string) *BatchImageJobUpdate {
- _u.mutation.SetManifestHash(v)
- return _u
- }
- // SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableManifestHash(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetManifestHash(*v)
- }
- return _u
- }
- // ClearManifestHash clears the value of the "manifest_hash" field.
- func (_u *BatchImageJobUpdate) ClearManifestHash() *BatchImageJobUpdate {
- _u.mutation.ClearManifestHash()
- return _u
- }
- // SetRetryCount sets the "retry_count" field.
- func (_u *BatchImageJobUpdate) SetRetryCount(v int) *BatchImageJobUpdate {
- _u.mutation.ResetRetryCount()
- _u.mutation.SetRetryCount(v)
- return _u
- }
- // SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableRetryCount(v *int) *BatchImageJobUpdate {
- if v != nil {
- _u.SetRetryCount(*v)
- }
- return _u
- }
- // AddRetryCount adds value to the "retry_count" field.
- func (_u *BatchImageJobUpdate) AddRetryCount(v int) *BatchImageJobUpdate {
- _u.mutation.AddRetryCount(v)
- return _u
- }
- // SetVersion sets the "version" field.
- func (_u *BatchImageJobUpdate) SetVersion(v int) *BatchImageJobUpdate {
- _u.mutation.ResetVersion()
- _u.mutation.SetVersion(v)
- return _u
- }
- // SetNillableVersion sets the "version" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableVersion(v *int) *BatchImageJobUpdate {
- if v != nil {
- _u.SetVersion(*v)
- }
- return _u
- }
- // AddVersion adds value to the "version" field.
- func (_u *BatchImageJobUpdate) AddVersion(v int) *BatchImageJobUpdate {
- _u.mutation.AddVersion(v)
- return _u
- }
- // SetOutputExpiresAt sets the "output_expires_at" field.
- func (_u *BatchImageJobUpdate) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetOutputExpiresAt(v)
- return _u
- }
- // SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetOutputExpiresAt(*v)
- }
- return _u
- }
- // ClearOutputExpiresAt clears the value of the "output_expires_at" field.
- func (_u *BatchImageJobUpdate) ClearOutputExpiresAt() *BatchImageJobUpdate {
- _u.mutation.ClearOutputExpiresAt()
- return _u
- }
- // SetInputDeletedAt sets the "input_deleted_at" field.
- func (_u *BatchImageJobUpdate) SetInputDeletedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetInputDeletedAt(v)
- return _u
- }
- // SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetInputDeletedAt(*v)
- }
- return _u
- }
- // ClearInputDeletedAt clears the value of the "input_deleted_at" field.
- func (_u *BatchImageJobUpdate) ClearInputDeletedAt() *BatchImageJobUpdate {
- _u.mutation.ClearInputDeletedAt()
- return _u
- }
- // SetOutputDeletedAt sets the "output_deleted_at" field.
- func (_u *BatchImageJobUpdate) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetOutputDeletedAt(v)
- return _u
- }
- // SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetOutputDeletedAt(*v)
- }
- return _u
- }
- // ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
- func (_u *BatchImageJobUpdate) ClearOutputDeletedAt() *BatchImageJobUpdate {
- _u.mutation.ClearOutputDeletedAt()
- return _u
- }
- // SetDownloadedAt sets the "downloaded_at" field.
- func (_u *BatchImageJobUpdate) SetDownloadedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetDownloadedAt(v)
- return _u
- }
- // SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetDownloadedAt(*v)
- }
- return _u
- }
- // ClearDownloadedAt clears the value of the "downloaded_at" field.
- func (_u *BatchImageJobUpdate) ClearDownloadedAt() *BatchImageJobUpdate {
- _u.mutation.ClearDownloadedAt()
- return _u
- }
- // SetUserDeletedAt sets the "user_deleted_at" field.
- func (_u *BatchImageJobUpdate) SetUserDeletedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetUserDeletedAt(v)
- return _u
- }
- // SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetUserDeletedAt(*v)
- }
- return _u
- }
- // ClearUserDeletedAt clears the value of the "user_deleted_at" field.
- func (_u *BatchImageJobUpdate) ClearUserDeletedAt() *BatchImageJobUpdate {
- _u.mutation.ClearUserDeletedAt()
- return _u
- }
- // SetLastErrorCode sets the "last_error_code" field.
- func (_u *BatchImageJobUpdate) SetLastErrorCode(v string) *BatchImageJobUpdate {
- _u.mutation.SetLastErrorCode(v)
- return _u
- }
- // SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableLastErrorCode(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetLastErrorCode(*v)
- }
- return _u
- }
- // ClearLastErrorCode clears the value of the "last_error_code" field.
- func (_u *BatchImageJobUpdate) ClearLastErrorCode() *BatchImageJobUpdate {
- _u.mutation.ClearLastErrorCode()
- return _u
- }
- // SetLastErrorMessage sets the "last_error_message" field.
- func (_u *BatchImageJobUpdate) SetLastErrorMessage(v string) *BatchImageJobUpdate {
- _u.mutation.SetLastErrorMessage(v)
- return _u
- }
- // SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdate {
- if v != nil {
- _u.SetLastErrorMessage(*v)
- }
- return _u
- }
- // ClearLastErrorMessage clears the value of the "last_error_message" field.
- func (_u *BatchImageJobUpdate) ClearLastErrorMessage() *BatchImageJobUpdate {
- _u.mutation.ClearLastErrorMessage()
- return _u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (_u *BatchImageJobUpdate) SetUpdatedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetUpdatedAt(v)
- return _u
- }
- // SetSubmittedAt sets the "submitted_at" field.
- func (_u *BatchImageJobUpdate) SetSubmittedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetSubmittedAt(v)
- return _u
- }
- // SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetSubmittedAt(*v)
- }
- return _u
- }
- // ClearSubmittedAt clears the value of the "submitted_at" field.
- func (_u *BatchImageJobUpdate) ClearSubmittedAt() *BatchImageJobUpdate {
- _u.mutation.ClearSubmittedAt()
- return _u
- }
- // SetStartedAt sets the "started_at" field.
- func (_u *BatchImageJobUpdate) SetStartedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetStartedAt(v)
- return _u
- }
- // SetNillableStartedAt sets the "started_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetStartedAt(*v)
- }
- return _u
- }
- // ClearStartedAt clears the value of the "started_at" field.
- func (_u *BatchImageJobUpdate) ClearStartedAt() *BatchImageJobUpdate {
- _u.mutation.ClearStartedAt()
- return _u
- }
- // SetFinishedAt sets the "finished_at" field.
- func (_u *BatchImageJobUpdate) SetFinishedAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetFinishedAt(v)
- return _u
- }
- // SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetFinishedAt(*v)
- }
- return _u
- }
- // ClearFinishedAt clears the value of the "finished_at" field.
- func (_u *BatchImageJobUpdate) ClearFinishedAt() *BatchImageJobUpdate {
- _u.mutation.ClearFinishedAt()
- return _u
- }
- // SetSettledAt sets the "settled_at" field.
- func (_u *BatchImageJobUpdate) SetSettledAt(v time.Time) *BatchImageJobUpdate {
- _u.mutation.SetSettledAt(v)
- return _u
- }
- // SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdate) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdate {
- if v != nil {
- _u.SetSettledAt(*v)
- }
- return _u
- }
- // ClearSettledAt clears the value of the "settled_at" field.
- func (_u *BatchImageJobUpdate) ClearSettledAt() *BatchImageJobUpdate {
- _u.mutation.ClearSettledAt()
- return _u
- }
- // Mutation returns the BatchImageJobMutation object of the builder.
- func (_u *BatchImageJobUpdate) Mutation() *BatchImageJobMutation {
- return _u.mutation
- }
- // Save executes the query and returns the number of nodes affected by the update operation.
- func (_u *BatchImageJobUpdate) Save(ctx context.Context) (int, error) {
- _u.defaults()
- return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (_u *BatchImageJobUpdate) SaveX(ctx context.Context) int {
- affected, err := _u.Save(ctx)
- if err != nil {
- panic(err)
- }
- return affected
- }
- // Exec executes the query.
- func (_u *BatchImageJobUpdate) Exec(ctx context.Context) error {
- _, err := _u.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_u *BatchImageJobUpdate) ExecX(ctx context.Context) {
- if err := _u.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (_u *BatchImageJobUpdate) defaults() {
- if _, ok := _u.mutation.UpdatedAt(); !ok {
- v := batchimagejob.UpdateDefaultUpdatedAt()
- _u.mutation.SetUpdatedAt(v)
- }
- }
- // check runs all checks and user-defined validators on the builder.
- func (_u *BatchImageJobUpdate) check() error {
- if v, ok := _u.mutation.Provider(); ok {
- if err := batchimagejob.ProviderValidator(v); err != nil {
- return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
- }
- }
- if v, ok := _u.mutation.Model(); ok {
- if err := batchimagejob.ModelValidator(v); err != nil {
- return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
- }
- }
- if v, ok := _u.mutation.TaskName(); ok {
- if err := batchimagejob.TaskNameValidator(v); err != nil {
- return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
- }
- }
- if v, ok := _u.mutation.Status(); ok {
- if err := batchimagejob.StatusValidator(v); err != nil {
- return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ProviderJobName(); ok {
- if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
- return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ProviderInputRef(); ok {
- if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
- return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ProviderOutputRef(); ok {
- if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
- return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
- }
- }
- if v, ok := _u.mutation.GcsInputURI(); ok {
- if err := batchimagejob.GcsInputURIValidator(v); err != nil {
- return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
- }
- }
- if v, ok := _u.mutation.GcsOutputURI(); ok {
- if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
- return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
- }
- }
- if v, ok := _u.mutation.Currency(); ok {
- if err := batchimagejob.CurrencyValidator(v); err != nil {
- return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
- }
- }
- if v, ok := _u.mutation.HoldID(); ok {
- if err := batchimagejob.HoldIDValidator(v); err != nil {
- return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
- }
- }
- if v, ok := _u.mutation.IdempotencyKey(); ok {
- if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
- return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
- }
- }
- if v, ok := _u.mutation.RequestHash(); ok {
- if err := batchimagejob.RequestHashValidator(v); err != nil {
- return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ManifestHash(); ok {
- if err := batchimagejob.ManifestHashValidator(v); err != nil {
- return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
- }
- }
- if v, ok := _u.mutation.LastErrorCode(); ok {
- if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
- return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
- }
- }
- return nil
- }
- func (_u *BatchImageJobUpdate) sqlSave(ctx context.Context) (_node int, err error) {
- if err := _u.check(); err != nil {
- return _node, err
- }
- _spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
- if ps := _u.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := _u.mutation.UserID(); ok {
- _spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedUserID(); ok {
- _spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.APIKeyID(); ok {
- _spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedAPIKeyID(); ok {
- _spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
- }
- if _u.mutation.APIKeyIDCleared() {
- _spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
- }
- if value, ok := _u.mutation.AccountID(); ok {
- _spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedAccountID(); ok {
- _spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
- }
- if _u.mutation.AccountIDCleared() {
- _spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
- }
- if value, ok := _u.mutation.Provider(); ok {
- _spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
- }
- if value, ok := _u.mutation.Model(); ok {
- _spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
- }
- if value, ok := _u.mutation.TaskName(); ok {
- _spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
- }
- if value, ok := _u.mutation.Status(); ok {
- _spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
- }
- if value, ok := _u.mutation.ProviderJobName(); ok {
- _spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
- }
- if _u.mutation.ProviderJobNameCleared() {
- _spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
- }
- if value, ok := _u.mutation.ProviderInputRef(); ok {
- _spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
- }
- if _u.mutation.ProviderInputRefCleared() {
- _spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
- }
- if value, ok := _u.mutation.ProviderOutputRef(); ok {
- _spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
- }
- if _u.mutation.ProviderOutputRefCleared() {
- _spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
- }
- if value, ok := _u.mutation.GcsInputURI(); ok {
- _spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
- }
- if _u.mutation.GcsInputURICleared() {
- _spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
- }
- if value, ok := _u.mutation.GcsOutputURI(); ok {
- _spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
- }
- if _u.mutation.GcsOutputURICleared() {
- _spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
- }
- if value, ok := _u.mutation.ItemCount(); ok {
- _spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedItemCount(); ok {
- _spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.SuccessCount(); ok {
- _spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedSuccessCount(); ok {
- _spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.FailCount(); ok {
- _spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedFailCount(); ok {
- _spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.CancelledCount(); ok {
- _spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedCancelledCount(); ok {
- _spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.EstimatedCost(); ok {
- _spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.AddedEstimatedCost(); ok {
- _spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.HoldAmount(); ok {
- _spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.AddedHoldAmount(); ok {
- _spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
- }
- if _u.mutation.HoldAmountCleared() {
- _spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
- }
- if value, ok := _u.mutation.ActualCost(); ok {
- _spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.AddedActualCost(); ok {
- _spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
- }
- if _u.mutation.ActualCostCleared() {
- _spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
- }
- if value, ok := _u.mutation.Currency(); ok {
- _spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
- }
- if value, ok := _u.mutation.HoldID(); ok {
- _spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
- }
- if _u.mutation.HoldIDCleared() {
- _spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
- }
- if value, ok := _u.mutation.IdempotencyKey(); ok {
- _spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
- }
- if _u.mutation.IdempotencyKeyCleared() {
- _spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
- }
- if value, ok := _u.mutation.RequestHash(); ok {
- _spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
- }
- if _u.mutation.RequestHashCleared() {
- _spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
- }
- if value, ok := _u.mutation.ManifestHash(); ok {
- _spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
- }
- if _u.mutation.ManifestHashCleared() {
- _spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
- }
- if value, ok := _u.mutation.RetryCount(); ok {
- _spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedRetryCount(); ok {
- _spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.Version(); ok {
- _spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedVersion(); ok {
- _spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
- }
- if value, ok := _u.mutation.OutputExpiresAt(); ok {
- _spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
- }
- if _u.mutation.OutputExpiresAtCleared() {
- _spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
- }
- if value, ok := _u.mutation.InputDeletedAt(); ok {
- _spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
- }
- if _u.mutation.InputDeletedAtCleared() {
- _spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.OutputDeletedAt(); ok {
- _spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
- }
- if _u.mutation.OutputDeletedAtCleared() {
- _spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.DownloadedAt(); ok {
- _spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
- }
- if _u.mutation.DownloadedAtCleared() {
- _spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.UserDeletedAt(); ok {
- _spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
- }
- if _u.mutation.UserDeletedAtCleared() {
- _spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.LastErrorCode(); ok {
- _spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
- }
- if _u.mutation.LastErrorCodeCleared() {
- _spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
- }
- if value, ok := _u.mutation.LastErrorMessage(); ok {
- _spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
- }
- if _u.mutation.LastErrorMessageCleared() {
- _spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
- }
- if value, ok := _u.mutation.UpdatedAt(); ok {
- _spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := _u.mutation.SubmittedAt(); ok {
- _spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
- }
- if _u.mutation.SubmittedAtCleared() {
- _spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.StartedAt(); ok {
- _spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
- }
- if _u.mutation.StartedAtCleared() {
- _spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.FinishedAt(); ok {
- _spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
- }
- if _u.mutation.FinishedAtCleared() {
- _spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.SettledAt(); ok {
- _spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
- }
- if _u.mutation.SettledAtCleared() {
- _spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
- }
- if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{batchimagejob.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return 0, err
- }
- _u.mutation.done = true
- return _node, nil
- }
- // BatchImageJobUpdateOne is the builder for updating a single BatchImageJob entity.
- type BatchImageJobUpdateOne struct {
- config
- fields []string
- hooks []Hook
- mutation *BatchImageJobMutation
- }
- // SetUserID sets the "user_id" field.
- func (_u *BatchImageJobUpdateOne) SetUserID(v int64) *BatchImageJobUpdateOne {
- _u.mutation.ResetUserID()
- _u.mutation.SetUserID(v)
- return _u
- }
- // SetNillableUserID sets the "user_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableUserID(v *int64) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetUserID(*v)
- }
- return _u
- }
- // AddUserID adds value to the "user_id" field.
- func (_u *BatchImageJobUpdateOne) AddUserID(v int64) *BatchImageJobUpdateOne {
- _u.mutation.AddUserID(v)
- return _u
- }
- // SetAPIKeyID sets the "api_key_id" field.
- func (_u *BatchImageJobUpdateOne) SetAPIKeyID(v int64) *BatchImageJobUpdateOne {
- _u.mutation.ResetAPIKeyID()
- _u.mutation.SetAPIKeyID(v)
- return _u
- }
- // SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetAPIKeyID(*v)
- }
- return _u
- }
- // AddAPIKeyID adds value to the "api_key_id" field.
- func (_u *BatchImageJobUpdateOne) AddAPIKeyID(v int64) *BatchImageJobUpdateOne {
- _u.mutation.AddAPIKeyID(v)
- return _u
- }
- // ClearAPIKeyID clears the value of the "api_key_id" field.
- func (_u *BatchImageJobUpdateOne) ClearAPIKeyID() *BatchImageJobUpdateOne {
- _u.mutation.ClearAPIKeyID()
- return _u
- }
- // SetAccountID sets the "account_id" field.
- func (_u *BatchImageJobUpdateOne) SetAccountID(v int64) *BatchImageJobUpdateOne {
- _u.mutation.ResetAccountID()
- _u.mutation.SetAccountID(v)
- return _u
- }
- // SetNillableAccountID sets the "account_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableAccountID(v *int64) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetAccountID(*v)
- }
- return _u
- }
- // AddAccountID adds value to the "account_id" field.
- func (_u *BatchImageJobUpdateOne) AddAccountID(v int64) *BatchImageJobUpdateOne {
- _u.mutation.AddAccountID(v)
- return _u
- }
- // ClearAccountID clears the value of the "account_id" field.
- func (_u *BatchImageJobUpdateOne) ClearAccountID() *BatchImageJobUpdateOne {
- _u.mutation.ClearAccountID()
- return _u
- }
- // SetProvider sets the "provider" field.
- func (_u *BatchImageJobUpdateOne) SetProvider(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetProvider(v)
- return _u
- }
- // SetNillableProvider sets the "provider" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableProvider(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetProvider(*v)
- }
- return _u
- }
- // SetModel sets the "model" field.
- func (_u *BatchImageJobUpdateOne) SetModel(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetModel(v)
- return _u
- }
- // SetNillableModel sets the "model" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableModel(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetModel(*v)
- }
- return _u
- }
- // SetTaskName sets the "task_name" field.
- func (_u *BatchImageJobUpdateOne) SetTaskName(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetTaskName(v)
- return _u
- }
- // SetNillableTaskName sets the "task_name" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableTaskName(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetTaskName(*v)
- }
- return _u
- }
- // SetStatus sets the "status" field.
- func (_u *BatchImageJobUpdateOne) SetStatus(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetStatus(v)
- return _u
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableStatus(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetStatus(*v)
- }
- return _u
- }
- // SetProviderJobName sets the "provider_job_name" field.
- func (_u *BatchImageJobUpdateOne) SetProviderJobName(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetProviderJobName(v)
- return _u
- }
- // SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableProviderJobName(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetProviderJobName(*v)
- }
- return _u
- }
- // ClearProviderJobName clears the value of the "provider_job_name" field.
- func (_u *BatchImageJobUpdateOne) ClearProviderJobName() *BatchImageJobUpdateOne {
- _u.mutation.ClearProviderJobName()
- return _u
- }
- // SetProviderInputRef sets the "provider_input_ref" field.
- func (_u *BatchImageJobUpdateOne) SetProviderInputRef(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetProviderInputRef(v)
- return _u
- }
- // SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableProviderInputRef(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetProviderInputRef(*v)
- }
- return _u
- }
- // ClearProviderInputRef clears the value of the "provider_input_ref" field.
- func (_u *BatchImageJobUpdateOne) ClearProviderInputRef() *BatchImageJobUpdateOne {
- _u.mutation.ClearProviderInputRef()
- return _u
- }
- // SetProviderOutputRef sets the "provider_output_ref" field.
- func (_u *BatchImageJobUpdateOne) SetProviderOutputRef(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetProviderOutputRef(v)
- return _u
- }
- // SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetProviderOutputRef(*v)
- }
- return _u
- }
- // ClearProviderOutputRef clears the value of the "provider_output_ref" field.
- func (_u *BatchImageJobUpdateOne) ClearProviderOutputRef() *BatchImageJobUpdateOne {
- _u.mutation.ClearProviderOutputRef()
- return _u
- }
- // SetGcsInputURI sets the "gcs_input_uri" field.
- func (_u *BatchImageJobUpdateOne) SetGcsInputURI(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetGcsInputURI(v)
- return _u
- }
- // SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableGcsInputURI(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetGcsInputURI(*v)
- }
- return _u
- }
- // ClearGcsInputURI clears the value of the "gcs_input_uri" field.
- func (_u *BatchImageJobUpdateOne) ClearGcsInputURI() *BatchImageJobUpdateOne {
- _u.mutation.ClearGcsInputURI()
- return _u
- }
- // SetGcsOutputURI sets the "gcs_output_uri" field.
- func (_u *BatchImageJobUpdateOne) SetGcsOutputURI(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetGcsOutputURI(v)
- return _u
- }
- // SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetGcsOutputURI(*v)
- }
- return _u
- }
- // ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
- func (_u *BatchImageJobUpdateOne) ClearGcsOutputURI() *BatchImageJobUpdateOne {
- _u.mutation.ClearGcsOutputURI()
- return _u
- }
- // SetItemCount sets the "item_count" field.
- func (_u *BatchImageJobUpdateOne) SetItemCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.ResetItemCount()
- _u.mutation.SetItemCount(v)
- return _u
- }
- // SetNillableItemCount sets the "item_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableItemCount(v *int) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetItemCount(*v)
- }
- return _u
- }
- // AddItemCount adds value to the "item_count" field.
- func (_u *BatchImageJobUpdateOne) AddItemCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.AddItemCount(v)
- return _u
- }
- // SetSuccessCount sets the "success_count" field.
- func (_u *BatchImageJobUpdateOne) SetSuccessCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.ResetSuccessCount()
- _u.mutation.SetSuccessCount(v)
- return _u
- }
- // SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableSuccessCount(v *int) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetSuccessCount(*v)
- }
- return _u
- }
- // AddSuccessCount adds value to the "success_count" field.
- func (_u *BatchImageJobUpdateOne) AddSuccessCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.AddSuccessCount(v)
- return _u
- }
- // SetFailCount sets the "fail_count" field.
- func (_u *BatchImageJobUpdateOne) SetFailCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.ResetFailCount()
- _u.mutation.SetFailCount(v)
- return _u
- }
- // SetNillableFailCount sets the "fail_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableFailCount(v *int) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetFailCount(*v)
- }
- return _u
- }
- // AddFailCount adds value to the "fail_count" field.
- func (_u *BatchImageJobUpdateOne) AddFailCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.AddFailCount(v)
- return _u
- }
- // SetCancelledCount sets the "cancelled_count" field.
- func (_u *BatchImageJobUpdateOne) SetCancelledCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.ResetCancelledCount()
- _u.mutation.SetCancelledCount(v)
- return _u
- }
- // SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableCancelledCount(v *int) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetCancelledCount(*v)
- }
- return _u
- }
- // AddCancelledCount adds value to the "cancelled_count" field.
- func (_u *BatchImageJobUpdateOne) AddCancelledCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.AddCancelledCount(v)
- return _u
- }
- // SetEstimatedCost sets the "estimated_cost" field.
- func (_u *BatchImageJobUpdateOne) SetEstimatedCost(v float64) *BatchImageJobUpdateOne {
- _u.mutation.ResetEstimatedCost()
- _u.mutation.SetEstimatedCost(v)
- return _u
- }
- // SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetEstimatedCost(*v)
- }
- return _u
- }
- // AddEstimatedCost adds value to the "estimated_cost" field.
- func (_u *BatchImageJobUpdateOne) AddEstimatedCost(v float64) *BatchImageJobUpdateOne {
- _u.mutation.AddEstimatedCost(v)
- return _u
- }
- // SetHoldAmount sets the "hold_amount" field.
- func (_u *BatchImageJobUpdateOne) SetHoldAmount(v float64) *BatchImageJobUpdateOne {
- _u.mutation.ResetHoldAmount()
- _u.mutation.SetHoldAmount(v)
- return _u
- }
- // SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableHoldAmount(v *float64) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetHoldAmount(*v)
- }
- return _u
- }
- // AddHoldAmount adds value to the "hold_amount" field.
- func (_u *BatchImageJobUpdateOne) AddHoldAmount(v float64) *BatchImageJobUpdateOne {
- _u.mutation.AddHoldAmount(v)
- return _u
- }
- // ClearHoldAmount clears the value of the "hold_amount" field.
- func (_u *BatchImageJobUpdateOne) ClearHoldAmount() *BatchImageJobUpdateOne {
- _u.mutation.ClearHoldAmount()
- return _u
- }
- // SetActualCost sets the "actual_cost" field.
- func (_u *BatchImageJobUpdateOne) SetActualCost(v float64) *BatchImageJobUpdateOne {
- _u.mutation.ResetActualCost()
- _u.mutation.SetActualCost(v)
- return _u
- }
- // SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableActualCost(v *float64) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetActualCost(*v)
- }
- return _u
- }
- // AddActualCost adds value to the "actual_cost" field.
- func (_u *BatchImageJobUpdateOne) AddActualCost(v float64) *BatchImageJobUpdateOne {
- _u.mutation.AddActualCost(v)
- return _u
- }
- // ClearActualCost clears the value of the "actual_cost" field.
- func (_u *BatchImageJobUpdateOne) ClearActualCost() *BatchImageJobUpdateOne {
- _u.mutation.ClearActualCost()
- return _u
- }
- // SetCurrency sets the "currency" field.
- func (_u *BatchImageJobUpdateOne) SetCurrency(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetCurrency(v)
- return _u
- }
- // SetNillableCurrency sets the "currency" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableCurrency(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetCurrency(*v)
- }
- return _u
- }
- // SetHoldID sets the "hold_id" field.
- func (_u *BatchImageJobUpdateOne) SetHoldID(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetHoldID(v)
- return _u
- }
- // SetNillableHoldID sets the "hold_id" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableHoldID(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetHoldID(*v)
- }
- return _u
- }
- // ClearHoldID clears the value of the "hold_id" field.
- func (_u *BatchImageJobUpdateOne) ClearHoldID() *BatchImageJobUpdateOne {
- _u.mutation.ClearHoldID()
- return _u
- }
- // SetIdempotencyKey sets the "idempotency_key" field.
- func (_u *BatchImageJobUpdateOne) SetIdempotencyKey(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetIdempotencyKey(v)
- return _u
- }
- // SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetIdempotencyKey(*v)
- }
- return _u
- }
- // ClearIdempotencyKey clears the value of the "idempotency_key" field.
- func (_u *BatchImageJobUpdateOne) ClearIdempotencyKey() *BatchImageJobUpdateOne {
- _u.mutation.ClearIdempotencyKey()
- return _u
- }
- // SetRequestHash sets the "request_hash" field.
- func (_u *BatchImageJobUpdateOne) SetRequestHash(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetRequestHash(v)
- return _u
- }
- // SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableRequestHash(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetRequestHash(*v)
- }
- return _u
- }
- // ClearRequestHash clears the value of the "request_hash" field.
- func (_u *BatchImageJobUpdateOne) ClearRequestHash() *BatchImageJobUpdateOne {
- _u.mutation.ClearRequestHash()
- return _u
- }
- // SetManifestHash sets the "manifest_hash" field.
- func (_u *BatchImageJobUpdateOne) SetManifestHash(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetManifestHash(v)
- return _u
- }
- // SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableManifestHash(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetManifestHash(*v)
- }
- return _u
- }
- // ClearManifestHash clears the value of the "manifest_hash" field.
- func (_u *BatchImageJobUpdateOne) ClearManifestHash() *BatchImageJobUpdateOne {
- _u.mutation.ClearManifestHash()
- return _u
- }
- // SetRetryCount sets the "retry_count" field.
- func (_u *BatchImageJobUpdateOne) SetRetryCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.ResetRetryCount()
- _u.mutation.SetRetryCount(v)
- return _u
- }
- // SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableRetryCount(v *int) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetRetryCount(*v)
- }
- return _u
- }
- // AddRetryCount adds value to the "retry_count" field.
- func (_u *BatchImageJobUpdateOne) AddRetryCount(v int) *BatchImageJobUpdateOne {
- _u.mutation.AddRetryCount(v)
- return _u
- }
- // SetVersion sets the "version" field.
- func (_u *BatchImageJobUpdateOne) SetVersion(v int) *BatchImageJobUpdateOne {
- _u.mutation.ResetVersion()
- _u.mutation.SetVersion(v)
- return _u
- }
- // SetNillableVersion sets the "version" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableVersion(v *int) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetVersion(*v)
- }
- return _u
- }
- // AddVersion adds value to the "version" field.
- func (_u *BatchImageJobUpdateOne) AddVersion(v int) *BatchImageJobUpdateOne {
- _u.mutation.AddVersion(v)
- return _u
- }
- // SetOutputExpiresAt sets the "output_expires_at" field.
- func (_u *BatchImageJobUpdateOne) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetOutputExpiresAt(v)
- return _u
- }
- // SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetOutputExpiresAt(*v)
- }
- return _u
- }
- // ClearOutputExpiresAt clears the value of the "output_expires_at" field.
- func (_u *BatchImageJobUpdateOne) ClearOutputExpiresAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearOutputExpiresAt()
- return _u
- }
- // SetInputDeletedAt sets the "input_deleted_at" field.
- func (_u *BatchImageJobUpdateOne) SetInputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetInputDeletedAt(v)
- return _u
- }
- // SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetInputDeletedAt(*v)
- }
- return _u
- }
- // ClearInputDeletedAt clears the value of the "input_deleted_at" field.
- func (_u *BatchImageJobUpdateOne) ClearInputDeletedAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearInputDeletedAt()
- return _u
- }
- // SetOutputDeletedAt sets the "output_deleted_at" field.
- func (_u *BatchImageJobUpdateOne) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetOutputDeletedAt(v)
- return _u
- }
- // SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetOutputDeletedAt(*v)
- }
- return _u
- }
- // ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
- func (_u *BatchImageJobUpdateOne) ClearOutputDeletedAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearOutputDeletedAt()
- return _u
- }
- // SetDownloadedAt sets the "downloaded_at" field.
- func (_u *BatchImageJobUpdateOne) SetDownloadedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetDownloadedAt(v)
- return _u
- }
- // SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetDownloadedAt(*v)
- }
- return _u
- }
- // ClearDownloadedAt clears the value of the "downloaded_at" field.
- func (_u *BatchImageJobUpdateOne) ClearDownloadedAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearDownloadedAt()
- return _u
- }
- // SetUserDeletedAt sets the "user_deleted_at" field.
- func (_u *BatchImageJobUpdateOne) SetUserDeletedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetUserDeletedAt(v)
- return _u
- }
- // SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetUserDeletedAt(*v)
- }
- return _u
- }
- // ClearUserDeletedAt clears the value of the "user_deleted_at" field.
- func (_u *BatchImageJobUpdateOne) ClearUserDeletedAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearUserDeletedAt()
- return _u
- }
- // SetLastErrorCode sets the "last_error_code" field.
- func (_u *BatchImageJobUpdateOne) SetLastErrorCode(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetLastErrorCode(v)
- return _u
- }
- // SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableLastErrorCode(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetLastErrorCode(*v)
- }
- return _u
- }
- // ClearLastErrorCode clears the value of the "last_error_code" field.
- func (_u *BatchImageJobUpdateOne) ClearLastErrorCode() *BatchImageJobUpdateOne {
- _u.mutation.ClearLastErrorCode()
- return _u
- }
- // SetLastErrorMessage sets the "last_error_message" field.
- func (_u *BatchImageJobUpdateOne) SetLastErrorMessage(v string) *BatchImageJobUpdateOne {
- _u.mutation.SetLastErrorMessage(v)
- return _u
- }
- // SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetLastErrorMessage(*v)
- }
- return _u
- }
- // ClearLastErrorMessage clears the value of the "last_error_message" field.
- func (_u *BatchImageJobUpdateOne) ClearLastErrorMessage() *BatchImageJobUpdateOne {
- _u.mutation.ClearLastErrorMessage()
- return _u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (_u *BatchImageJobUpdateOne) SetUpdatedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetUpdatedAt(v)
- return _u
- }
- // SetSubmittedAt sets the "submitted_at" field.
- func (_u *BatchImageJobUpdateOne) SetSubmittedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetSubmittedAt(v)
- return _u
- }
- // SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetSubmittedAt(*v)
- }
- return _u
- }
- // ClearSubmittedAt clears the value of the "submitted_at" field.
- func (_u *BatchImageJobUpdateOne) ClearSubmittedAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearSubmittedAt()
- return _u
- }
- // SetStartedAt sets the "started_at" field.
- func (_u *BatchImageJobUpdateOne) SetStartedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetStartedAt(v)
- return _u
- }
- // SetNillableStartedAt sets the "started_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetStartedAt(*v)
- }
- return _u
- }
- // ClearStartedAt clears the value of the "started_at" field.
- func (_u *BatchImageJobUpdateOne) ClearStartedAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearStartedAt()
- return _u
- }
- // SetFinishedAt sets the "finished_at" field.
- func (_u *BatchImageJobUpdateOne) SetFinishedAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetFinishedAt(v)
- return _u
- }
- // SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetFinishedAt(*v)
- }
- return _u
- }
- // ClearFinishedAt clears the value of the "finished_at" field.
- func (_u *BatchImageJobUpdateOne) ClearFinishedAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearFinishedAt()
- return _u
- }
- // SetSettledAt sets the "settled_at" field.
- func (_u *BatchImageJobUpdateOne) SetSettledAt(v time.Time) *BatchImageJobUpdateOne {
- _u.mutation.SetSettledAt(v)
- return _u
- }
- // SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
- func (_u *BatchImageJobUpdateOne) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdateOne {
- if v != nil {
- _u.SetSettledAt(*v)
- }
- return _u
- }
- // ClearSettledAt clears the value of the "settled_at" field.
- func (_u *BatchImageJobUpdateOne) ClearSettledAt() *BatchImageJobUpdateOne {
- _u.mutation.ClearSettledAt()
- return _u
- }
- // Mutation returns the BatchImageJobMutation object of the builder.
- func (_u *BatchImageJobUpdateOne) Mutation() *BatchImageJobMutation {
- return _u.mutation
- }
- // Where appends a list predicates to the BatchImageJobUpdate builder.
- func (_u *BatchImageJobUpdateOne) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdateOne {
- _u.mutation.Where(ps...)
- return _u
- }
- // Select allows selecting one or more fields (columns) of the returned entity.
- // The default is selecting all fields defined in the entity schema.
- func (_u *BatchImageJobUpdateOne) Select(field string, fields ...string) *BatchImageJobUpdateOne {
- _u.fields = append([]string{field}, fields...)
- return _u
- }
- // Save executes the query and returns the updated BatchImageJob entity.
- func (_u *BatchImageJobUpdateOne) Save(ctx context.Context) (*BatchImageJob, error) {
- _u.defaults()
- return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (_u *BatchImageJobUpdateOne) SaveX(ctx context.Context) *BatchImageJob {
- node, err := _u.Save(ctx)
- if err != nil {
- panic(err)
- }
- return node
- }
- // Exec executes the query on the entity.
- func (_u *BatchImageJobUpdateOne) Exec(ctx context.Context) error {
- _, err := _u.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_u *BatchImageJobUpdateOne) ExecX(ctx context.Context) {
- if err := _u.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (_u *BatchImageJobUpdateOne) defaults() {
- if _, ok := _u.mutation.UpdatedAt(); !ok {
- v := batchimagejob.UpdateDefaultUpdatedAt()
- _u.mutation.SetUpdatedAt(v)
- }
- }
- // check runs all checks and user-defined validators on the builder.
- func (_u *BatchImageJobUpdateOne) check() error {
- if v, ok := _u.mutation.Provider(); ok {
- if err := batchimagejob.ProviderValidator(v); err != nil {
- return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
- }
- }
- if v, ok := _u.mutation.Model(); ok {
- if err := batchimagejob.ModelValidator(v); err != nil {
- return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
- }
- }
- if v, ok := _u.mutation.TaskName(); ok {
- if err := batchimagejob.TaskNameValidator(v); err != nil {
- return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
- }
- }
- if v, ok := _u.mutation.Status(); ok {
- if err := batchimagejob.StatusValidator(v); err != nil {
- return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ProviderJobName(); ok {
- if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
- return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ProviderInputRef(); ok {
- if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
- return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ProviderOutputRef(); ok {
- if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
- return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
- }
- }
- if v, ok := _u.mutation.GcsInputURI(); ok {
- if err := batchimagejob.GcsInputURIValidator(v); err != nil {
- return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
- }
- }
- if v, ok := _u.mutation.GcsOutputURI(); ok {
- if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
- return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
- }
- }
- if v, ok := _u.mutation.Currency(); ok {
- if err := batchimagejob.CurrencyValidator(v); err != nil {
- return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
- }
- }
- if v, ok := _u.mutation.HoldID(); ok {
- if err := batchimagejob.HoldIDValidator(v); err != nil {
- return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
- }
- }
- if v, ok := _u.mutation.IdempotencyKey(); ok {
- if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
- return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
- }
- }
- if v, ok := _u.mutation.RequestHash(); ok {
- if err := batchimagejob.RequestHashValidator(v); err != nil {
- return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
- }
- }
- if v, ok := _u.mutation.ManifestHash(); ok {
- if err := batchimagejob.ManifestHashValidator(v); err != nil {
- return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
- }
- }
- if v, ok := _u.mutation.LastErrorCode(); ok {
- if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
- return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
- }
- }
- return nil
- }
- func (_u *BatchImageJobUpdateOne) sqlSave(ctx context.Context) (_node *BatchImageJob, err error) {
- if err := _u.check(); err != nil {
- return _node, err
- }
- _spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
- id, ok := _u.mutation.ID()
- if !ok {
- return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BatchImageJob.id" for update`)}
- }
- _spec.Node.ID.Value = id
- if fields := _u.fields; len(fields) > 0 {
- _spec.Node.Columns = make([]string, 0, len(fields))
- _spec.Node.Columns = append(_spec.Node.Columns, batchimagejob.FieldID)
- for _, f := range fields {
- if !batchimagejob.ValidColumn(f) {
- return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
- }
- if f != batchimagejob.FieldID {
- _spec.Node.Columns = append(_spec.Node.Columns, f)
- }
- }
- }
- if ps := _u.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := _u.mutation.UserID(); ok {
- _spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedUserID(); ok {
- _spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.APIKeyID(); ok {
- _spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedAPIKeyID(); ok {
- _spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
- }
- if _u.mutation.APIKeyIDCleared() {
- _spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
- }
- if value, ok := _u.mutation.AccountID(); ok {
- _spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedAccountID(); ok {
- _spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
- }
- if _u.mutation.AccountIDCleared() {
- _spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
- }
- if value, ok := _u.mutation.Provider(); ok {
- _spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
- }
- if value, ok := _u.mutation.Model(); ok {
- _spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
- }
- if value, ok := _u.mutation.TaskName(); ok {
- _spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
- }
- if value, ok := _u.mutation.Status(); ok {
- _spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
- }
- if value, ok := _u.mutation.ProviderJobName(); ok {
- _spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
- }
- if _u.mutation.ProviderJobNameCleared() {
- _spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
- }
- if value, ok := _u.mutation.ProviderInputRef(); ok {
- _spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
- }
- if _u.mutation.ProviderInputRefCleared() {
- _spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
- }
- if value, ok := _u.mutation.ProviderOutputRef(); ok {
- _spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
- }
- if _u.mutation.ProviderOutputRefCleared() {
- _spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
- }
- if value, ok := _u.mutation.GcsInputURI(); ok {
- _spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
- }
- if _u.mutation.GcsInputURICleared() {
- _spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
- }
- if value, ok := _u.mutation.GcsOutputURI(); ok {
- _spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
- }
- if _u.mutation.GcsOutputURICleared() {
- _spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
- }
- if value, ok := _u.mutation.ItemCount(); ok {
- _spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedItemCount(); ok {
- _spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.SuccessCount(); ok {
- _spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedSuccessCount(); ok {
- _spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.FailCount(); ok {
- _spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedFailCount(); ok {
- _spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.CancelledCount(); ok {
- _spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedCancelledCount(); ok {
- _spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.EstimatedCost(); ok {
- _spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.AddedEstimatedCost(); ok {
- _spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.HoldAmount(); ok {
- _spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.AddedHoldAmount(); ok {
- _spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
- }
- if _u.mutation.HoldAmountCleared() {
- _spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
- }
- if value, ok := _u.mutation.ActualCost(); ok {
- _spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
- }
- if value, ok := _u.mutation.AddedActualCost(); ok {
- _spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
- }
- if _u.mutation.ActualCostCleared() {
- _spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
- }
- if value, ok := _u.mutation.Currency(); ok {
- _spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
- }
- if value, ok := _u.mutation.HoldID(); ok {
- _spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
- }
- if _u.mutation.HoldIDCleared() {
- _spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
- }
- if value, ok := _u.mutation.IdempotencyKey(); ok {
- _spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
- }
- if _u.mutation.IdempotencyKeyCleared() {
- _spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
- }
- if value, ok := _u.mutation.RequestHash(); ok {
- _spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
- }
- if _u.mutation.RequestHashCleared() {
- _spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
- }
- if value, ok := _u.mutation.ManifestHash(); ok {
- _spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
- }
- if _u.mutation.ManifestHashCleared() {
- _spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
- }
- if value, ok := _u.mutation.RetryCount(); ok {
- _spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedRetryCount(); ok {
- _spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
- }
- if value, ok := _u.mutation.Version(); ok {
- _spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
- }
- if value, ok := _u.mutation.AddedVersion(); ok {
- _spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
- }
- if value, ok := _u.mutation.OutputExpiresAt(); ok {
- _spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
- }
- if _u.mutation.OutputExpiresAtCleared() {
- _spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
- }
- if value, ok := _u.mutation.InputDeletedAt(); ok {
- _spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
- }
- if _u.mutation.InputDeletedAtCleared() {
- _spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.OutputDeletedAt(); ok {
- _spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
- }
- if _u.mutation.OutputDeletedAtCleared() {
- _spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.DownloadedAt(); ok {
- _spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
- }
- if _u.mutation.DownloadedAtCleared() {
- _spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.UserDeletedAt(); ok {
- _spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
- }
- if _u.mutation.UserDeletedAtCleared() {
- _spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.LastErrorCode(); ok {
- _spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
- }
- if _u.mutation.LastErrorCodeCleared() {
- _spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
- }
- if value, ok := _u.mutation.LastErrorMessage(); ok {
- _spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
- }
- if _u.mutation.LastErrorMessageCleared() {
- _spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
- }
- if value, ok := _u.mutation.UpdatedAt(); ok {
- _spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := _u.mutation.SubmittedAt(); ok {
- _spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
- }
- if _u.mutation.SubmittedAtCleared() {
- _spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.StartedAt(); ok {
- _spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
- }
- if _u.mutation.StartedAtCleared() {
- _spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.FinishedAt(); ok {
- _spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
- }
- if _u.mutation.FinishedAtCleared() {
- _spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
- }
- if value, ok := _u.mutation.SettledAt(); ok {
- _spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
- }
- if _u.mutation.SettledAtCleared() {
- _spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
- }
- _node = &BatchImageJob{config: _u.config}
- _spec.Assign = _node.assignValues
- _spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{batchimagejob.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- _u.mutation.done = true
- return _node, nil
- }
|