channelmonitordailyrollup_update.go 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  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/channelmonitor"
  12. "github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
  13. "github.com/Wei-Shaw/sub2api/ent/predicate"
  14. )
  15. // ChannelMonitorDailyRollupUpdate is the builder for updating ChannelMonitorDailyRollup entities.
  16. type ChannelMonitorDailyRollupUpdate struct {
  17. config
  18. hooks []Hook
  19. mutation *ChannelMonitorDailyRollupMutation
  20. }
  21. // Where appends a list predicates to the ChannelMonitorDailyRollupUpdate builder.
  22. func (_u *ChannelMonitorDailyRollupUpdate) Where(ps ...predicate.ChannelMonitorDailyRollup) *ChannelMonitorDailyRollupUpdate {
  23. _u.mutation.Where(ps...)
  24. return _u
  25. }
  26. // SetMonitorID sets the "monitor_id" field.
  27. func (_u *ChannelMonitorDailyRollupUpdate) SetMonitorID(v int64) *ChannelMonitorDailyRollupUpdate {
  28. _u.mutation.SetMonitorID(v)
  29. return _u
  30. }
  31. // SetNillableMonitorID sets the "monitor_id" field if the given value is not nil.
  32. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableMonitorID(v *int64) *ChannelMonitorDailyRollupUpdate {
  33. if v != nil {
  34. _u.SetMonitorID(*v)
  35. }
  36. return _u
  37. }
  38. // SetModel sets the "model" field.
  39. func (_u *ChannelMonitorDailyRollupUpdate) SetModel(v string) *ChannelMonitorDailyRollupUpdate {
  40. _u.mutation.SetModel(v)
  41. return _u
  42. }
  43. // SetNillableModel sets the "model" field if the given value is not nil.
  44. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableModel(v *string) *ChannelMonitorDailyRollupUpdate {
  45. if v != nil {
  46. _u.SetModel(*v)
  47. }
  48. return _u
  49. }
  50. // SetBucketDate sets the "bucket_date" field.
  51. func (_u *ChannelMonitorDailyRollupUpdate) SetBucketDate(v time.Time) *ChannelMonitorDailyRollupUpdate {
  52. _u.mutation.SetBucketDate(v)
  53. return _u
  54. }
  55. // SetNillableBucketDate sets the "bucket_date" field if the given value is not nil.
  56. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableBucketDate(v *time.Time) *ChannelMonitorDailyRollupUpdate {
  57. if v != nil {
  58. _u.SetBucketDate(*v)
  59. }
  60. return _u
  61. }
  62. // SetTotalChecks sets the "total_checks" field.
  63. func (_u *ChannelMonitorDailyRollupUpdate) SetTotalChecks(v int) *ChannelMonitorDailyRollupUpdate {
  64. _u.mutation.ResetTotalChecks()
  65. _u.mutation.SetTotalChecks(v)
  66. return _u
  67. }
  68. // SetNillableTotalChecks sets the "total_checks" field if the given value is not nil.
  69. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableTotalChecks(v *int) *ChannelMonitorDailyRollupUpdate {
  70. if v != nil {
  71. _u.SetTotalChecks(*v)
  72. }
  73. return _u
  74. }
  75. // AddTotalChecks adds value to the "total_checks" field.
  76. func (_u *ChannelMonitorDailyRollupUpdate) AddTotalChecks(v int) *ChannelMonitorDailyRollupUpdate {
  77. _u.mutation.AddTotalChecks(v)
  78. return _u
  79. }
  80. // SetOkCount sets the "ok_count" field.
  81. func (_u *ChannelMonitorDailyRollupUpdate) SetOkCount(v int) *ChannelMonitorDailyRollupUpdate {
  82. _u.mutation.ResetOkCount()
  83. _u.mutation.SetOkCount(v)
  84. return _u
  85. }
  86. // SetNillableOkCount sets the "ok_count" field if the given value is not nil.
  87. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableOkCount(v *int) *ChannelMonitorDailyRollupUpdate {
  88. if v != nil {
  89. _u.SetOkCount(*v)
  90. }
  91. return _u
  92. }
  93. // AddOkCount adds value to the "ok_count" field.
  94. func (_u *ChannelMonitorDailyRollupUpdate) AddOkCount(v int) *ChannelMonitorDailyRollupUpdate {
  95. _u.mutation.AddOkCount(v)
  96. return _u
  97. }
  98. // SetOperationalCount sets the "operational_count" field.
  99. func (_u *ChannelMonitorDailyRollupUpdate) SetOperationalCount(v int) *ChannelMonitorDailyRollupUpdate {
  100. _u.mutation.ResetOperationalCount()
  101. _u.mutation.SetOperationalCount(v)
  102. return _u
  103. }
  104. // SetNillableOperationalCount sets the "operational_count" field if the given value is not nil.
  105. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableOperationalCount(v *int) *ChannelMonitorDailyRollupUpdate {
  106. if v != nil {
  107. _u.SetOperationalCount(*v)
  108. }
  109. return _u
  110. }
  111. // AddOperationalCount adds value to the "operational_count" field.
  112. func (_u *ChannelMonitorDailyRollupUpdate) AddOperationalCount(v int) *ChannelMonitorDailyRollupUpdate {
  113. _u.mutation.AddOperationalCount(v)
  114. return _u
  115. }
  116. // SetDegradedCount sets the "degraded_count" field.
  117. func (_u *ChannelMonitorDailyRollupUpdate) SetDegradedCount(v int) *ChannelMonitorDailyRollupUpdate {
  118. _u.mutation.ResetDegradedCount()
  119. _u.mutation.SetDegradedCount(v)
  120. return _u
  121. }
  122. // SetNillableDegradedCount sets the "degraded_count" field if the given value is not nil.
  123. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableDegradedCount(v *int) *ChannelMonitorDailyRollupUpdate {
  124. if v != nil {
  125. _u.SetDegradedCount(*v)
  126. }
  127. return _u
  128. }
  129. // AddDegradedCount adds value to the "degraded_count" field.
  130. func (_u *ChannelMonitorDailyRollupUpdate) AddDegradedCount(v int) *ChannelMonitorDailyRollupUpdate {
  131. _u.mutation.AddDegradedCount(v)
  132. return _u
  133. }
  134. // SetFailedCount sets the "failed_count" field.
  135. func (_u *ChannelMonitorDailyRollupUpdate) SetFailedCount(v int) *ChannelMonitorDailyRollupUpdate {
  136. _u.mutation.ResetFailedCount()
  137. _u.mutation.SetFailedCount(v)
  138. return _u
  139. }
  140. // SetNillableFailedCount sets the "failed_count" field if the given value is not nil.
  141. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableFailedCount(v *int) *ChannelMonitorDailyRollupUpdate {
  142. if v != nil {
  143. _u.SetFailedCount(*v)
  144. }
  145. return _u
  146. }
  147. // AddFailedCount adds value to the "failed_count" field.
  148. func (_u *ChannelMonitorDailyRollupUpdate) AddFailedCount(v int) *ChannelMonitorDailyRollupUpdate {
  149. _u.mutation.AddFailedCount(v)
  150. return _u
  151. }
  152. // SetErrorCount sets the "error_count" field.
  153. func (_u *ChannelMonitorDailyRollupUpdate) SetErrorCount(v int) *ChannelMonitorDailyRollupUpdate {
  154. _u.mutation.ResetErrorCount()
  155. _u.mutation.SetErrorCount(v)
  156. return _u
  157. }
  158. // SetNillableErrorCount sets the "error_count" field if the given value is not nil.
  159. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableErrorCount(v *int) *ChannelMonitorDailyRollupUpdate {
  160. if v != nil {
  161. _u.SetErrorCount(*v)
  162. }
  163. return _u
  164. }
  165. // AddErrorCount adds value to the "error_count" field.
  166. func (_u *ChannelMonitorDailyRollupUpdate) AddErrorCount(v int) *ChannelMonitorDailyRollupUpdate {
  167. _u.mutation.AddErrorCount(v)
  168. return _u
  169. }
  170. // SetSumLatencyMs sets the "sum_latency_ms" field.
  171. func (_u *ChannelMonitorDailyRollupUpdate) SetSumLatencyMs(v int64) *ChannelMonitorDailyRollupUpdate {
  172. _u.mutation.ResetSumLatencyMs()
  173. _u.mutation.SetSumLatencyMs(v)
  174. return _u
  175. }
  176. // SetNillableSumLatencyMs sets the "sum_latency_ms" field if the given value is not nil.
  177. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableSumLatencyMs(v *int64) *ChannelMonitorDailyRollupUpdate {
  178. if v != nil {
  179. _u.SetSumLatencyMs(*v)
  180. }
  181. return _u
  182. }
  183. // AddSumLatencyMs adds value to the "sum_latency_ms" field.
  184. func (_u *ChannelMonitorDailyRollupUpdate) AddSumLatencyMs(v int64) *ChannelMonitorDailyRollupUpdate {
  185. _u.mutation.AddSumLatencyMs(v)
  186. return _u
  187. }
  188. // SetCountLatency sets the "count_latency" field.
  189. func (_u *ChannelMonitorDailyRollupUpdate) SetCountLatency(v int) *ChannelMonitorDailyRollupUpdate {
  190. _u.mutation.ResetCountLatency()
  191. _u.mutation.SetCountLatency(v)
  192. return _u
  193. }
  194. // SetNillableCountLatency sets the "count_latency" field if the given value is not nil.
  195. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableCountLatency(v *int) *ChannelMonitorDailyRollupUpdate {
  196. if v != nil {
  197. _u.SetCountLatency(*v)
  198. }
  199. return _u
  200. }
  201. // AddCountLatency adds value to the "count_latency" field.
  202. func (_u *ChannelMonitorDailyRollupUpdate) AddCountLatency(v int) *ChannelMonitorDailyRollupUpdate {
  203. _u.mutation.AddCountLatency(v)
  204. return _u
  205. }
  206. // SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
  207. func (_u *ChannelMonitorDailyRollupUpdate) SetSumPingLatencyMs(v int64) *ChannelMonitorDailyRollupUpdate {
  208. _u.mutation.ResetSumPingLatencyMs()
  209. _u.mutation.SetSumPingLatencyMs(v)
  210. return _u
  211. }
  212. // SetNillableSumPingLatencyMs sets the "sum_ping_latency_ms" field if the given value is not nil.
  213. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableSumPingLatencyMs(v *int64) *ChannelMonitorDailyRollupUpdate {
  214. if v != nil {
  215. _u.SetSumPingLatencyMs(*v)
  216. }
  217. return _u
  218. }
  219. // AddSumPingLatencyMs adds value to the "sum_ping_latency_ms" field.
  220. func (_u *ChannelMonitorDailyRollupUpdate) AddSumPingLatencyMs(v int64) *ChannelMonitorDailyRollupUpdate {
  221. _u.mutation.AddSumPingLatencyMs(v)
  222. return _u
  223. }
  224. // SetCountPingLatency sets the "count_ping_latency" field.
  225. func (_u *ChannelMonitorDailyRollupUpdate) SetCountPingLatency(v int) *ChannelMonitorDailyRollupUpdate {
  226. _u.mutation.ResetCountPingLatency()
  227. _u.mutation.SetCountPingLatency(v)
  228. return _u
  229. }
  230. // SetNillableCountPingLatency sets the "count_ping_latency" field if the given value is not nil.
  231. func (_u *ChannelMonitorDailyRollupUpdate) SetNillableCountPingLatency(v *int) *ChannelMonitorDailyRollupUpdate {
  232. if v != nil {
  233. _u.SetCountPingLatency(*v)
  234. }
  235. return _u
  236. }
  237. // AddCountPingLatency adds value to the "count_ping_latency" field.
  238. func (_u *ChannelMonitorDailyRollupUpdate) AddCountPingLatency(v int) *ChannelMonitorDailyRollupUpdate {
  239. _u.mutation.AddCountPingLatency(v)
  240. return _u
  241. }
  242. // SetComputedAt sets the "computed_at" field.
  243. func (_u *ChannelMonitorDailyRollupUpdate) SetComputedAt(v time.Time) *ChannelMonitorDailyRollupUpdate {
  244. _u.mutation.SetComputedAt(v)
  245. return _u
  246. }
  247. // SetMonitor sets the "monitor" edge to the ChannelMonitor entity.
  248. func (_u *ChannelMonitorDailyRollupUpdate) SetMonitor(v *ChannelMonitor) *ChannelMonitorDailyRollupUpdate {
  249. return _u.SetMonitorID(v.ID)
  250. }
  251. // Mutation returns the ChannelMonitorDailyRollupMutation object of the builder.
  252. func (_u *ChannelMonitorDailyRollupUpdate) Mutation() *ChannelMonitorDailyRollupMutation {
  253. return _u.mutation
  254. }
  255. // ClearMonitor clears the "monitor" edge to the ChannelMonitor entity.
  256. func (_u *ChannelMonitorDailyRollupUpdate) ClearMonitor() *ChannelMonitorDailyRollupUpdate {
  257. _u.mutation.ClearMonitor()
  258. return _u
  259. }
  260. // Save executes the query and returns the number of nodes affected by the update operation.
  261. func (_u *ChannelMonitorDailyRollupUpdate) Save(ctx context.Context) (int, error) {
  262. _u.defaults()
  263. return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
  264. }
  265. // SaveX is like Save, but panics if an error occurs.
  266. func (_u *ChannelMonitorDailyRollupUpdate) SaveX(ctx context.Context) int {
  267. affected, err := _u.Save(ctx)
  268. if err != nil {
  269. panic(err)
  270. }
  271. return affected
  272. }
  273. // Exec executes the query.
  274. func (_u *ChannelMonitorDailyRollupUpdate) Exec(ctx context.Context) error {
  275. _, err := _u.Save(ctx)
  276. return err
  277. }
  278. // ExecX is like Exec, but panics if an error occurs.
  279. func (_u *ChannelMonitorDailyRollupUpdate) ExecX(ctx context.Context) {
  280. if err := _u.Exec(ctx); err != nil {
  281. panic(err)
  282. }
  283. }
  284. // defaults sets the default values of the builder before save.
  285. func (_u *ChannelMonitorDailyRollupUpdate) defaults() {
  286. if _, ok := _u.mutation.ComputedAt(); !ok {
  287. v := channelmonitordailyrollup.UpdateDefaultComputedAt()
  288. _u.mutation.SetComputedAt(v)
  289. }
  290. }
  291. // check runs all checks and user-defined validators on the builder.
  292. func (_u *ChannelMonitorDailyRollupUpdate) check() error {
  293. if v, ok := _u.mutation.Model(); ok {
  294. if err := channelmonitordailyrollup.ModelValidator(v); err != nil {
  295. return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "ChannelMonitorDailyRollup.model": %w`, err)}
  296. }
  297. }
  298. if _u.mutation.MonitorCleared() && len(_u.mutation.MonitorIDs()) > 0 {
  299. return errors.New(`ent: clearing a required unique edge "ChannelMonitorDailyRollup.monitor"`)
  300. }
  301. return nil
  302. }
  303. func (_u *ChannelMonitorDailyRollupUpdate) sqlSave(ctx context.Context) (_node int, err error) {
  304. if err := _u.check(); err != nil {
  305. return _node, err
  306. }
  307. _spec := sqlgraph.NewUpdateSpec(channelmonitordailyrollup.Table, channelmonitordailyrollup.Columns, sqlgraph.NewFieldSpec(channelmonitordailyrollup.FieldID, field.TypeInt64))
  308. if ps := _u.mutation.predicates; len(ps) > 0 {
  309. _spec.Predicate = func(selector *sql.Selector) {
  310. for i := range ps {
  311. ps[i](selector)
  312. }
  313. }
  314. }
  315. if value, ok := _u.mutation.Model(); ok {
  316. _spec.SetField(channelmonitordailyrollup.FieldModel, field.TypeString, value)
  317. }
  318. if value, ok := _u.mutation.BucketDate(); ok {
  319. _spec.SetField(channelmonitordailyrollup.FieldBucketDate, field.TypeTime, value)
  320. }
  321. if value, ok := _u.mutation.TotalChecks(); ok {
  322. _spec.SetField(channelmonitordailyrollup.FieldTotalChecks, field.TypeInt, value)
  323. }
  324. if value, ok := _u.mutation.AddedTotalChecks(); ok {
  325. _spec.AddField(channelmonitordailyrollup.FieldTotalChecks, field.TypeInt, value)
  326. }
  327. if value, ok := _u.mutation.OkCount(); ok {
  328. _spec.SetField(channelmonitordailyrollup.FieldOkCount, field.TypeInt, value)
  329. }
  330. if value, ok := _u.mutation.AddedOkCount(); ok {
  331. _spec.AddField(channelmonitordailyrollup.FieldOkCount, field.TypeInt, value)
  332. }
  333. if value, ok := _u.mutation.OperationalCount(); ok {
  334. _spec.SetField(channelmonitordailyrollup.FieldOperationalCount, field.TypeInt, value)
  335. }
  336. if value, ok := _u.mutation.AddedOperationalCount(); ok {
  337. _spec.AddField(channelmonitordailyrollup.FieldOperationalCount, field.TypeInt, value)
  338. }
  339. if value, ok := _u.mutation.DegradedCount(); ok {
  340. _spec.SetField(channelmonitordailyrollup.FieldDegradedCount, field.TypeInt, value)
  341. }
  342. if value, ok := _u.mutation.AddedDegradedCount(); ok {
  343. _spec.AddField(channelmonitordailyrollup.FieldDegradedCount, field.TypeInt, value)
  344. }
  345. if value, ok := _u.mutation.FailedCount(); ok {
  346. _spec.SetField(channelmonitordailyrollup.FieldFailedCount, field.TypeInt, value)
  347. }
  348. if value, ok := _u.mutation.AddedFailedCount(); ok {
  349. _spec.AddField(channelmonitordailyrollup.FieldFailedCount, field.TypeInt, value)
  350. }
  351. if value, ok := _u.mutation.ErrorCount(); ok {
  352. _spec.SetField(channelmonitordailyrollup.FieldErrorCount, field.TypeInt, value)
  353. }
  354. if value, ok := _u.mutation.AddedErrorCount(); ok {
  355. _spec.AddField(channelmonitordailyrollup.FieldErrorCount, field.TypeInt, value)
  356. }
  357. if value, ok := _u.mutation.SumLatencyMs(); ok {
  358. _spec.SetField(channelmonitordailyrollup.FieldSumLatencyMs, field.TypeInt64, value)
  359. }
  360. if value, ok := _u.mutation.AddedSumLatencyMs(); ok {
  361. _spec.AddField(channelmonitordailyrollup.FieldSumLatencyMs, field.TypeInt64, value)
  362. }
  363. if value, ok := _u.mutation.CountLatency(); ok {
  364. _spec.SetField(channelmonitordailyrollup.FieldCountLatency, field.TypeInt, value)
  365. }
  366. if value, ok := _u.mutation.AddedCountLatency(); ok {
  367. _spec.AddField(channelmonitordailyrollup.FieldCountLatency, field.TypeInt, value)
  368. }
  369. if value, ok := _u.mutation.SumPingLatencyMs(); ok {
  370. _spec.SetField(channelmonitordailyrollup.FieldSumPingLatencyMs, field.TypeInt64, value)
  371. }
  372. if value, ok := _u.mutation.AddedSumPingLatencyMs(); ok {
  373. _spec.AddField(channelmonitordailyrollup.FieldSumPingLatencyMs, field.TypeInt64, value)
  374. }
  375. if value, ok := _u.mutation.CountPingLatency(); ok {
  376. _spec.SetField(channelmonitordailyrollup.FieldCountPingLatency, field.TypeInt, value)
  377. }
  378. if value, ok := _u.mutation.AddedCountPingLatency(); ok {
  379. _spec.AddField(channelmonitordailyrollup.FieldCountPingLatency, field.TypeInt, value)
  380. }
  381. if value, ok := _u.mutation.ComputedAt(); ok {
  382. _spec.SetField(channelmonitordailyrollup.FieldComputedAt, field.TypeTime, value)
  383. }
  384. if _u.mutation.MonitorCleared() {
  385. edge := &sqlgraph.EdgeSpec{
  386. Rel: sqlgraph.M2O,
  387. Inverse: true,
  388. Table: channelmonitordailyrollup.MonitorTable,
  389. Columns: []string{channelmonitordailyrollup.MonitorColumn},
  390. Bidi: false,
  391. Target: &sqlgraph.EdgeTarget{
  392. IDSpec: sqlgraph.NewFieldSpec(channelmonitor.FieldID, field.TypeInt64),
  393. },
  394. }
  395. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  396. }
  397. if nodes := _u.mutation.MonitorIDs(); len(nodes) > 0 {
  398. edge := &sqlgraph.EdgeSpec{
  399. Rel: sqlgraph.M2O,
  400. Inverse: true,
  401. Table: channelmonitordailyrollup.MonitorTable,
  402. Columns: []string{channelmonitordailyrollup.MonitorColumn},
  403. Bidi: false,
  404. Target: &sqlgraph.EdgeTarget{
  405. IDSpec: sqlgraph.NewFieldSpec(channelmonitor.FieldID, field.TypeInt64),
  406. },
  407. }
  408. for _, k := range nodes {
  409. edge.Target.Nodes = append(edge.Target.Nodes, k)
  410. }
  411. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  412. }
  413. if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
  414. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  415. err = &NotFoundError{channelmonitordailyrollup.Label}
  416. } else if sqlgraph.IsConstraintError(err) {
  417. err = &ConstraintError{msg: err.Error(), wrap: err}
  418. }
  419. return 0, err
  420. }
  421. _u.mutation.done = true
  422. return _node, nil
  423. }
  424. // ChannelMonitorDailyRollupUpdateOne is the builder for updating a single ChannelMonitorDailyRollup entity.
  425. type ChannelMonitorDailyRollupUpdateOne struct {
  426. config
  427. fields []string
  428. hooks []Hook
  429. mutation *ChannelMonitorDailyRollupMutation
  430. }
  431. // SetMonitorID sets the "monitor_id" field.
  432. func (_u *ChannelMonitorDailyRollupUpdateOne) SetMonitorID(v int64) *ChannelMonitorDailyRollupUpdateOne {
  433. _u.mutation.SetMonitorID(v)
  434. return _u
  435. }
  436. // SetNillableMonitorID sets the "monitor_id" field if the given value is not nil.
  437. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableMonitorID(v *int64) *ChannelMonitorDailyRollupUpdateOne {
  438. if v != nil {
  439. _u.SetMonitorID(*v)
  440. }
  441. return _u
  442. }
  443. // SetModel sets the "model" field.
  444. func (_u *ChannelMonitorDailyRollupUpdateOne) SetModel(v string) *ChannelMonitorDailyRollupUpdateOne {
  445. _u.mutation.SetModel(v)
  446. return _u
  447. }
  448. // SetNillableModel sets the "model" field if the given value is not nil.
  449. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableModel(v *string) *ChannelMonitorDailyRollupUpdateOne {
  450. if v != nil {
  451. _u.SetModel(*v)
  452. }
  453. return _u
  454. }
  455. // SetBucketDate sets the "bucket_date" field.
  456. func (_u *ChannelMonitorDailyRollupUpdateOne) SetBucketDate(v time.Time) *ChannelMonitorDailyRollupUpdateOne {
  457. _u.mutation.SetBucketDate(v)
  458. return _u
  459. }
  460. // SetNillableBucketDate sets the "bucket_date" field if the given value is not nil.
  461. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableBucketDate(v *time.Time) *ChannelMonitorDailyRollupUpdateOne {
  462. if v != nil {
  463. _u.SetBucketDate(*v)
  464. }
  465. return _u
  466. }
  467. // SetTotalChecks sets the "total_checks" field.
  468. func (_u *ChannelMonitorDailyRollupUpdateOne) SetTotalChecks(v int) *ChannelMonitorDailyRollupUpdateOne {
  469. _u.mutation.ResetTotalChecks()
  470. _u.mutation.SetTotalChecks(v)
  471. return _u
  472. }
  473. // SetNillableTotalChecks sets the "total_checks" field if the given value is not nil.
  474. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableTotalChecks(v *int) *ChannelMonitorDailyRollupUpdateOne {
  475. if v != nil {
  476. _u.SetTotalChecks(*v)
  477. }
  478. return _u
  479. }
  480. // AddTotalChecks adds value to the "total_checks" field.
  481. func (_u *ChannelMonitorDailyRollupUpdateOne) AddTotalChecks(v int) *ChannelMonitorDailyRollupUpdateOne {
  482. _u.mutation.AddTotalChecks(v)
  483. return _u
  484. }
  485. // SetOkCount sets the "ok_count" field.
  486. func (_u *ChannelMonitorDailyRollupUpdateOne) SetOkCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  487. _u.mutation.ResetOkCount()
  488. _u.mutation.SetOkCount(v)
  489. return _u
  490. }
  491. // SetNillableOkCount sets the "ok_count" field if the given value is not nil.
  492. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableOkCount(v *int) *ChannelMonitorDailyRollupUpdateOne {
  493. if v != nil {
  494. _u.SetOkCount(*v)
  495. }
  496. return _u
  497. }
  498. // AddOkCount adds value to the "ok_count" field.
  499. func (_u *ChannelMonitorDailyRollupUpdateOne) AddOkCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  500. _u.mutation.AddOkCount(v)
  501. return _u
  502. }
  503. // SetOperationalCount sets the "operational_count" field.
  504. func (_u *ChannelMonitorDailyRollupUpdateOne) SetOperationalCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  505. _u.mutation.ResetOperationalCount()
  506. _u.mutation.SetOperationalCount(v)
  507. return _u
  508. }
  509. // SetNillableOperationalCount sets the "operational_count" field if the given value is not nil.
  510. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableOperationalCount(v *int) *ChannelMonitorDailyRollupUpdateOne {
  511. if v != nil {
  512. _u.SetOperationalCount(*v)
  513. }
  514. return _u
  515. }
  516. // AddOperationalCount adds value to the "operational_count" field.
  517. func (_u *ChannelMonitorDailyRollupUpdateOne) AddOperationalCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  518. _u.mutation.AddOperationalCount(v)
  519. return _u
  520. }
  521. // SetDegradedCount sets the "degraded_count" field.
  522. func (_u *ChannelMonitorDailyRollupUpdateOne) SetDegradedCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  523. _u.mutation.ResetDegradedCount()
  524. _u.mutation.SetDegradedCount(v)
  525. return _u
  526. }
  527. // SetNillableDegradedCount sets the "degraded_count" field if the given value is not nil.
  528. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableDegradedCount(v *int) *ChannelMonitorDailyRollupUpdateOne {
  529. if v != nil {
  530. _u.SetDegradedCount(*v)
  531. }
  532. return _u
  533. }
  534. // AddDegradedCount adds value to the "degraded_count" field.
  535. func (_u *ChannelMonitorDailyRollupUpdateOne) AddDegradedCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  536. _u.mutation.AddDegradedCount(v)
  537. return _u
  538. }
  539. // SetFailedCount sets the "failed_count" field.
  540. func (_u *ChannelMonitorDailyRollupUpdateOne) SetFailedCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  541. _u.mutation.ResetFailedCount()
  542. _u.mutation.SetFailedCount(v)
  543. return _u
  544. }
  545. // SetNillableFailedCount sets the "failed_count" field if the given value is not nil.
  546. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableFailedCount(v *int) *ChannelMonitorDailyRollupUpdateOne {
  547. if v != nil {
  548. _u.SetFailedCount(*v)
  549. }
  550. return _u
  551. }
  552. // AddFailedCount adds value to the "failed_count" field.
  553. func (_u *ChannelMonitorDailyRollupUpdateOne) AddFailedCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  554. _u.mutation.AddFailedCount(v)
  555. return _u
  556. }
  557. // SetErrorCount sets the "error_count" field.
  558. func (_u *ChannelMonitorDailyRollupUpdateOne) SetErrorCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  559. _u.mutation.ResetErrorCount()
  560. _u.mutation.SetErrorCount(v)
  561. return _u
  562. }
  563. // SetNillableErrorCount sets the "error_count" field if the given value is not nil.
  564. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableErrorCount(v *int) *ChannelMonitorDailyRollupUpdateOne {
  565. if v != nil {
  566. _u.SetErrorCount(*v)
  567. }
  568. return _u
  569. }
  570. // AddErrorCount adds value to the "error_count" field.
  571. func (_u *ChannelMonitorDailyRollupUpdateOne) AddErrorCount(v int) *ChannelMonitorDailyRollupUpdateOne {
  572. _u.mutation.AddErrorCount(v)
  573. return _u
  574. }
  575. // SetSumLatencyMs sets the "sum_latency_ms" field.
  576. func (_u *ChannelMonitorDailyRollupUpdateOne) SetSumLatencyMs(v int64) *ChannelMonitorDailyRollupUpdateOne {
  577. _u.mutation.ResetSumLatencyMs()
  578. _u.mutation.SetSumLatencyMs(v)
  579. return _u
  580. }
  581. // SetNillableSumLatencyMs sets the "sum_latency_ms" field if the given value is not nil.
  582. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableSumLatencyMs(v *int64) *ChannelMonitorDailyRollupUpdateOne {
  583. if v != nil {
  584. _u.SetSumLatencyMs(*v)
  585. }
  586. return _u
  587. }
  588. // AddSumLatencyMs adds value to the "sum_latency_ms" field.
  589. func (_u *ChannelMonitorDailyRollupUpdateOne) AddSumLatencyMs(v int64) *ChannelMonitorDailyRollupUpdateOne {
  590. _u.mutation.AddSumLatencyMs(v)
  591. return _u
  592. }
  593. // SetCountLatency sets the "count_latency" field.
  594. func (_u *ChannelMonitorDailyRollupUpdateOne) SetCountLatency(v int) *ChannelMonitorDailyRollupUpdateOne {
  595. _u.mutation.ResetCountLatency()
  596. _u.mutation.SetCountLatency(v)
  597. return _u
  598. }
  599. // SetNillableCountLatency sets the "count_latency" field if the given value is not nil.
  600. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableCountLatency(v *int) *ChannelMonitorDailyRollupUpdateOne {
  601. if v != nil {
  602. _u.SetCountLatency(*v)
  603. }
  604. return _u
  605. }
  606. // AddCountLatency adds value to the "count_latency" field.
  607. func (_u *ChannelMonitorDailyRollupUpdateOne) AddCountLatency(v int) *ChannelMonitorDailyRollupUpdateOne {
  608. _u.mutation.AddCountLatency(v)
  609. return _u
  610. }
  611. // SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
  612. func (_u *ChannelMonitorDailyRollupUpdateOne) SetSumPingLatencyMs(v int64) *ChannelMonitorDailyRollupUpdateOne {
  613. _u.mutation.ResetSumPingLatencyMs()
  614. _u.mutation.SetSumPingLatencyMs(v)
  615. return _u
  616. }
  617. // SetNillableSumPingLatencyMs sets the "sum_ping_latency_ms" field if the given value is not nil.
  618. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableSumPingLatencyMs(v *int64) *ChannelMonitorDailyRollupUpdateOne {
  619. if v != nil {
  620. _u.SetSumPingLatencyMs(*v)
  621. }
  622. return _u
  623. }
  624. // AddSumPingLatencyMs adds value to the "sum_ping_latency_ms" field.
  625. func (_u *ChannelMonitorDailyRollupUpdateOne) AddSumPingLatencyMs(v int64) *ChannelMonitorDailyRollupUpdateOne {
  626. _u.mutation.AddSumPingLatencyMs(v)
  627. return _u
  628. }
  629. // SetCountPingLatency sets the "count_ping_latency" field.
  630. func (_u *ChannelMonitorDailyRollupUpdateOne) SetCountPingLatency(v int) *ChannelMonitorDailyRollupUpdateOne {
  631. _u.mutation.ResetCountPingLatency()
  632. _u.mutation.SetCountPingLatency(v)
  633. return _u
  634. }
  635. // SetNillableCountPingLatency sets the "count_ping_latency" field if the given value is not nil.
  636. func (_u *ChannelMonitorDailyRollupUpdateOne) SetNillableCountPingLatency(v *int) *ChannelMonitorDailyRollupUpdateOne {
  637. if v != nil {
  638. _u.SetCountPingLatency(*v)
  639. }
  640. return _u
  641. }
  642. // AddCountPingLatency adds value to the "count_ping_latency" field.
  643. func (_u *ChannelMonitorDailyRollupUpdateOne) AddCountPingLatency(v int) *ChannelMonitorDailyRollupUpdateOne {
  644. _u.mutation.AddCountPingLatency(v)
  645. return _u
  646. }
  647. // SetComputedAt sets the "computed_at" field.
  648. func (_u *ChannelMonitorDailyRollupUpdateOne) SetComputedAt(v time.Time) *ChannelMonitorDailyRollupUpdateOne {
  649. _u.mutation.SetComputedAt(v)
  650. return _u
  651. }
  652. // SetMonitor sets the "monitor" edge to the ChannelMonitor entity.
  653. func (_u *ChannelMonitorDailyRollupUpdateOne) SetMonitor(v *ChannelMonitor) *ChannelMonitorDailyRollupUpdateOne {
  654. return _u.SetMonitorID(v.ID)
  655. }
  656. // Mutation returns the ChannelMonitorDailyRollupMutation object of the builder.
  657. func (_u *ChannelMonitorDailyRollupUpdateOne) Mutation() *ChannelMonitorDailyRollupMutation {
  658. return _u.mutation
  659. }
  660. // ClearMonitor clears the "monitor" edge to the ChannelMonitor entity.
  661. func (_u *ChannelMonitorDailyRollupUpdateOne) ClearMonitor() *ChannelMonitorDailyRollupUpdateOne {
  662. _u.mutation.ClearMonitor()
  663. return _u
  664. }
  665. // Where appends a list predicates to the ChannelMonitorDailyRollupUpdate builder.
  666. func (_u *ChannelMonitorDailyRollupUpdateOne) Where(ps ...predicate.ChannelMonitorDailyRollup) *ChannelMonitorDailyRollupUpdateOne {
  667. _u.mutation.Where(ps...)
  668. return _u
  669. }
  670. // Select allows selecting one or more fields (columns) of the returned entity.
  671. // The default is selecting all fields defined in the entity schema.
  672. func (_u *ChannelMonitorDailyRollupUpdateOne) Select(field string, fields ...string) *ChannelMonitorDailyRollupUpdateOne {
  673. _u.fields = append([]string{field}, fields...)
  674. return _u
  675. }
  676. // Save executes the query and returns the updated ChannelMonitorDailyRollup entity.
  677. func (_u *ChannelMonitorDailyRollupUpdateOne) Save(ctx context.Context) (*ChannelMonitorDailyRollup, error) {
  678. _u.defaults()
  679. return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
  680. }
  681. // SaveX is like Save, but panics if an error occurs.
  682. func (_u *ChannelMonitorDailyRollupUpdateOne) SaveX(ctx context.Context) *ChannelMonitorDailyRollup {
  683. node, err := _u.Save(ctx)
  684. if err != nil {
  685. panic(err)
  686. }
  687. return node
  688. }
  689. // Exec executes the query on the entity.
  690. func (_u *ChannelMonitorDailyRollupUpdateOne) Exec(ctx context.Context) error {
  691. _, err := _u.Save(ctx)
  692. return err
  693. }
  694. // ExecX is like Exec, but panics if an error occurs.
  695. func (_u *ChannelMonitorDailyRollupUpdateOne) ExecX(ctx context.Context) {
  696. if err := _u.Exec(ctx); err != nil {
  697. panic(err)
  698. }
  699. }
  700. // defaults sets the default values of the builder before save.
  701. func (_u *ChannelMonitorDailyRollupUpdateOne) defaults() {
  702. if _, ok := _u.mutation.ComputedAt(); !ok {
  703. v := channelmonitordailyrollup.UpdateDefaultComputedAt()
  704. _u.mutation.SetComputedAt(v)
  705. }
  706. }
  707. // check runs all checks and user-defined validators on the builder.
  708. func (_u *ChannelMonitorDailyRollupUpdateOne) check() error {
  709. if v, ok := _u.mutation.Model(); ok {
  710. if err := channelmonitordailyrollup.ModelValidator(v); err != nil {
  711. return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "ChannelMonitorDailyRollup.model": %w`, err)}
  712. }
  713. }
  714. if _u.mutation.MonitorCleared() && len(_u.mutation.MonitorIDs()) > 0 {
  715. return errors.New(`ent: clearing a required unique edge "ChannelMonitorDailyRollup.monitor"`)
  716. }
  717. return nil
  718. }
  719. func (_u *ChannelMonitorDailyRollupUpdateOne) sqlSave(ctx context.Context) (_node *ChannelMonitorDailyRollup, err error) {
  720. if err := _u.check(); err != nil {
  721. return _node, err
  722. }
  723. _spec := sqlgraph.NewUpdateSpec(channelmonitordailyrollup.Table, channelmonitordailyrollup.Columns, sqlgraph.NewFieldSpec(channelmonitordailyrollup.FieldID, field.TypeInt64))
  724. id, ok := _u.mutation.ID()
  725. if !ok {
  726. return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ChannelMonitorDailyRollup.id" for update`)}
  727. }
  728. _spec.Node.ID.Value = id
  729. if fields := _u.fields; len(fields) > 0 {
  730. _spec.Node.Columns = make([]string, 0, len(fields))
  731. _spec.Node.Columns = append(_spec.Node.Columns, channelmonitordailyrollup.FieldID)
  732. for _, f := range fields {
  733. if !channelmonitordailyrollup.ValidColumn(f) {
  734. return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
  735. }
  736. if f != channelmonitordailyrollup.FieldID {
  737. _spec.Node.Columns = append(_spec.Node.Columns, f)
  738. }
  739. }
  740. }
  741. if ps := _u.mutation.predicates; len(ps) > 0 {
  742. _spec.Predicate = func(selector *sql.Selector) {
  743. for i := range ps {
  744. ps[i](selector)
  745. }
  746. }
  747. }
  748. if value, ok := _u.mutation.Model(); ok {
  749. _spec.SetField(channelmonitordailyrollup.FieldModel, field.TypeString, value)
  750. }
  751. if value, ok := _u.mutation.BucketDate(); ok {
  752. _spec.SetField(channelmonitordailyrollup.FieldBucketDate, field.TypeTime, value)
  753. }
  754. if value, ok := _u.mutation.TotalChecks(); ok {
  755. _spec.SetField(channelmonitordailyrollup.FieldTotalChecks, field.TypeInt, value)
  756. }
  757. if value, ok := _u.mutation.AddedTotalChecks(); ok {
  758. _spec.AddField(channelmonitordailyrollup.FieldTotalChecks, field.TypeInt, value)
  759. }
  760. if value, ok := _u.mutation.OkCount(); ok {
  761. _spec.SetField(channelmonitordailyrollup.FieldOkCount, field.TypeInt, value)
  762. }
  763. if value, ok := _u.mutation.AddedOkCount(); ok {
  764. _spec.AddField(channelmonitordailyrollup.FieldOkCount, field.TypeInt, value)
  765. }
  766. if value, ok := _u.mutation.OperationalCount(); ok {
  767. _spec.SetField(channelmonitordailyrollup.FieldOperationalCount, field.TypeInt, value)
  768. }
  769. if value, ok := _u.mutation.AddedOperationalCount(); ok {
  770. _spec.AddField(channelmonitordailyrollup.FieldOperationalCount, field.TypeInt, value)
  771. }
  772. if value, ok := _u.mutation.DegradedCount(); ok {
  773. _spec.SetField(channelmonitordailyrollup.FieldDegradedCount, field.TypeInt, value)
  774. }
  775. if value, ok := _u.mutation.AddedDegradedCount(); ok {
  776. _spec.AddField(channelmonitordailyrollup.FieldDegradedCount, field.TypeInt, value)
  777. }
  778. if value, ok := _u.mutation.FailedCount(); ok {
  779. _spec.SetField(channelmonitordailyrollup.FieldFailedCount, field.TypeInt, value)
  780. }
  781. if value, ok := _u.mutation.AddedFailedCount(); ok {
  782. _spec.AddField(channelmonitordailyrollup.FieldFailedCount, field.TypeInt, value)
  783. }
  784. if value, ok := _u.mutation.ErrorCount(); ok {
  785. _spec.SetField(channelmonitordailyrollup.FieldErrorCount, field.TypeInt, value)
  786. }
  787. if value, ok := _u.mutation.AddedErrorCount(); ok {
  788. _spec.AddField(channelmonitordailyrollup.FieldErrorCount, field.TypeInt, value)
  789. }
  790. if value, ok := _u.mutation.SumLatencyMs(); ok {
  791. _spec.SetField(channelmonitordailyrollup.FieldSumLatencyMs, field.TypeInt64, value)
  792. }
  793. if value, ok := _u.mutation.AddedSumLatencyMs(); ok {
  794. _spec.AddField(channelmonitordailyrollup.FieldSumLatencyMs, field.TypeInt64, value)
  795. }
  796. if value, ok := _u.mutation.CountLatency(); ok {
  797. _spec.SetField(channelmonitordailyrollup.FieldCountLatency, field.TypeInt, value)
  798. }
  799. if value, ok := _u.mutation.AddedCountLatency(); ok {
  800. _spec.AddField(channelmonitordailyrollup.FieldCountLatency, field.TypeInt, value)
  801. }
  802. if value, ok := _u.mutation.SumPingLatencyMs(); ok {
  803. _spec.SetField(channelmonitordailyrollup.FieldSumPingLatencyMs, field.TypeInt64, value)
  804. }
  805. if value, ok := _u.mutation.AddedSumPingLatencyMs(); ok {
  806. _spec.AddField(channelmonitordailyrollup.FieldSumPingLatencyMs, field.TypeInt64, value)
  807. }
  808. if value, ok := _u.mutation.CountPingLatency(); ok {
  809. _spec.SetField(channelmonitordailyrollup.FieldCountPingLatency, field.TypeInt, value)
  810. }
  811. if value, ok := _u.mutation.AddedCountPingLatency(); ok {
  812. _spec.AddField(channelmonitordailyrollup.FieldCountPingLatency, field.TypeInt, value)
  813. }
  814. if value, ok := _u.mutation.ComputedAt(); ok {
  815. _spec.SetField(channelmonitordailyrollup.FieldComputedAt, field.TypeTime, value)
  816. }
  817. if _u.mutation.MonitorCleared() {
  818. edge := &sqlgraph.EdgeSpec{
  819. Rel: sqlgraph.M2O,
  820. Inverse: true,
  821. Table: channelmonitordailyrollup.MonitorTable,
  822. Columns: []string{channelmonitordailyrollup.MonitorColumn},
  823. Bidi: false,
  824. Target: &sqlgraph.EdgeTarget{
  825. IDSpec: sqlgraph.NewFieldSpec(channelmonitor.FieldID, field.TypeInt64),
  826. },
  827. }
  828. _spec.Edges.Clear = append(_spec.Edges.Clear, edge)
  829. }
  830. if nodes := _u.mutation.MonitorIDs(); len(nodes) > 0 {
  831. edge := &sqlgraph.EdgeSpec{
  832. Rel: sqlgraph.M2O,
  833. Inverse: true,
  834. Table: channelmonitordailyrollup.MonitorTable,
  835. Columns: []string{channelmonitordailyrollup.MonitorColumn},
  836. Bidi: false,
  837. Target: &sqlgraph.EdgeTarget{
  838. IDSpec: sqlgraph.NewFieldSpec(channelmonitor.FieldID, field.TypeInt64),
  839. },
  840. }
  841. for _, k := range nodes {
  842. edge.Target.Nodes = append(edge.Target.Nodes, k)
  843. }
  844. _spec.Edges.Add = append(_spec.Edges.Add, edge)
  845. }
  846. _node = &ChannelMonitorDailyRollup{config: _u.config}
  847. _spec.Assign = _node.assignValues
  848. _spec.ScanValues = _node.scanValues
  849. if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
  850. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  851. err = &NotFoundError{channelmonitordailyrollup.Label}
  852. } else if sqlgraph.IsConstraintError(err) {
  853. err = &ConstraintError{msg: err.Error(), wrap: err}
  854. }
  855. return nil, err
  856. }
  857. _u.mutation.done = true
  858. return _node, nil
  859. }