batchimagejob_update.go 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308
  1. // Code generated by ent, DO NOT EDIT.
  2. package ent
  3. import (
  4. "context"
  5. "errors"
  6. "fmt"
  7. "time"
  8. "entgo.io/ent/dialect/sql"
  9. "entgo.io/ent/dialect/sql/sqlgraph"
  10. "entgo.io/ent/schema/field"
  11. "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
  12. "github.com/Wei-Shaw/sub2api/ent/predicate"
  13. )
  14. // BatchImageJobUpdate is the builder for updating BatchImageJob entities.
  15. type BatchImageJobUpdate struct {
  16. config
  17. hooks []Hook
  18. mutation *BatchImageJobMutation
  19. }
  20. // Where appends a list predicates to the BatchImageJobUpdate builder.
  21. func (_u *BatchImageJobUpdate) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdate {
  22. _u.mutation.Where(ps...)
  23. return _u
  24. }
  25. // SetUserID sets the "user_id" field.
  26. func (_u *BatchImageJobUpdate) SetUserID(v int64) *BatchImageJobUpdate {
  27. _u.mutation.ResetUserID()
  28. _u.mutation.SetUserID(v)
  29. return _u
  30. }
  31. // SetNillableUserID sets the "user_id" field if the given value is not nil.
  32. func (_u *BatchImageJobUpdate) SetNillableUserID(v *int64) *BatchImageJobUpdate {
  33. if v != nil {
  34. _u.SetUserID(*v)
  35. }
  36. return _u
  37. }
  38. // AddUserID adds value to the "user_id" field.
  39. func (_u *BatchImageJobUpdate) AddUserID(v int64) *BatchImageJobUpdate {
  40. _u.mutation.AddUserID(v)
  41. return _u
  42. }
  43. // SetAPIKeyID sets the "api_key_id" field.
  44. func (_u *BatchImageJobUpdate) SetAPIKeyID(v int64) *BatchImageJobUpdate {
  45. _u.mutation.ResetAPIKeyID()
  46. _u.mutation.SetAPIKeyID(v)
  47. return _u
  48. }
  49. // SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
  50. func (_u *BatchImageJobUpdate) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdate {
  51. if v != nil {
  52. _u.SetAPIKeyID(*v)
  53. }
  54. return _u
  55. }
  56. // AddAPIKeyID adds value to the "api_key_id" field.
  57. func (_u *BatchImageJobUpdate) AddAPIKeyID(v int64) *BatchImageJobUpdate {
  58. _u.mutation.AddAPIKeyID(v)
  59. return _u
  60. }
  61. // ClearAPIKeyID clears the value of the "api_key_id" field.
  62. func (_u *BatchImageJobUpdate) ClearAPIKeyID() *BatchImageJobUpdate {
  63. _u.mutation.ClearAPIKeyID()
  64. return _u
  65. }
  66. // SetAccountID sets the "account_id" field.
  67. func (_u *BatchImageJobUpdate) SetAccountID(v int64) *BatchImageJobUpdate {
  68. _u.mutation.ResetAccountID()
  69. _u.mutation.SetAccountID(v)
  70. return _u
  71. }
  72. // SetNillableAccountID sets the "account_id" field if the given value is not nil.
  73. func (_u *BatchImageJobUpdate) SetNillableAccountID(v *int64) *BatchImageJobUpdate {
  74. if v != nil {
  75. _u.SetAccountID(*v)
  76. }
  77. return _u
  78. }
  79. // AddAccountID adds value to the "account_id" field.
  80. func (_u *BatchImageJobUpdate) AddAccountID(v int64) *BatchImageJobUpdate {
  81. _u.mutation.AddAccountID(v)
  82. return _u
  83. }
  84. // ClearAccountID clears the value of the "account_id" field.
  85. func (_u *BatchImageJobUpdate) ClearAccountID() *BatchImageJobUpdate {
  86. _u.mutation.ClearAccountID()
  87. return _u
  88. }
  89. // SetProvider sets the "provider" field.
  90. func (_u *BatchImageJobUpdate) SetProvider(v string) *BatchImageJobUpdate {
  91. _u.mutation.SetProvider(v)
  92. return _u
  93. }
  94. // SetNillableProvider sets the "provider" field if the given value is not nil.
  95. func (_u *BatchImageJobUpdate) SetNillableProvider(v *string) *BatchImageJobUpdate {
  96. if v != nil {
  97. _u.SetProvider(*v)
  98. }
  99. return _u
  100. }
  101. // SetModel sets the "model" field.
  102. func (_u *BatchImageJobUpdate) SetModel(v string) *BatchImageJobUpdate {
  103. _u.mutation.SetModel(v)
  104. return _u
  105. }
  106. // SetNillableModel sets the "model" field if the given value is not nil.
  107. func (_u *BatchImageJobUpdate) SetNillableModel(v *string) *BatchImageJobUpdate {
  108. if v != nil {
  109. _u.SetModel(*v)
  110. }
  111. return _u
  112. }
  113. // SetTaskName sets the "task_name" field.
  114. func (_u *BatchImageJobUpdate) SetTaskName(v string) *BatchImageJobUpdate {
  115. _u.mutation.SetTaskName(v)
  116. return _u
  117. }
  118. // SetNillableTaskName sets the "task_name" field if the given value is not nil.
  119. func (_u *BatchImageJobUpdate) SetNillableTaskName(v *string) *BatchImageJobUpdate {
  120. if v != nil {
  121. _u.SetTaskName(*v)
  122. }
  123. return _u
  124. }
  125. // SetStatus sets the "status" field.
  126. func (_u *BatchImageJobUpdate) SetStatus(v string) *BatchImageJobUpdate {
  127. _u.mutation.SetStatus(v)
  128. return _u
  129. }
  130. // SetNillableStatus sets the "status" field if the given value is not nil.
  131. func (_u *BatchImageJobUpdate) SetNillableStatus(v *string) *BatchImageJobUpdate {
  132. if v != nil {
  133. _u.SetStatus(*v)
  134. }
  135. return _u
  136. }
  137. // SetProviderJobName sets the "provider_job_name" field.
  138. func (_u *BatchImageJobUpdate) SetProviderJobName(v string) *BatchImageJobUpdate {
  139. _u.mutation.SetProviderJobName(v)
  140. return _u
  141. }
  142. // SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
  143. func (_u *BatchImageJobUpdate) SetNillableProviderJobName(v *string) *BatchImageJobUpdate {
  144. if v != nil {
  145. _u.SetProviderJobName(*v)
  146. }
  147. return _u
  148. }
  149. // ClearProviderJobName clears the value of the "provider_job_name" field.
  150. func (_u *BatchImageJobUpdate) ClearProviderJobName() *BatchImageJobUpdate {
  151. _u.mutation.ClearProviderJobName()
  152. return _u
  153. }
  154. // SetProviderInputRef sets the "provider_input_ref" field.
  155. func (_u *BatchImageJobUpdate) SetProviderInputRef(v string) *BatchImageJobUpdate {
  156. _u.mutation.SetProviderInputRef(v)
  157. return _u
  158. }
  159. // SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
  160. func (_u *BatchImageJobUpdate) SetNillableProviderInputRef(v *string) *BatchImageJobUpdate {
  161. if v != nil {
  162. _u.SetProviderInputRef(*v)
  163. }
  164. return _u
  165. }
  166. // ClearProviderInputRef clears the value of the "provider_input_ref" field.
  167. func (_u *BatchImageJobUpdate) ClearProviderInputRef() *BatchImageJobUpdate {
  168. _u.mutation.ClearProviderInputRef()
  169. return _u
  170. }
  171. // SetProviderOutputRef sets the "provider_output_ref" field.
  172. func (_u *BatchImageJobUpdate) SetProviderOutputRef(v string) *BatchImageJobUpdate {
  173. _u.mutation.SetProviderOutputRef(v)
  174. return _u
  175. }
  176. // SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
  177. func (_u *BatchImageJobUpdate) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdate {
  178. if v != nil {
  179. _u.SetProviderOutputRef(*v)
  180. }
  181. return _u
  182. }
  183. // ClearProviderOutputRef clears the value of the "provider_output_ref" field.
  184. func (_u *BatchImageJobUpdate) ClearProviderOutputRef() *BatchImageJobUpdate {
  185. _u.mutation.ClearProviderOutputRef()
  186. return _u
  187. }
  188. // SetGcsInputURI sets the "gcs_input_uri" field.
  189. func (_u *BatchImageJobUpdate) SetGcsInputURI(v string) *BatchImageJobUpdate {
  190. _u.mutation.SetGcsInputURI(v)
  191. return _u
  192. }
  193. // SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
  194. func (_u *BatchImageJobUpdate) SetNillableGcsInputURI(v *string) *BatchImageJobUpdate {
  195. if v != nil {
  196. _u.SetGcsInputURI(*v)
  197. }
  198. return _u
  199. }
  200. // ClearGcsInputURI clears the value of the "gcs_input_uri" field.
  201. func (_u *BatchImageJobUpdate) ClearGcsInputURI() *BatchImageJobUpdate {
  202. _u.mutation.ClearGcsInputURI()
  203. return _u
  204. }
  205. // SetGcsOutputURI sets the "gcs_output_uri" field.
  206. func (_u *BatchImageJobUpdate) SetGcsOutputURI(v string) *BatchImageJobUpdate {
  207. _u.mutation.SetGcsOutputURI(v)
  208. return _u
  209. }
  210. // SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
  211. func (_u *BatchImageJobUpdate) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdate {
  212. if v != nil {
  213. _u.SetGcsOutputURI(*v)
  214. }
  215. return _u
  216. }
  217. // ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
  218. func (_u *BatchImageJobUpdate) ClearGcsOutputURI() *BatchImageJobUpdate {
  219. _u.mutation.ClearGcsOutputURI()
  220. return _u
  221. }
  222. // SetItemCount sets the "item_count" field.
  223. func (_u *BatchImageJobUpdate) SetItemCount(v int) *BatchImageJobUpdate {
  224. _u.mutation.ResetItemCount()
  225. _u.mutation.SetItemCount(v)
  226. return _u
  227. }
  228. // SetNillableItemCount sets the "item_count" field if the given value is not nil.
  229. func (_u *BatchImageJobUpdate) SetNillableItemCount(v *int) *BatchImageJobUpdate {
  230. if v != nil {
  231. _u.SetItemCount(*v)
  232. }
  233. return _u
  234. }
  235. // AddItemCount adds value to the "item_count" field.
  236. func (_u *BatchImageJobUpdate) AddItemCount(v int) *BatchImageJobUpdate {
  237. _u.mutation.AddItemCount(v)
  238. return _u
  239. }
  240. // SetSuccessCount sets the "success_count" field.
  241. func (_u *BatchImageJobUpdate) SetSuccessCount(v int) *BatchImageJobUpdate {
  242. _u.mutation.ResetSuccessCount()
  243. _u.mutation.SetSuccessCount(v)
  244. return _u
  245. }
  246. // SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
  247. func (_u *BatchImageJobUpdate) SetNillableSuccessCount(v *int) *BatchImageJobUpdate {
  248. if v != nil {
  249. _u.SetSuccessCount(*v)
  250. }
  251. return _u
  252. }
  253. // AddSuccessCount adds value to the "success_count" field.
  254. func (_u *BatchImageJobUpdate) AddSuccessCount(v int) *BatchImageJobUpdate {
  255. _u.mutation.AddSuccessCount(v)
  256. return _u
  257. }
  258. // SetFailCount sets the "fail_count" field.
  259. func (_u *BatchImageJobUpdate) SetFailCount(v int) *BatchImageJobUpdate {
  260. _u.mutation.ResetFailCount()
  261. _u.mutation.SetFailCount(v)
  262. return _u
  263. }
  264. // SetNillableFailCount sets the "fail_count" field if the given value is not nil.
  265. func (_u *BatchImageJobUpdate) SetNillableFailCount(v *int) *BatchImageJobUpdate {
  266. if v != nil {
  267. _u.SetFailCount(*v)
  268. }
  269. return _u
  270. }
  271. // AddFailCount adds value to the "fail_count" field.
  272. func (_u *BatchImageJobUpdate) AddFailCount(v int) *BatchImageJobUpdate {
  273. _u.mutation.AddFailCount(v)
  274. return _u
  275. }
  276. // SetCancelledCount sets the "cancelled_count" field.
  277. func (_u *BatchImageJobUpdate) SetCancelledCount(v int) *BatchImageJobUpdate {
  278. _u.mutation.ResetCancelledCount()
  279. _u.mutation.SetCancelledCount(v)
  280. return _u
  281. }
  282. // SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
  283. func (_u *BatchImageJobUpdate) SetNillableCancelledCount(v *int) *BatchImageJobUpdate {
  284. if v != nil {
  285. _u.SetCancelledCount(*v)
  286. }
  287. return _u
  288. }
  289. // AddCancelledCount adds value to the "cancelled_count" field.
  290. func (_u *BatchImageJobUpdate) AddCancelledCount(v int) *BatchImageJobUpdate {
  291. _u.mutation.AddCancelledCount(v)
  292. return _u
  293. }
  294. // SetEstimatedCost sets the "estimated_cost" field.
  295. func (_u *BatchImageJobUpdate) SetEstimatedCost(v float64) *BatchImageJobUpdate {
  296. _u.mutation.ResetEstimatedCost()
  297. _u.mutation.SetEstimatedCost(v)
  298. return _u
  299. }
  300. // SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
  301. func (_u *BatchImageJobUpdate) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdate {
  302. if v != nil {
  303. _u.SetEstimatedCost(*v)
  304. }
  305. return _u
  306. }
  307. // AddEstimatedCost adds value to the "estimated_cost" field.
  308. func (_u *BatchImageJobUpdate) AddEstimatedCost(v float64) *BatchImageJobUpdate {
  309. _u.mutation.AddEstimatedCost(v)
  310. return _u
  311. }
  312. // SetHoldAmount sets the "hold_amount" field.
  313. func (_u *BatchImageJobUpdate) SetHoldAmount(v float64) *BatchImageJobUpdate {
  314. _u.mutation.ResetHoldAmount()
  315. _u.mutation.SetHoldAmount(v)
  316. return _u
  317. }
  318. // SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
  319. func (_u *BatchImageJobUpdate) SetNillableHoldAmount(v *float64) *BatchImageJobUpdate {
  320. if v != nil {
  321. _u.SetHoldAmount(*v)
  322. }
  323. return _u
  324. }
  325. // AddHoldAmount adds value to the "hold_amount" field.
  326. func (_u *BatchImageJobUpdate) AddHoldAmount(v float64) *BatchImageJobUpdate {
  327. _u.mutation.AddHoldAmount(v)
  328. return _u
  329. }
  330. // ClearHoldAmount clears the value of the "hold_amount" field.
  331. func (_u *BatchImageJobUpdate) ClearHoldAmount() *BatchImageJobUpdate {
  332. _u.mutation.ClearHoldAmount()
  333. return _u
  334. }
  335. // SetActualCost sets the "actual_cost" field.
  336. func (_u *BatchImageJobUpdate) SetActualCost(v float64) *BatchImageJobUpdate {
  337. _u.mutation.ResetActualCost()
  338. _u.mutation.SetActualCost(v)
  339. return _u
  340. }
  341. // SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
  342. func (_u *BatchImageJobUpdate) SetNillableActualCost(v *float64) *BatchImageJobUpdate {
  343. if v != nil {
  344. _u.SetActualCost(*v)
  345. }
  346. return _u
  347. }
  348. // AddActualCost adds value to the "actual_cost" field.
  349. func (_u *BatchImageJobUpdate) AddActualCost(v float64) *BatchImageJobUpdate {
  350. _u.mutation.AddActualCost(v)
  351. return _u
  352. }
  353. // ClearActualCost clears the value of the "actual_cost" field.
  354. func (_u *BatchImageJobUpdate) ClearActualCost() *BatchImageJobUpdate {
  355. _u.mutation.ClearActualCost()
  356. return _u
  357. }
  358. // SetCurrency sets the "currency" field.
  359. func (_u *BatchImageJobUpdate) SetCurrency(v string) *BatchImageJobUpdate {
  360. _u.mutation.SetCurrency(v)
  361. return _u
  362. }
  363. // SetNillableCurrency sets the "currency" field if the given value is not nil.
  364. func (_u *BatchImageJobUpdate) SetNillableCurrency(v *string) *BatchImageJobUpdate {
  365. if v != nil {
  366. _u.SetCurrency(*v)
  367. }
  368. return _u
  369. }
  370. // SetHoldID sets the "hold_id" field.
  371. func (_u *BatchImageJobUpdate) SetHoldID(v string) *BatchImageJobUpdate {
  372. _u.mutation.SetHoldID(v)
  373. return _u
  374. }
  375. // SetNillableHoldID sets the "hold_id" field if the given value is not nil.
  376. func (_u *BatchImageJobUpdate) SetNillableHoldID(v *string) *BatchImageJobUpdate {
  377. if v != nil {
  378. _u.SetHoldID(*v)
  379. }
  380. return _u
  381. }
  382. // ClearHoldID clears the value of the "hold_id" field.
  383. func (_u *BatchImageJobUpdate) ClearHoldID() *BatchImageJobUpdate {
  384. _u.mutation.ClearHoldID()
  385. return _u
  386. }
  387. // SetIdempotencyKey sets the "idempotency_key" field.
  388. func (_u *BatchImageJobUpdate) SetIdempotencyKey(v string) *BatchImageJobUpdate {
  389. _u.mutation.SetIdempotencyKey(v)
  390. return _u
  391. }
  392. // SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
  393. func (_u *BatchImageJobUpdate) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdate {
  394. if v != nil {
  395. _u.SetIdempotencyKey(*v)
  396. }
  397. return _u
  398. }
  399. // ClearIdempotencyKey clears the value of the "idempotency_key" field.
  400. func (_u *BatchImageJobUpdate) ClearIdempotencyKey() *BatchImageJobUpdate {
  401. _u.mutation.ClearIdempotencyKey()
  402. return _u
  403. }
  404. // SetRequestHash sets the "request_hash" field.
  405. func (_u *BatchImageJobUpdate) SetRequestHash(v string) *BatchImageJobUpdate {
  406. _u.mutation.SetRequestHash(v)
  407. return _u
  408. }
  409. // SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
  410. func (_u *BatchImageJobUpdate) SetNillableRequestHash(v *string) *BatchImageJobUpdate {
  411. if v != nil {
  412. _u.SetRequestHash(*v)
  413. }
  414. return _u
  415. }
  416. // ClearRequestHash clears the value of the "request_hash" field.
  417. func (_u *BatchImageJobUpdate) ClearRequestHash() *BatchImageJobUpdate {
  418. _u.mutation.ClearRequestHash()
  419. return _u
  420. }
  421. // SetManifestHash sets the "manifest_hash" field.
  422. func (_u *BatchImageJobUpdate) SetManifestHash(v string) *BatchImageJobUpdate {
  423. _u.mutation.SetManifestHash(v)
  424. return _u
  425. }
  426. // SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
  427. func (_u *BatchImageJobUpdate) SetNillableManifestHash(v *string) *BatchImageJobUpdate {
  428. if v != nil {
  429. _u.SetManifestHash(*v)
  430. }
  431. return _u
  432. }
  433. // ClearManifestHash clears the value of the "manifest_hash" field.
  434. func (_u *BatchImageJobUpdate) ClearManifestHash() *BatchImageJobUpdate {
  435. _u.mutation.ClearManifestHash()
  436. return _u
  437. }
  438. // SetRetryCount sets the "retry_count" field.
  439. func (_u *BatchImageJobUpdate) SetRetryCount(v int) *BatchImageJobUpdate {
  440. _u.mutation.ResetRetryCount()
  441. _u.mutation.SetRetryCount(v)
  442. return _u
  443. }
  444. // SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
  445. func (_u *BatchImageJobUpdate) SetNillableRetryCount(v *int) *BatchImageJobUpdate {
  446. if v != nil {
  447. _u.SetRetryCount(*v)
  448. }
  449. return _u
  450. }
  451. // AddRetryCount adds value to the "retry_count" field.
  452. func (_u *BatchImageJobUpdate) AddRetryCount(v int) *BatchImageJobUpdate {
  453. _u.mutation.AddRetryCount(v)
  454. return _u
  455. }
  456. // SetVersion sets the "version" field.
  457. func (_u *BatchImageJobUpdate) SetVersion(v int) *BatchImageJobUpdate {
  458. _u.mutation.ResetVersion()
  459. _u.mutation.SetVersion(v)
  460. return _u
  461. }
  462. // SetNillableVersion sets the "version" field if the given value is not nil.
  463. func (_u *BatchImageJobUpdate) SetNillableVersion(v *int) *BatchImageJobUpdate {
  464. if v != nil {
  465. _u.SetVersion(*v)
  466. }
  467. return _u
  468. }
  469. // AddVersion adds value to the "version" field.
  470. func (_u *BatchImageJobUpdate) AddVersion(v int) *BatchImageJobUpdate {
  471. _u.mutation.AddVersion(v)
  472. return _u
  473. }
  474. // SetOutputExpiresAt sets the "output_expires_at" field.
  475. func (_u *BatchImageJobUpdate) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdate {
  476. _u.mutation.SetOutputExpiresAt(v)
  477. return _u
  478. }
  479. // SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
  480. func (_u *BatchImageJobUpdate) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdate {
  481. if v != nil {
  482. _u.SetOutputExpiresAt(*v)
  483. }
  484. return _u
  485. }
  486. // ClearOutputExpiresAt clears the value of the "output_expires_at" field.
  487. func (_u *BatchImageJobUpdate) ClearOutputExpiresAt() *BatchImageJobUpdate {
  488. _u.mutation.ClearOutputExpiresAt()
  489. return _u
  490. }
  491. // SetInputDeletedAt sets the "input_deleted_at" field.
  492. func (_u *BatchImageJobUpdate) SetInputDeletedAt(v time.Time) *BatchImageJobUpdate {
  493. _u.mutation.SetInputDeletedAt(v)
  494. return _u
  495. }
  496. // SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
  497. func (_u *BatchImageJobUpdate) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdate {
  498. if v != nil {
  499. _u.SetInputDeletedAt(*v)
  500. }
  501. return _u
  502. }
  503. // ClearInputDeletedAt clears the value of the "input_deleted_at" field.
  504. func (_u *BatchImageJobUpdate) ClearInputDeletedAt() *BatchImageJobUpdate {
  505. _u.mutation.ClearInputDeletedAt()
  506. return _u
  507. }
  508. // SetOutputDeletedAt sets the "output_deleted_at" field.
  509. func (_u *BatchImageJobUpdate) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdate {
  510. _u.mutation.SetOutputDeletedAt(v)
  511. return _u
  512. }
  513. // SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
  514. func (_u *BatchImageJobUpdate) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdate {
  515. if v != nil {
  516. _u.SetOutputDeletedAt(*v)
  517. }
  518. return _u
  519. }
  520. // ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
  521. func (_u *BatchImageJobUpdate) ClearOutputDeletedAt() *BatchImageJobUpdate {
  522. _u.mutation.ClearOutputDeletedAt()
  523. return _u
  524. }
  525. // SetDownloadedAt sets the "downloaded_at" field.
  526. func (_u *BatchImageJobUpdate) SetDownloadedAt(v time.Time) *BatchImageJobUpdate {
  527. _u.mutation.SetDownloadedAt(v)
  528. return _u
  529. }
  530. // SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
  531. func (_u *BatchImageJobUpdate) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdate {
  532. if v != nil {
  533. _u.SetDownloadedAt(*v)
  534. }
  535. return _u
  536. }
  537. // ClearDownloadedAt clears the value of the "downloaded_at" field.
  538. func (_u *BatchImageJobUpdate) ClearDownloadedAt() *BatchImageJobUpdate {
  539. _u.mutation.ClearDownloadedAt()
  540. return _u
  541. }
  542. // SetUserDeletedAt sets the "user_deleted_at" field.
  543. func (_u *BatchImageJobUpdate) SetUserDeletedAt(v time.Time) *BatchImageJobUpdate {
  544. _u.mutation.SetUserDeletedAt(v)
  545. return _u
  546. }
  547. // SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
  548. func (_u *BatchImageJobUpdate) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdate {
  549. if v != nil {
  550. _u.SetUserDeletedAt(*v)
  551. }
  552. return _u
  553. }
  554. // ClearUserDeletedAt clears the value of the "user_deleted_at" field.
  555. func (_u *BatchImageJobUpdate) ClearUserDeletedAt() *BatchImageJobUpdate {
  556. _u.mutation.ClearUserDeletedAt()
  557. return _u
  558. }
  559. // SetLastErrorCode sets the "last_error_code" field.
  560. func (_u *BatchImageJobUpdate) SetLastErrorCode(v string) *BatchImageJobUpdate {
  561. _u.mutation.SetLastErrorCode(v)
  562. return _u
  563. }
  564. // SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
  565. func (_u *BatchImageJobUpdate) SetNillableLastErrorCode(v *string) *BatchImageJobUpdate {
  566. if v != nil {
  567. _u.SetLastErrorCode(*v)
  568. }
  569. return _u
  570. }
  571. // ClearLastErrorCode clears the value of the "last_error_code" field.
  572. func (_u *BatchImageJobUpdate) ClearLastErrorCode() *BatchImageJobUpdate {
  573. _u.mutation.ClearLastErrorCode()
  574. return _u
  575. }
  576. // SetLastErrorMessage sets the "last_error_message" field.
  577. func (_u *BatchImageJobUpdate) SetLastErrorMessage(v string) *BatchImageJobUpdate {
  578. _u.mutation.SetLastErrorMessage(v)
  579. return _u
  580. }
  581. // SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
  582. func (_u *BatchImageJobUpdate) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdate {
  583. if v != nil {
  584. _u.SetLastErrorMessage(*v)
  585. }
  586. return _u
  587. }
  588. // ClearLastErrorMessage clears the value of the "last_error_message" field.
  589. func (_u *BatchImageJobUpdate) ClearLastErrorMessage() *BatchImageJobUpdate {
  590. _u.mutation.ClearLastErrorMessage()
  591. return _u
  592. }
  593. // SetUpdatedAt sets the "updated_at" field.
  594. func (_u *BatchImageJobUpdate) SetUpdatedAt(v time.Time) *BatchImageJobUpdate {
  595. _u.mutation.SetUpdatedAt(v)
  596. return _u
  597. }
  598. // SetSubmittedAt sets the "submitted_at" field.
  599. func (_u *BatchImageJobUpdate) SetSubmittedAt(v time.Time) *BatchImageJobUpdate {
  600. _u.mutation.SetSubmittedAt(v)
  601. return _u
  602. }
  603. // SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
  604. func (_u *BatchImageJobUpdate) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdate {
  605. if v != nil {
  606. _u.SetSubmittedAt(*v)
  607. }
  608. return _u
  609. }
  610. // ClearSubmittedAt clears the value of the "submitted_at" field.
  611. func (_u *BatchImageJobUpdate) ClearSubmittedAt() *BatchImageJobUpdate {
  612. _u.mutation.ClearSubmittedAt()
  613. return _u
  614. }
  615. // SetStartedAt sets the "started_at" field.
  616. func (_u *BatchImageJobUpdate) SetStartedAt(v time.Time) *BatchImageJobUpdate {
  617. _u.mutation.SetStartedAt(v)
  618. return _u
  619. }
  620. // SetNillableStartedAt sets the "started_at" field if the given value is not nil.
  621. func (_u *BatchImageJobUpdate) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdate {
  622. if v != nil {
  623. _u.SetStartedAt(*v)
  624. }
  625. return _u
  626. }
  627. // ClearStartedAt clears the value of the "started_at" field.
  628. func (_u *BatchImageJobUpdate) ClearStartedAt() *BatchImageJobUpdate {
  629. _u.mutation.ClearStartedAt()
  630. return _u
  631. }
  632. // SetFinishedAt sets the "finished_at" field.
  633. func (_u *BatchImageJobUpdate) SetFinishedAt(v time.Time) *BatchImageJobUpdate {
  634. _u.mutation.SetFinishedAt(v)
  635. return _u
  636. }
  637. // SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
  638. func (_u *BatchImageJobUpdate) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdate {
  639. if v != nil {
  640. _u.SetFinishedAt(*v)
  641. }
  642. return _u
  643. }
  644. // ClearFinishedAt clears the value of the "finished_at" field.
  645. func (_u *BatchImageJobUpdate) ClearFinishedAt() *BatchImageJobUpdate {
  646. _u.mutation.ClearFinishedAt()
  647. return _u
  648. }
  649. // SetSettledAt sets the "settled_at" field.
  650. func (_u *BatchImageJobUpdate) SetSettledAt(v time.Time) *BatchImageJobUpdate {
  651. _u.mutation.SetSettledAt(v)
  652. return _u
  653. }
  654. // SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
  655. func (_u *BatchImageJobUpdate) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdate {
  656. if v != nil {
  657. _u.SetSettledAt(*v)
  658. }
  659. return _u
  660. }
  661. // ClearSettledAt clears the value of the "settled_at" field.
  662. func (_u *BatchImageJobUpdate) ClearSettledAt() *BatchImageJobUpdate {
  663. _u.mutation.ClearSettledAt()
  664. return _u
  665. }
  666. // Mutation returns the BatchImageJobMutation object of the builder.
  667. func (_u *BatchImageJobUpdate) Mutation() *BatchImageJobMutation {
  668. return _u.mutation
  669. }
  670. // Save executes the query and returns the number of nodes affected by the update operation.
  671. func (_u *BatchImageJobUpdate) Save(ctx context.Context) (int, error) {
  672. _u.defaults()
  673. return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
  674. }
  675. // SaveX is like Save, but panics if an error occurs.
  676. func (_u *BatchImageJobUpdate) SaveX(ctx context.Context) int {
  677. affected, err := _u.Save(ctx)
  678. if err != nil {
  679. panic(err)
  680. }
  681. return affected
  682. }
  683. // Exec executes the query.
  684. func (_u *BatchImageJobUpdate) Exec(ctx context.Context) error {
  685. _, err := _u.Save(ctx)
  686. return err
  687. }
  688. // ExecX is like Exec, but panics if an error occurs.
  689. func (_u *BatchImageJobUpdate) ExecX(ctx context.Context) {
  690. if err := _u.Exec(ctx); err != nil {
  691. panic(err)
  692. }
  693. }
  694. // defaults sets the default values of the builder before save.
  695. func (_u *BatchImageJobUpdate) defaults() {
  696. if _, ok := _u.mutation.UpdatedAt(); !ok {
  697. v := batchimagejob.UpdateDefaultUpdatedAt()
  698. _u.mutation.SetUpdatedAt(v)
  699. }
  700. }
  701. // check runs all checks and user-defined validators on the builder.
  702. func (_u *BatchImageJobUpdate) check() error {
  703. if v, ok := _u.mutation.Provider(); ok {
  704. if err := batchimagejob.ProviderValidator(v); err != nil {
  705. return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
  706. }
  707. }
  708. if v, ok := _u.mutation.Model(); ok {
  709. if err := batchimagejob.ModelValidator(v); err != nil {
  710. return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
  711. }
  712. }
  713. if v, ok := _u.mutation.TaskName(); ok {
  714. if err := batchimagejob.TaskNameValidator(v); err != nil {
  715. return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
  716. }
  717. }
  718. if v, ok := _u.mutation.Status(); ok {
  719. if err := batchimagejob.StatusValidator(v); err != nil {
  720. return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
  721. }
  722. }
  723. if v, ok := _u.mutation.ProviderJobName(); ok {
  724. if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
  725. return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
  726. }
  727. }
  728. if v, ok := _u.mutation.ProviderInputRef(); ok {
  729. if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
  730. return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
  731. }
  732. }
  733. if v, ok := _u.mutation.ProviderOutputRef(); ok {
  734. if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
  735. return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
  736. }
  737. }
  738. if v, ok := _u.mutation.GcsInputURI(); ok {
  739. if err := batchimagejob.GcsInputURIValidator(v); err != nil {
  740. return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
  741. }
  742. }
  743. if v, ok := _u.mutation.GcsOutputURI(); ok {
  744. if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
  745. return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
  746. }
  747. }
  748. if v, ok := _u.mutation.Currency(); ok {
  749. if err := batchimagejob.CurrencyValidator(v); err != nil {
  750. return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
  751. }
  752. }
  753. if v, ok := _u.mutation.HoldID(); ok {
  754. if err := batchimagejob.HoldIDValidator(v); err != nil {
  755. return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
  756. }
  757. }
  758. if v, ok := _u.mutation.IdempotencyKey(); ok {
  759. if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
  760. return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
  761. }
  762. }
  763. if v, ok := _u.mutation.RequestHash(); ok {
  764. if err := batchimagejob.RequestHashValidator(v); err != nil {
  765. return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
  766. }
  767. }
  768. if v, ok := _u.mutation.ManifestHash(); ok {
  769. if err := batchimagejob.ManifestHashValidator(v); err != nil {
  770. return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
  771. }
  772. }
  773. if v, ok := _u.mutation.LastErrorCode(); ok {
  774. if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
  775. return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
  776. }
  777. }
  778. return nil
  779. }
  780. func (_u *BatchImageJobUpdate) sqlSave(ctx context.Context) (_node int, err error) {
  781. if err := _u.check(); err != nil {
  782. return _node, err
  783. }
  784. _spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
  785. if ps := _u.mutation.predicates; len(ps) > 0 {
  786. _spec.Predicate = func(selector *sql.Selector) {
  787. for i := range ps {
  788. ps[i](selector)
  789. }
  790. }
  791. }
  792. if value, ok := _u.mutation.UserID(); ok {
  793. _spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
  794. }
  795. if value, ok := _u.mutation.AddedUserID(); ok {
  796. _spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
  797. }
  798. if value, ok := _u.mutation.APIKeyID(); ok {
  799. _spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
  800. }
  801. if value, ok := _u.mutation.AddedAPIKeyID(); ok {
  802. _spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
  803. }
  804. if _u.mutation.APIKeyIDCleared() {
  805. _spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
  806. }
  807. if value, ok := _u.mutation.AccountID(); ok {
  808. _spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
  809. }
  810. if value, ok := _u.mutation.AddedAccountID(); ok {
  811. _spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
  812. }
  813. if _u.mutation.AccountIDCleared() {
  814. _spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
  815. }
  816. if value, ok := _u.mutation.Provider(); ok {
  817. _spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
  818. }
  819. if value, ok := _u.mutation.Model(); ok {
  820. _spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
  821. }
  822. if value, ok := _u.mutation.TaskName(); ok {
  823. _spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
  824. }
  825. if value, ok := _u.mutation.Status(); ok {
  826. _spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
  827. }
  828. if value, ok := _u.mutation.ProviderJobName(); ok {
  829. _spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
  830. }
  831. if _u.mutation.ProviderJobNameCleared() {
  832. _spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
  833. }
  834. if value, ok := _u.mutation.ProviderInputRef(); ok {
  835. _spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
  836. }
  837. if _u.mutation.ProviderInputRefCleared() {
  838. _spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
  839. }
  840. if value, ok := _u.mutation.ProviderOutputRef(); ok {
  841. _spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
  842. }
  843. if _u.mutation.ProviderOutputRefCleared() {
  844. _spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
  845. }
  846. if value, ok := _u.mutation.GcsInputURI(); ok {
  847. _spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
  848. }
  849. if _u.mutation.GcsInputURICleared() {
  850. _spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
  851. }
  852. if value, ok := _u.mutation.GcsOutputURI(); ok {
  853. _spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
  854. }
  855. if _u.mutation.GcsOutputURICleared() {
  856. _spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
  857. }
  858. if value, ok := _u.mutation.ItemCount(); ok {
  859. _spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
  860. }
  861. if value, ok := _u.mutation.AddedItemCount(); ok {
  862. _spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
  863. }
  864. if value, ok := _u.mutation.SuccessCount(); ok {
  865. _spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
  866. }
  867. if value, ok := _u.mutation.AddedSuccessCount(); ok {
  868. _spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
  869. }
  870. if value, ok := _u.mutation.FailCount(); ok {
  871. _spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
  872. }
  873. if value, ok := _u.mutation.AddedFailCount(); ok {
  874. _spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
  875. }
  876. if value, ok := _u.mutation.CancelledCount(); ok {
  877. _spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
  878. }
  879. if value, ok := _u.mutation.AddedCancelledCount(); ok {
  880. _spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
  881. }
  882. if value, ok := _u.mutation.EstimatedCost(); ok {
  883. _spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
  884. }
  885. if value, ok := _u.mutation.AddedEstimatedCost(); ok {
  886. _spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
  887. }
  888. if value, ok := _u.mutation.HoldAmount(); ok {
  889. _spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
  890. }
  891. if value, ok := _u.mutation.AddedHoldAmount(); ok {
  892. _spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
  893. }
  894. if _u.mutation.HoldAmountCleared() {
  895. _spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
  896. }
  897. if value, ok := _u.mutation.ActualCost(); ok {
  898. _spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
  899. }
  900. if value, ok := _u.mutation.AddedActualCost(); ok {
  901. _spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
  902. }
  903. if _u.mutation.ActualCostCleared() {
  904. _spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
  905. }
  906. if value, ok := _u.mutation.Currency(); ok {
  907. _spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
  908. }
  909. if value, ok := _u.mutation.HoldID(); ok {
  910. _spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
  911. }
  912. if _u.mutation.HoldIDCleared() {
  913. _spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
  914. }
  915. if value, ok := _u.mutation.IdempotencyKey(); ok {
  916. _spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
  917. }
  918. if _u.mutation.IdempotencyKeyCleared() {
  919. _spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
  920. }
  921. if value, ok := _u.mutation.RequestHash(); ok {
  922. _spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
  923. }
  924. if _u.mutation.RequestHashCleared() {
  925. _spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
  926. }
  927. if value, ok := _u.mutation.ManifestHash(); ok {
  928. _spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
  929. }
  930. if _u.mutation.ManifestHashCleared() {
  931. _spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
  932. }
  933. if value, ok := _u.mutation.RetryCount(); ok {
  934. _spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
  935. }
  936. if value, ok := _u.mutation.AddedRetryCount(); ok {
  937. _spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
  938. }
  939. if value, ok := _u.mutation.Version(); ok {
  940. _spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
  941. }
  942. if value, ok := _u.mutation.AddedVersion(); ok {
  943. _spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
  944. }
  945. if value, ok := _u.mutation.OutputExpiresAt(); ok {
  946. _spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
  947. }
  948. if _u.mutation.OutputExpiresAtCleared() {
  949. _spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
  950. }
  951. if value, ok := _u.mutation.InputDeletedAt(); ok {
  952. _spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
  953. }
  954. if _u.mutation.InputDeletedAtCleared() {
  955. _spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
  956. }
  957. if value, ok := _u.mutation.OutputDeletedAt(); ok {
  958. _spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
  959. }
  960. if _u.mutation.OutputDeletedAtCleared() {
  961. _spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
  962. }
  963. if value, ok := _u.mutation.DownloadedAt(); ok {
  964. _spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
  965. }
  966. if _u.mutation.DownloadedAtCleared() {
  967. _spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
  968. }
  969. if value, ok := _u.mutation.UserDeletedAt(); ok {
  970. _spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
  971. }
  972. if _u.mutation.UserDeletedAtCleared() {
  973. _spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
  974. }
  975. if value, ok := _u.mutation.LastErrorCode(); ok {
  976. _spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
  977. }
  978. if _u.mutation.LastErrorCodeCleared() {
  979. _spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
  980. }
  981. if value, ok := _u.mutation.LastErrorMessage(); ok {
  982. _spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
  983. }
  984. if _u.mutation.LastErrorMessageCleared() {
  985. _spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
  986. }
  987. if value, ok := _u.mutation.UpdatedAt(); ok {
  988. _spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
  989. }
  990. if value, ok := _u.mutation.SubmittedAt(); ok {
  991. _spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
  992. }
  993. if _u.mutation.SubmittedAtCleared() {
  994. _spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
  995. }
  996. if value, ok := _u.mutation.StartedAt(); ok {
  997. _spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
  998. }
  999. if _u.mutation.StartedAtCleared() {
  1000. _spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
  1001. }
  1002. if value, ok := _u.mutation.FinishedAt(); ok {
  1003. _spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
  1004. }
  1005. if _u.mutation.FinishedAtCleared() {
  1006. _spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
  1007. }
  1008. if value, ok := _u.mutation.SettledAt(); ok {
  1009. _spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
  1010. }
  1011. if _u.mutation.SettledAtCleared() {
  1012. _spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
  1013. }
  1014. if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
  1015. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  1016. err = &NotFoundError{batchimagejob.Label}
  1017. } else if sqlgraph.IsConstraintError(err) {
  1018. err = &ConstraintError{msg: err.Error(), wrap: err}
  1019. }
  1020. return 0, err
  1021. }
  1022. _u.mutation.done = true
  1023. return _node, nil
  1024. }
  1025. // BatchImageJobUpdateOne is the builder for updating a single BatchImageJob entity.
  1026. type BatchImageJobUpdateOne struct {
  1027. config
  1028. fields []string
  1029. hooks []Hook
  1030. mutation *BatchImageJobMutation
  1031. }
  1032. // SetUserID sets the "user_id" field.
  1033. func (_u *BatchImageJobUpdateOne) SetUserID(v int64) *BatchImageJobUpdateOne {
  1034. _u.mutation.ResetUserID()
  1035. _u.mutation.SetUserID(v)
  1036. return _u
  1037. }
  1038. // SetNillableUserID sets the "user_id" field if the given value is not nil.
  1039. func (_u *BatchImageJobUpdateOne) SetNillableUserID(v *int64) *BatchImageJobUpdateOne {
  1040. if v != nil {
  1041. _u.SetUserID(*v)
  1042. }
  1043. return _u
  1044. }
  1045. // AddUserID adds value to the "user_id" field.
  1046. func (_u *BatchImageJobUpdateOne) AddUserID(v int64) *BatchImageJobUpdateOne {
  1047. _u.mutation.AddUserID(v)
  1048. return _u
  1049. }
  1050. // SetAPIKeyID sets the "api_key_id" field.
  1051. func (_u *BatchImageJobUpdateOne) SetAPIKeyID(v int64) *BatchImageJobUpdateOne {
  1052. _u.mutation.ResetAPIKeyID()
  1053. _u.mutation.SetAPIKeyID(v)
  1054. return _u
  1055. }
  1056. // SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
  1057. func (_u *BatchImageJobUpdateOne) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdateOne {
  1058. if v != nil {
  1059. _u.SetAPIKeyID(*v)
  1060. }
  1061. return _u
  1062. }
  1063. // AddAPIKeyID adds value to the "api_key_id" field.
  1064. func (_u *BatchImageJobUpdateOne) AddAPIKeyID(v int64) *BatchImageJobUpdateOne {
  1065. _u.mutation.AddAPIKeyID(v)
  1066. return _u
  1067. }
  1068. // ClearAPIKeyID clears the value of the "api_key_id" field.
  1069. func (_u *BatchImageJobUpdateOne) ClearAPIKeyID() *BatchImageJobUpdateOne {
  1070. _u.mutation.ClearAPIKeyID()
  1071. return _u
  1072. }
  1073. // SetAccountID sets the "account_id" field.
  1074. func (_u *BatchImageJobUpdateOne) SetAccountID(v int64) *BatchImageJobUpdateOne {
  1075. _u.mutation.ResetAccountID()
  1076. _u.mutation.SetAccountID(v)
  1077. return _u
  1078. }
  1079. // SetNillableAccountID sets the "account_id" field if the given value is not nil.
  1080. func (_u *BatchImageJobUpdateOne) SetNillableAccountID(v *int64) *BatchImageJobUpdateOne {
  1081. if v != nil {
  1082. _u.SetAccountID(*v)
  1083. }
  1084. return _u
  1085. }
  1086. // AddAccountID adds value to the "account_id" field.
  1087. func (_u *BatchImageJobUpdateOne) AddAccountID(v int64) *BatchImageJobUpdateOne {
  1088. _u.mutation.AddAccountID(v)
  1089. return _u
  1090. }
  1091. // ClearAccountID clears the value of the "account_id" field.
  1092. func (_u *BatchImageJobUpdateOne) ClearAccountID() *BatchImageJobUpdateOne {
  1093. _u.mutation.ClearAccountID()
  1094. return _u
  1095. }
  1096. // SetProvider sets the "provider" field.
  1097. func (_u *BatchImageJobUpdateOne) SetProvider(v string) *BatchImageJobUpdateOne {
  1098. _u.mutation.SetProvider(v)
  1099. return _u
  1100. }
  1101. // SetNillableProvider sets the "provider" field if the given value is not nil.
  1102. func (_u *BatchImageJobUpdateOne) SetNillableProvider(v *string) *BatchImageJobUpdateOne {
  1103. if v != nil {
  1104. _u.SetProvider(*v)
  1105. }
  1106. return _u
  1107. }
  1108. // SetModel sets the "model" field.
  1109. func (_u *BatchImageJobUpdateOne) SetModel(v string) *BatchImageJobUpdateOne {
  1110. _u.mutation.SetModel(v)
  1111. return _u
  1112. }
  1113. // SetNillableModel sets the "model" field if the given value is not nil.
  1114. func (_u *BatchImageJobUpdateOne) SetNillableModel(v *string) *BatchImageJobUpdateOne {
  1115. if v != nil {
  1116. _u.SetModel(*v)
  1117. }
  1118. return _u
  1119. }
  1120. // SetTaskName sets the "task_name" field.
  1121. func (_u *BatchImageJobUpdateOne) SetTaskName(v string) *BatchImageJobUpdateOne {
  1122. _u.mutation.SetTaskName(v)
  1123. return _u
  1124. }
  1125. // SetNillableTaskName sets the "task_name" field if the given value is not nil.
  1126. func (_u *BatchImageJobUpdateOne) SetNillableTaskName(v *string) *BatchImageJobUpdateOne {
  1127. if v != nil {
  1128. _u.SetTaskName(*v)
  1129. }
  1130. return _u
  1131. }
  1132. // SetStatus sets the "status" field.
  1133. func (_u *BatchImageJobUpdateOne) SetStatus(v string) *BatchImageJobUpdateOne {
  1134. _u.mutation.SetStatus(v)
  1135. return _u
  1136. }
  1137. // SetNillableStatus sets the "status" field if the given value is not nil.
  1138. func (_u *BatchImageJobUpdateOne) SetNillableStatus(v *string) *BatchImageJobUpdateOne {
  1139. if v != nil {
  1140. _u.SetStatus(*v)
  1141. }
  1142. return _u
  1143. }
  1144. // SetProviderJobName sets the "provider_job_name" field.
  1145. func (_u *BatchImageJobUpdateOne) SetProviderJobName(v string) *BatchImageJobUpdateOne {
  1146. _u.mutation.SetProviderJobName(v)
  1147. return _u
  1148. }
  1149. // SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
  1150. func (_u *BatchImageJobUpdateOne) SetNillableProviderJobName(v *string) *BatchImageJobUpdateOne {
  1151. if v != nil {
  1152. _u.SetProviderJobName(*v)
  1153. }
  1154. return _u
  1155. }
  1156. // ClearProviderJobName clears the value of the "provider_job_name" field.
  1157. func (_u *BatchImageJobUpdateOne) ClearProviderJobName() *BatchImageJobUpdateOne {
  1158. _u.mutation.ClearProviderJobName()
  1159. return _u
  1160. }
  1161. // SetProviderInputRef sets the "provider_input_ref" field.
  1162. func (_u *BatchImageJobUpdateOne) SetProviderInputRef(v string) *BatchImageJobUpdateOne {
  1163. _u.mutation.SetProviderInputRef(v)
  1164. return _u
  1165. }
  1166. // SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
  1167. func (_u *BatchImageJobUpdateOne) SetNillableProviderInputRef(v *string) *BatchImageJobUpdateOne {
  1168. if v != nil {
  1169. _u.SetProviderInputRef(*v)
  1170. }
  1171. return _u
  1172. }
  1173. // ClearProviderInputRef clears the value of the "provider_input_ref" field.
  1174. func (_u *BatchImageJobUpdateOne) ClearProviderInputRef() *BatchImageJobUpdateOne {
  1175. _u.mutation.ClearProviderInputRef()
  1176. return _u
  1177. }
  1178. // SetProviderOutputRef sets the "provider_output_ref" field.
  1179. func (_u *BatchImageJobUpdateOne) SetProviderOutputRef(v string) *BatchImageJobUpdateOne {
  1180. _u.mutation.SetProviderOutputRef(v)
  1181. return _u
  1182. }
  1183. // SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
  1184. func (_u *BatchImageJobUpdateOne) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdateOne {
  1185. if v != nil {
  1186. _u.SetProviderOutputRef(*v)
  1187. }
  1188. return _u
  1189. }
  1190. // ClearProviderOutputRef clears the value of the "provider_output_ref" field.
  1191. func (_u *BatchImageJobUpdateOne) ClearProviderOutputRef() *BatchImageJobUpdateOne {
  1192. _u.mutation.ClearProviderOutputRef()
  1193. return _u
  1194. }
  1195. // SetGcsInputURI sets the "gcs_input_uri" field.
  1196. func (_u *BatchImageJobUpdateOne) SetGcsInputURI(v string) *BatchImageJobUpdateOne {
  1197. _u.mutation.SetGcsInputURI(v)
  1198. return _u
  1199. }
  1200. // SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
  1201. func (_u *BatchImageJobUpdateOne) SetNillableGcsInputURI(v *string) *BatchImageJobUpdateOne {
  1202. if v != nil {
  1203. _u.SetGcsInputURI(*v)
  1204. }
  1205. return _u
  1206. }
  1207. // ClearGcsInputURI clears the value of the "gcs_input_uri" field.
  1208. func (_u *BatchImageJobUpdateOne) ClearGcsInputURI() *BatchImageJobUpdateOne {
  1209. _u.mutation.ClearGcsInputURI()
  1210. return _u
  1211. }
  1212. // SetGcsOutputURI sets the "gcs_output_uri" field.
  1213. func (_u *BatchImageJobUpdateOne) SetGcsOutputURI(v string) *BatchImageJobUpdateOne {
  1214. _u.mutation.SetGcsOutputURI(v)
  1215. return _u
  1216. }
  1217. // SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
  1218. func (_u *BatchImageJobUpdateOne) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdateOne {
  1219. if v != nil {
  1220. _u.SetGcsOutputURI(*v)
  1221. }
  1222. return _u
  1223. }
  1224. // ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
  1225. func (_u *BatchImageJobUpdateOne) ClearGcsOutputURI() *BatchImageJobUpdateOne {
  1226. _u.mutation.ClearGcsOutputURI()
  1227. return _u
  1228. }
  1229. // SetItemCount sets the "item_count" field.
  1230. func (_u *BatchImageJobUpdateOne) SetItemCount(v int) *BatchImageJobUpdateOne {
  1231. _u.mutation.ResetItemCount()
  1232. _u.mutation.SetItemCount(v)
  1233. return _u
  1234. }
  1235. // SetNillableItemCount sets the "item_count" field if the given value is not nil.
  1236. func (_u *BatchImageJobUpdateOne) SetNillableItemCount(v *int) *BatchImageJobUpdateOne {
  1237. if v != nil {
  1238. _u.SetItemCount(*v)
  1239. }
  1240. return _u
  1241. }
  1242. // AddItemCount adds value to the "item_count" field.
  1243. func (_u *BatchImageJobUpdateOne) AddItemCount(v int) *BatchImageJobUpdateOne {
  1244. _u.mutation.AddItemCount(v)
  1245. return _u
  1246. }
  1247. // SetSuccessCount sets the "success_count" field.
  1248. func (_u *BatchImageJobUpdateOne) SetSuccessCount(v int) *BatchImageJobUpdateOne {
  1249. _u.mutation.ResetSuccessCount()
  1250. _u.mutation.SetSuccessCount(v)
  1251. return _u
  1252. }
  1253. // SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
  1254. func (_u *BatchImageJobUpdateOne) SetNillableSuccessCount(v *int) *BatchImageJobUpdateOne {
  1255. if v != nil {
  1256. _u.SetSuccessCount(*v)
  1257. }
  1258. return _u
  1259. }
  1260. // AddSuccessCount adds value to the "success_count" field.
  1261. func (_u *BatchImageJobUpdateOne) AddSuccessCount(v int) *BatchImageJobUpdateOne {
  1262. _u.mutation.AddSuccessCount(v)
  1263. return _u
  1264. }
  1265. // SetFailCount sets the "fail_count" field.
  1266. func (_u *BatchImageJobUpdateOne) SetFailCount(v int) *BatchImageJobUpdateOne {
  1267. _u.mutation.ResetFailCount()
  1268. _u.mutation.SetFailCount(v)
  1269. return _u
  1270. }
  1271. // SetNillableFailCount sets the "fail_count" field if the given value is not nil.
  1272. func (_u *BatchImageJobUpdateOne) SetNillableFailCount(v *int) *BatchImageJobUpdateOne {
  1273. if v != nil {
  1274. _u.SetFailCount(*v)
  1275. }
  1276. return _u
  1277. }
  1278. // AddFailCount adds value to the "fail_count" field.
  1279. func (_u *BatchImageJobUpdateOne) AddFailCount(v int) *BatchImageJobUpdateOne {
  1280. _u.mutation.AddFailCount(v)
  1281. return _u
  1282. }
  1283. // SetCancelledCount sets the "cancelled_count" field.
  1284. func (_u *BatchImageJobUpdateOne) SetCancelledCount(v int) *BatchImageJobUpdateOne {
  1285. _u.mutation.ResetCancelledCount()
  1286. _u.mutation.SetCancelledCount(v)
  1287. return _u
  1288. }
  1289. // SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
  1290. func (_u *BatchImageJobUpdateOne) SetNillableCancelledCount(v *int) *BatchImageJobUpdateOne {
  1291. if v != nil {
  1292. _u.SetCancelledCount(*v)
  1293. }
  1294. return _u
  1295. }
  1296. // AddCancelledCount adds value to the "cancelled_count" field.
  1297. func (_u *BatchImageJobUpdateOne) AddCancelledCount(v int) *BatchImageJobUpdateOne {
  1298. _u.mutation.AddCancelledCount(v)
  1299. return _u
  1300. }
  1301. // SetEstimatedCost sets the "estimated_cost" field.
  1302. func (_u *BatchImageJobUpdateOne) SetEstimatedCost(v float64) *BatchImageJobUpdateOne {
  1303. _u.mutation.ResetEstimatedCost()
  1304. _u.mutation.SetEstimatedCost(v)
  1305. return _u
  1306. }
  1307. // SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
  1308. func (_u *BatchImageJobUpdateOne) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdateOne {
  1309. if v != nil {
  1310. _u.SetEstimatedCost(*v)
  1311. }
  1312. return _u
  1313. }
  1314. // AddEstimatedCost adds value to the "estimated_cost" field.
  1315. func (_u *BatchImageJobUpdateOne) AddEstimatedCost(v float64) *BatchImageJobUpdateOne {
  1316. _u.mutation.AddEstimatedCost(v)
  1317. return _u
  1318. }
  1319. // SetHoldAmount sets the "hold_amount" field.
  1320. func (_u *BatchImageJobUpdateOne) SetHoldAmount(v float64) *BatchImageJobUpdateOne {
  1321. _u.mutation.ResetHoldAmount()
  1322. _u.mutation.SetHoldAmount(v)
  1323. return _u
  1324. }
  1325. // SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
  1326. func (_u *BatchImageJobUpdateOne) SetNillableHoldAmount(v *float64) *BatchImageJobUpdateOne {
  1327. if v != nil {
  1328. _u.SetHoldAmount(*v)
  1329. }
  1330. return _u
  1331. }
  1332. // AddHoldAmount adds value to the "hold_amount" field.
  1333. func (_u *BatchImageJobUpdateOne) AddHoldAmount(v float64) *BatchImageJobUpdateOne {
  1334. _u.mutation.AddHoldAmount(v)
  1335. return _u
  1336. }
  1337. // ClearHoldAmount clears the value of the "hold_amount" field.
  1338. func (_u *BatchImageJobUpdateOne) ClearHoldAmount() *BatchImageJobUpdateOne {
  1339. _u.mutation.ClearHoldAmount()
  1340. return _u
  1341. }
  1342. // SetActualCost sets the "actual_cost" field.
  1343. func (_u *BatchImageJobUpdateOne) SetActualCost(v float64) *BatchImageJobUpdateOne {
  1344. _u.mutation.ResetActualCost()
  1345. _u.mutation.SetActualCost(v)
  1346. return _u
  1347. }
  1348. // SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
  1349. func (_u *BatchImageJobUpdateOne) SetNillableActualCost(v *float64) *BatchImageJobUpdateOne {
  1350. if v != nil {
  1351. _u.SetActualCost(*v)
  1352. }
  1353. return _u
  1354. }
  1355. // AddActualCost adds value to the "actual_cost" field.
  1356. func (_u *BatchImageJobUpdateOne) AddActualCost(v float64) *BatchImageJobUpdateOne {
  1357. _u.mutation.AddActualCost(v)
  1358. return _u
  1359. }
  1360. // ClearActualCost clears the value of the "actual_cost" field.
  1361. func (_u *BatchImageJobUpdateOne) ClearActualCost() *BatchImageJobUpdateOne {
  1362. _u.mutation.ClearActualCost()
  1363. return _u
  1364. }
  1365. // SetCurrency sets the "currency" field.
  1366. func (_u *BatchImageJobUpdateOne) SetCurrency(v string) *BatchImageJobUpdateOne {
  1367. _u.mutation.SetCurrency(v)
  1368. return _u
  1369. }
  1370. // SetNillableCurrency sets the "currency" field if the given value is not nil.
  1371. func (_u *BatchImageJobUpdateOne) SetNillableCurrency(v *string) *BatchImageJobUpdateOne {
  1372. if v != nil {
  1373. _u.SetCurrency(*v)
  1374. }
  1375. return _u
  1376. }
  1377. // SetHoldID sets the "hold_id" field.
  1378. func (_u *BatchImageJobUpdateOne) SetHoldID(v string) *BatchImageJobUpdateOne {
  1379. _u.mutation.SetHoldID(v)
  1380. return _u
  1381. }
  1382. // SetNillableHoldID sets the "hold_id" field if the given value is not nil.
  1383. func (_u *BatchImageJobUpdateOne) SetNillableHoldID(v *string) *BatchImageJobUpdateOne {
  1384. if v != nil {
  1385. _u.SetHoldID(*v)
  1386. }
  1387. return _u
  1388. }
  1389. // ClearHoldID clears the value of the "hold_id" field.
  1390. func (_u *BatchImageJobUpdateOne) ClearHoldID() *BatchImageJobUpdateOne {
  1391. _u.mutation.ClearHoldID()
  1392. return _u
  1393. }
  1394. // SetIdempotencyKey sets the "idempotency_key" field.
  1395. func (_u *BatchImageJobUpdateOne) SetIdempotencyKey(v string) *BatchImageJobUpdateOne {
  1396. _u.mutation.SetIdempotencyKey(v)
  1397. return _u
  1398. }
  1399. // SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
  1400. func (_u *BatchImageJobUpdateOne) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdateOne {
  1401. if v != nil {
  1402. _u.SetIdempotencyKey(*v)
  1403. }
  1404. return _u
  1405. }
  1406. // ClearIdempotencyKey clears the value of the "idempotency_key" field.
  1407. func (_u *BatchImageJobUpdateOne) ClearIdempotencyKey() *BatchImageJobUpdateOne {
  1408. _u.mutation.ClearIdempotencyKey()
  1409. return _u
  1410. }
  1411. // SetRequestHash sets the "request_hash" field.
  1412. func (_u *BatchImageJobUpdateOne) SetRequestHash(v string) *BatchImageJobUpdateOne {
  1413. _u.mutation.SetRequestHash(v)
  1414. return _u
  1415. }
  1416. // SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
  1417. func (_u *BatchImageJobUpdateOne) SetNillableRequestHash(v *string) *BatchImageJobUpdateOne {
  1418. if v != nil {
  1419. _u.SetRequestHash(*v)
  1420. }
  1421. return _u
  1422. }
  1423. // ClearRequestHash clears the value of the "request_hash" field.
  1424. func (_u *BatchImageJobUpdateOne) ClearRequestHash() *BatchImageJobUpdateOne {
  1425. _u.mutation.ClearRequestHash()
  1426. return _u
  1427. }
  1428. // SetManifestHash sets the "manifest_hash" field.
  1429. func (_u *BatchImageJobUpdateOne) SetManifestHash(v string) *BatchImageJobUpdateOne {
  1430. _u.mutation.SetManifestHash(v)
  1431. return _u
  1432. }
  1433. // SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
  1434. func (_u *BatchImageJobUpdateOne) SetNillableManifestHash(v *string) *BatchImageJobUpdateOne {
  1435. if v != nil {
  1436. _u.SetManifestHash(*v)
  1437. }
  1438. return _u
  1439. }
  1440. // ClearManifestHash clears the value of the "manifest_hash" field.
  1441. func (_u *BatchImageJobUpdateOne) ClearManifestHash() *BatchImageJobUpdateOne {
  1442. _u.mutation.ClearManifestHash()
  1443. return _u
  1444. }
  1445. // SetRetryCount sets the "retry_count" field.
  1446. func (_u *BatchImageJobUpdateOne) SetRetryCount(v int) *BatchImageJobUpdateOne {
  1447. _u.mutation.ResetRetryCount()
  1448. _u.mutation.SetRetryCount(v)
  1449. return _u
  1450. }
  1451. // SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
  1452. func (_u *BatchImageJobUpdateOne) SetNillableRetryCount(v *int) *BatchImageJobUpdateOne {
  1453. if v != nil {
  1454. _u.SetRetryCount(*v)
  1455. }
  1456. return _u
  1457. }
  1458. // AddRetryCount adds value to the "retry_count" field.
  1459. func (_u *BatchImageJobUpdateOne) AddRetryCount(v int) *BatchImageJobUpdateOne {
  1460. _u.mutation.AddRetryCount(v)
  1461. return _u
  1462. }
  1463. // SetVersion sets the "version" field.
  1464. func (_u *BatchImageJobUpdateOne) SetVersion(v int) *BatchImageJobUpdateOne {
  1465. _u.mutation.ResetVersion()
  1466. _u.mutation.SetVersion(v)
  1467. return _u
  1468. }
  1469. // SetNillableVersion sets the "version" field if the given value is not nil.
  1470. func (_u *BatchImageJobUpdateOne) SetNillableVersion(v *int) *BatchImageJobUpdateOne {
  1471. if v != nil {
  1472. _u.SetVersion(*v)
  1473. }
  1474. return _u
  1475. }
  1476. // AddVersion adds value to the "version" field.
  1477. func (_u *BatchImageJobUpdateOne) AddVersion(v int) *BatchImageJobUpdateOne {
  1478. _u.mutation.AddVersion(v)
  1479. return _u
  1480. }
  1481. // SetOutputExpiresAt sets the "output_expires_at" field.
  1482. func (_u *BatchImageJobUpdateOne) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdateOne {
  1483. _u.mutation.SetOutputExpiresAt(v)
  1484. return _u
  1485. }
  1486. // SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
  1487. func (_u *BatchImageJobUpdateOne) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdateOne {
  1488. if v != nil {
  1489. _u.SetOutputExpiresAt(*v)
  1490. }
  1491. return _u
  1492. }
  1493. // ClearOutputExpiresAt clears the value of the "output_expires_at" field.
  1494. func (_u *BatchImageJobUpdateOne) ClearOutputExpiresAt() *BatchImageJobUpdateOne {
  1495. _u.mutation.ClearOutputExpiresAt()
  1496. return _u
  1497. }
  1498. // SetInputDeletedAt sets the "input_deleted_at" field.
  1499. func (_u *BatchImageJobUpdateOne) SetInputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
  1500. _u.mutation.SetInputDeletedAt(v)
  1501. return _u
  1502. }
  1503. // SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
  1504. func (_u *BatchImageJobUpdateOne) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
  1505. if v != nil {
  1506. _u.SetInputDeletedAt(*v)
  1507. }
  1508. return _u
  1509. }
  1510. // ClearInputDeletedAt clears the value of the "input_deleted_at" field.
  1511. func (_u *BatchImageJobUpdateOne) ClearInputDeletedAt() *BatchImageJobUpdateOne {
  1512. _u.mutation.ClearInputDeletedAt()
  1513. return _u
  1514. }
  1515. // SetOutputDeletedAt sets the "output_deleted_at" field.
  1516. func (_u *BatchImageJobUpdateOne) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
  1517. _u.mutation.SetOutputDeletedAt(v)
  1518. return _u
  1519. }
  1520. // SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
  1521. func (_u *BatchImageJobUpdateOne) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
  1522. if v != nil {
  1523. _u.SetOutputDeletedAt(*v)
  1524. }
  1525. return _u
  1526. }
  1527. // ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
  1528. func (_u *BatchImageJobUpdateOne) ClearOutputDeletedAt() *BatchImageJobUpdateOne {
  1529. _u.mutation.ClearOutputDeletedAt()
  1530. return _u
  1531. }
  1532. // SetDownloadedAt sets the "downloaded_at" field.
  1533. func (_u *BatchImageJobUpdateOne) SetDownloadedAt(v time.Time) *BatchImageJobUpdateOne {
  1534. _u.mutation.SetDownloadedAt(v)
  1535. return _u
  1536. }
  1537. // SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
  1538. func (_u *BatchImageJobUpdateOne) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdateOne {
  1539. if v != nil {
  1540. _u.SetDownloadedAt(*v)
  1541. }
  1542. return _u
  1543. }
  1544. // ClearDownloadedAt clears the value of the "downloaded_at" field.
  1545. func (_u *BatchImageJobUpdateOne) ClearDownloadedAt() *BatchImageJobUpdateOne {
  1546. _u.mutation.ClearDownloadedAt()
  1547. return _u
  1548. }
  1549. // SetUserDeletedAt sets the "user_deleted_at" field.
  1550. func (_u *BatchImageJobUpdateOne) SetUserDeletedAt(v time.Time) *BatchImageJobUpdateOne {
  1551. _u.mutation.SetUserDeletedAt(v)
  1552. return _u
  1553. }
  1554. // SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
  1555. func (_u *BatchImageJobUpdateOne) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
  1556. if v != nil {
  1557. _u.SetUserDeletedAt(*v)
  1558. }
  1559. return _u
  1560. }
  1561. // ClearUserDeletedAt clears the value of the "user_deleted_at" field.
  1562. func (_u *BatchImageJobUpdateOne) ClearUserDeletedAt() *BatchImageJobUpdateOne {
  1563. _u.mutation.ClearUserDeletedAt()
  1564. return _u
  1565. }
  1566. // SetLastErrorCode sets the "last_error_code" field.
  1567. func (_u *BatchImageJobUpdateOne) SetLastErrorCode(v string) *BatchImageJobUpdateOne {
  1568. _u.mutation.SetLastErrorCode(v)
  1569. return _u
  1570. }
  1571. // SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
  1572. func (_u *BatchImageJobUpdateOne) SetNillableLastErrorCode(v *string) *BatchImageJobUpdateOne {
  1573. if v != nil {
  1574. _u.SetLastErrorCode(*v)
  1575. }
  1576. return _u
  1577. }
  1578. // ClearLastErrorCode clears the value of the "last_error_code" field.
  1579. func (_u *BatchImageJobUpdateOne) ClearLastErrorCode() *BatchImageJobUpdateOne {
  1580. _u.mutation.ClearLastErrorCode()
  1581. return _u
  1582. }
  1583. // SetLastErrorMessage sets the "last_error_message" field.
  1584. func (_u *BatchImageJobUpdateOne) SetLastErrorMessage(v string) *BatchImageJobUpdateOne {
  1585. _u.mutation.SetLastErrorMessage(v)
  1586. return _u
  1587. }
  1588. // SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
  1589. func (_u *BatchImageJobUpdateOne) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdateOne {
  1590. if v != nil {
  1591. _u.SetLastErrorMessage(*v)
  1592. }
  1593. return _u
  1594. }
  1595. // ClearLastErrorMessage clears the value of the "last_error_message" field.
  1596. func (_u *BatchImageJobUpdateOne) ClearLastErrorMessage() *BatchImageJobUpdateOne {
  1597. _u.mutation.ClearLastErrorMessage()
  1598. return _u
  1599. }
  1600. // SetUpdatedAt sets the "updated_at" field.
  1601. func (_u *BatchImageJobUpdateOne) SetUpdatedAt(v time.Time) *BatchImageJobUpdateOne {
  1602. _u.mutation.SetUpdatedAt(v)
  1603. return _u
  1604. }
  1605. // SetSubmittedAt sets the "submitted_at" field.
  1606. func (_u *BatchImageJobUpdateOne) SetSubmittedAt(v time.Time) *BatchImageJobUpdateOne {
  1607. _u.mutation.SetSubmittedAt(v)
  1608. return _u
  1609. }
  1610. // SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
  1611. func (_u *BatchImageJobUpdateOne) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdateOne {
  1612. if v != nil {
  1613. _u.SetSubmittedAt(*v)
  1614. }
  1615. return _u
  1616. }
  1617. // ClearSubmittedAt clears the value of the "submitted_at" field.
  1618. func (_u *BatchImageJobUpdateOne) ClearSubmittedAt() *BatchImageJobUpdateOne {
  1619. _u.mutation.ClearSubmittedAt()
  1620. return _u
  1621. }
  1622. // SetStartedAt sets the "started_at" field.
  1623. func (_u *BatchImageJobUpdateOne) SetStartedAt(v time.Time) *BatchImageJobUpdateOne {
  1624. _u.mutation.SetStartedAt(v)
  1625. return _u
  1626. }
  1627. // SetNillableStartedAt sets the "started_at" field if the given value is not nil.
  1628. func (_u *BatchImageJobUpdateOne) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdateOne {
  1629. if v != nil {
  1630. _u.SetStartedAt(*v)
  1631. }
  1632. return _u
  1633. }
  1634. // ClearStartedAt clears the value of the "started_at" field.
  1635. func (_u *BatchImageJobUpdateOne) ClearStartedAt() *BatchImageJobUpdateOne {
  1636. _u.mutation.ClearStartedAt()
  1637. return _u
  1638. }
  1639. // SetFinishedAt sets the "finished_at" field.
  1640. func (_u *BatchImageJobUpdateOne) SetFinishedAt(v time.Time) *BatchImageJobUpdateOne {
  1641. _u.mutation.SetFinishedAt(v)
  1642. return _u
  1643. }
  1644. // SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
  1645. func (_u *BatchImageJobUpdateOne) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdateOne {
  1646. if v != nil {
  1647. _u.SetFinishedAt(*v)
  1648. }
  1649. return _u
  1650. }
  1651. // ClearFinishedAt clears the value of the "finished_at" field.
  1652. func (_u *BatchImageJobUpdateOne) ClearFinishedAt() *BatchImageJobUpdateOne {
  1653. _u.mutation.ClearFinishedAt()
  1654. return _u
  1655. }
  1656. // SetSettledAt sets the "settled_at" field.
  1657. func (_u *BatchImageJobUpdateOne) SetSettledAt(v time.Time) *BatchImageJobUpdateOne {
  1658. _u.mutation.SetSettledAt(v)
  1659. return _u
  1660. }
  1661. // SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
  1662. func (_u *BatchImageJobUpdateOne) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdateOne {
  1663. if v != nil {
  1664. _u.SetSettledAt(*v)
  1665. }
  1666. return _u
  1667. }
  1668. // ClearSettledAt clears the value of the "settled_at" field.
  1669. func (_u *BatchImageJobUpdateOne) ClearSettledAt() *BatchImageJobUpdateOne {
  1670. _u.mutation.ClearSettledAt()
  1671. return _u
  1672. }
  1673. // Mutation returns the BatchImageJobMutation object of the builder.
  1674. func (_u *BatchImageJobUpdateOne) Mutation() *BatchImageJobMutation {
  1675. return _u.mutation
  1676. }
  1677. // Where appends a list predicates to the BatchImageJobUpdate builder.
  1678. func (_u *BatchImageJobUpdateOne) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdateOne {
  1679. _u.mutation.Where(ps...)
  1680. return _u
  1681. }
  1682. // Select allows selecting one or more fields (columns) of the returned entity.
  1683. // The default is selecting all fields defined in the entity schema.
  1684. func (_u *BatchImageJobUpdateOne) Select(field string, fields ...string) *BatchImageJobUpdateOne {
  1685. _u.fields = append([]string{field}, fields...)
  1686. return _u
  1687. }
  1688. // Save executes the query and returns the updated BatchImageJob entity.
  1689. func (_u *BatchImageJobUpdateOne) Save(ctx context.Context) (*BatchImageJob, error) {
  1690. _u.defaults()
  1691. return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
  1692. }
  1693. // SaveX is like Save, but panics if an error occurs.
  1694. func (_u *BatchImageJobUpdateOne) SaveX(ctx context.Context) *BatchImageJob {
  1695. node, err := _u.Save(ctx)
  1696. if err != nil {
  1697. panic(err)
  1698. }
  1699. return node
  1700. }
  1701. // Exec executes the query on the entity.
  1702. func (_u *BatchImageJobUpdateOne) Exec(ctx context.Context) error {
  1703. _, err := _u.Save(ctx)
  1704. return err
  1705. }
  1706. // ExecX is like Exec, but panics if an error occurs.
  1707. func (_u *BatchImageJobUpdateOne) ExecX(ctx context.Context) {
  1708. if err := _u.Exec(ctx); err != nil {
  1709. panic(err)
  1710. }
  1711. }
  1712. // defaults sets the default values of the builder before save.
  1713. func (_u *BatchImageJobUpdateOne) defaults() {
  1714. if _, ok := _u.mutation.UpdatedAt(); !ok {
  1715. v := batchimagejob.UpdateDefaultUpdatedAt()
  1716. _u.mutation.SetUpdatedAt(v)
  1717. }
  1718. }
  1719. // check runs all checks and user-defined validators on the builder.
  1720. func (_u *BatchImageJobUpdateOne) check() error {
  1721. if v, ok := _u.mutation.Provider(); ok {
  1722. if err := batchimagejob.ProviderValidator(v); err != nil {
  1723. return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
  1724. }
  1725. }
  1726. if v, ok := _u.mutation.Model(); ok {
  1727. if err := batchimagejob.ModelValidator(v); err != nil {
  1728. return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
  1729. }
  1730. }
  1731. if v, ok := _u.mutation.TaskName(); ok {
  1732. if err := batchimagejob.TaskNameValidator(v); err != nil {
  1733. return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
  1734. }
  1735. }
  1736. if v, ok := _u.mutation.Status(); ok {
  1737. if err := batchimagejob.StatusValidator(v); err != nil {
  1738. return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
  1739. }
  1740. }
  1741. if v, ok := _u.mutation.ProviderJobName(); ok {
  1742. if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
  1743. return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
  1744. }
  1745. }
  1746. if v, ok := _u.mutation.ProviderInputRef(); ok {
  1747. if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
  1748. return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
  1749. }
  1750. }
  1751. if v, ok := _u.mutation.ProviderOutputRef(); ok {
  1752. if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
  1753. return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
  1754. }
  1755. }
  1756. if v, ok := _u.mutation.GcsInputURI(); ok {
  1757. if err := batchimagejob.GcsInputURIValidator(v); err != nil {
  1758. return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
  1759. }
  1760. }
  1761. if v, ok := _u.mutation.GcsOutputURI(); ok {
  1762. if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
  1763. return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
  1764. }
  1765. }
  1766. if v, ok := _u.mutation.Currency(); ok {
  1767. if err := batchimagejob.CurrencyValidator(v); err != nil {
  1768. return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
  1769. }
  1770. }
  1771. if v, ok := _u.mutation.HoldID(); ok {
  1772. if err := batchimagejob.HoldIDValidator(v); err != nil {
  1773. return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
  1774. }
  1775. }
  1776. if v, ok := _u.mutation.IdempotencyKey(); ok {
  1777. if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
  1778. return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
  1779. }
  1780. }
  1781. if v, ok := _u.mutation.RequestHash(); ok {
  1782. if err := batchimagejob.RequestHashValidator(v); err != nil {
  1783. return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
  1784. }
  1785. }
  1786. if v, ok := _u.mutation.ManifestHash(); ok {
  1787. if err := batchimagejob.ManifestHashValidator(v); err != nil {
  1788. return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
  1789. }
  1790. }
  1791. if v, ok := _u.mutation.LastErrorCode(); ok {
  1792. if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
  1793. return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
  1794. }
  1795. }
  1796. return nil
  1797. }
  1798. func (_u *BatchImageJobUpdateOne) sqlSave(ctx context.Context) (_node *BatchImageJob, err error) {
  1799. if err := _u.check(); err != nil {
  1800. return _node, err
  1801. }
  1802. _spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
  1803. id, ok := _u.mutation.ID()
  1804. if !ok {
  1805. return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BatchImageJob.id" for update`)}
  1806. }
  1807. _spec.Node.ID.Value = id
  1808. if fields := _u.fields; len(fields) > 0 {
  1809. _spec.Node.Columns = make([]string, 0, len(fields))
  1810. _spec.Node.Columns = append(_spec.Node.Columns, batchimagejob.FieldID)
  1811. for _, f := range fields {
  1812. if !batchimagejob.ValidColumn(f) {
  1813. return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
  1814. }
  1815. if f != batchimagejob.FieldID {
  1816. _spec.Node.Columns = append(_spec.Node.Columns, f)
  1817. }
  1818. }
  1819. }
  1820. if ps := _u.mutation.predicates; len(ps) > 0 {
  1821. _spec.Predicate = func(selector *sql.Selector) {
  1822. for i := range ps {
  1823. ps[i](selector)
  1824. }
  1825. }
  1826. }
  1827. if value, ok := _u.mutation.UserID(); ok {
  1828. _spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
  1829. }
  1830. if value, ok := _u.mutation.AddedUserID(); ok {
  1831. _spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
  1832. }
  1833. if value, ok := _u.mutation.APIKeyID(); ok {
  1834. _spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
  1835. }
  1836. if value, ok := _u.mutation.AddedAPIKeyID(); ok {
  1837. _spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
  1838. }
  1839. if _u.mutation.APIKeyIDCleared() {
  1840. _spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
  1841. }
  1842. if value, ok := _u.mutation.AccountID(); ok {
  1843. _spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
  1844. }
  1845. if value, ok := _u.mutation.AddedAccountID(); ok {
  1846. _spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
  1847. }
  1848. if _u.mutation.AccountIDCleared() {
  1849. _spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
  1850. }
  1851. if value, ok := _u.mutation.Provider(); ok {
  1852. _spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
  1853. }
  1854. if value, ok := _u.mutation.Model(); ok {
  1855. _spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
  1856. }
  1857. if value, ok := _u.mutation.TaskName(); ok {
  1858. _spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
  1859. }
  1860. if value, ok := _u.mutation.Status(); ok {
  1861. _spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
  1862. }
  1863. if value, ok := _u.mutation.ProviderJobName(); ok {
  1864. _spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
  1865. }
  1866. if _u.mutation.ProviderJobNameCleared() {
  1867. _spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
  1868. }
  1869. if value, ok := _u.mutation.ProviderInputRef(); ok {
  1870. _spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
  1871. }
  1872. if _u.mutation.ProviderInputRefCleared() {
  1873. _spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
  1874. }
  1875. if value, ok := _u.mutation.ProviderOutputRef(); ok {
  1876. _spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
  1877. }
  1878. if _u.mutation.ProviderOutputRefCleared() {
  1879. _spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
  1880. }
  1881. if value, ok := _u.mutation.GcsInputURI(); ok {
  1882. _spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
  1883. }
  1884. if _u.mutation.GcsInputURICleared() {
  1885. _spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
  1886. }
  1887. if value, ok := _u.mutation.GcsOutputURI(); ok {
  1888. _spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
  1889. }
  1890. if _u.mutation.GcsOutputURICleared() {
  1891. _spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
  1892. }
  1893. if value, ok := _u.mutation.ItemCount(); ok {
  1894. _spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
  1895. }
  1896. if value, ok := _u.mutation.AddedItemCount(); ok {
  1897. _spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
  1898. }
  1899. if value, ok := _u.mutation.SuccessCount(); ok {
  1900. _spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
  1901. }
  1902. if value, ok := _u.mutation.AddedSuccessCount(); ok {
  1903. _spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
  1904. }
  1905. if value, ok := _u.mutation.FailCount(); ok {
  1906. _spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
  1907. }
  1908. if value, ok := _u.mutation.AddedFailCount(); ok {
  1909. _spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
  1910. }
  1911. if value, ok := _u.mutation.CancelledCount(); ok {
  1912. _spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
  1913. }
  1914. if value, ok := _u.mutation.AddedCancelledCount(); ok {
  1915. _spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
  1916. }
  1917. if value, ok := _u.mutation.EstimatedCost(); ok {
  1918. _spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
  1919. }
  1920. if value, ok := _u.mutation.AddedEstimatedCost(); ok {
  1921. _spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
  1922. }
  1923. if value, ok := _u.mutation.HoldAmount(); ok {
  1924. _spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
  1925. }
  1926. if value, ok := _u.mutation.AddedHoldAmount(); ok {
  1927. _spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
  1928. }
  1929. if _u.mutation.HoldAmountCleared() {
  1930. _spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
  1931. }
  1932. if value, ok := _u.mutation.ActualCost(); ok {
  1933. _spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
  1934. }
  1935. if value, ok := _u.mutation.AddedActualCost(); ok {
  1936. _spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
  1937. }
  1938. if _u.mutation.ActualCostCleared() {
  1939. _spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
  1940. }
  1941. if value, ok := _u.mutation.Currency(); ok {
  1942. _spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
  1943. }
  1944. if value, ok := _u.mutation.HoldID(); ok {
  1945. _spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
  1946. }
  1947. if _u.mutation.HoldIDCleared() {
  1948. _spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
  1949. }
  1950. if value, ok := _u.mutation.IdempotencyKey(); ok {
  1951. _spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
  1952. }
  1953. if _u.mutation.IdempotencyKeyCleared() {
  1954. _spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
  1955. }
  1956. if value, ok := _u.mutation.RequestHash(); ok {
  1957. _spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
  1958. }
  1959. if _u.mutation.RequestHashCleared() {
  1960. _spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
  1961. }
  1962. if value, ok := _u.mutation.ManifestHash(); ok {
  1963. _spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
  1964. }
  1965. if _u.mutation.ManifestHashCleared() {
  1966. _spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
  1967. }
  1968. if value, ok := _u.mutation.RetryCount(); ok {
  1969. _spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
  1970. }
  1971. if value, ok := _u.mutation.AddedRetryCount(); ok {
  1972. _spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
  1973. }
  1974. if value, ok := _u.mutation.Version(); ok {
  1975. _spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
  1976. }
  1977. if value, ok := _u.mutation.AddedVersion(); ok {
  1978. _spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
  1979. }
  1980. if value, ok := _u.mutation.OutputExpiresAt(); ok {
  1981. _spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
  1982. }
  1983. if _u.mutation.OutputExpiresAtCleared() {
  1984. _spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
  1985. }
  1986. if value, ok := _u.mutation.InputDeletedAt(); ok {
  1987. _spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
  1988. }
  1989. if _u.mutation.InputDeletedAtCleared() {
  1990. _spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
  1991. }
  1992. if value, ok := _u.mutation.OutputDeletedAt(); ok {
  1993. _spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
  1994. }
  1995. if _u.mutation.OutputDeletedAtCleared() {
  1996. _spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
  1997. }
  1998. if value, ok := _u.mutation.DownloadedAt(); ok {
  1999. _spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
  2000. }
  2001. if _u.mutation.DownloadedAtCleared() {
  2002. _spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
  2003. }
  2004. if value, ok := _u.mutation.UserDeletedAt(); ok {
  2005. _spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
  2006. }
  2007. if _u.mutation.UserDeletedAtCleared() {
  2008. _spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
  2009. }
  2010. if value, ok := _u.mutation.LastErrorCode(); ok {
  2011. _spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
  2012. }
  2013. if _u.mutation.LastErrorCodeCleared() {
  2014. _spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
  2015. }
  2016. if value, ok := _u.mutation.LastErrorMessage(); ok {
  2017. _spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
  2018. }
  2019. if _u.mutation.LastErrorMessageCleared() {
  2020. _spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
  2021. }
  2022. if value, ok := _u.mutation.UpdatedAt(); ok {
  2023. _spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
  2024. }
  2025. if value, ok := _u.mutation.SubmittedAt(); ok {
  2026. _spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
  2027. }
  2028. if _u.mutation.SubmittedAtCleared() {
  2029. _spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
  2030. }
  2031. if value, ok := _u.mutation.StartedAt(); ok {
  2032. _spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
  2033. }
  2034. if _u.mutation.StartedAtCleared() {
  2035. _spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
  2036. }
  2037. if value, ok := _u.mutation.FinishedAt(); ok {
  2038. _spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
  2039. }
  2040. if _u.mutation.FinishedAtCleared() {
  2041. _spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
  2042. }
  2043. if value, ok := _u.mutation.SettledAt(); ok {
  2044. _spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
  2045. }
  2046. if _u.mutation.SettledAtCleared() {
  2047. _spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
  2048. }
  2049. _node = &BatchImageJob{config: _u.config}
  2050. _spec.Assign = _node.assignValues
  2051. _spec.ScanValues = _node.scanValues
  2052. if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
  2053. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  2054. err = &NotFoundError{batchimagejob.Label}
  2055. } else if sqlgraph.IsConstraintError(err) {
  2056. err = &ConstraintError{msg: err.Error(), wrap: err}
  2057. }
  2058. return nil, err
  2059. }
  2060. _u.mutation.done = true
  2061. return _node, nil
  2062. }