channelmonitorhistory_create.go 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  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/channelmonitorhistory"
  13. "github.com/Wei-Shaw/sub2api/internal/domain"
  14. )
  15. // ChannelMonitorHistoryCreate is the builder for creating a ChannelMonitorHistory entity.
  16. type ChannelMonitorHistoryCreate struct {
  17. config
  18. mutation *ChannelMonitorHistoryMutation
  19. hooks []Hook
  20. conflict []sql.ConflictOption
  21. }
  22. // SetMonitorID sets the "monitor_id" field.
  23. func (_c *ChannelMonitorHistoryCreate) SetMonitorID(v int64) *ChannelMonitorHistoryCreate {
  24. _c.mutation.SetMonitorID(v)
  25. return _c
  26. }
  27. // SetModel sets the "model" field.
  28. func (_c *ChannelMonitorHistoryCreate) SetModel(v string) *ChannelMonitorHistoryCreate {
  29. _c.mutation.SetModel(v)
  30. return _c
  31. }
  32. // SetStatus sets the "status" field.
  33. func (_c *ChannelMonitorHistoryCreate) SetStatus(v channelmonitorhistory.Status) *ChannelMonitorHistoryCreate {
  34. _c.mutation.SetStatus(v)
  35. return _c
  36. }
  37. // SetLatencyMs sets the "latency_ms" field.
  38. func (_c *ChannelMonitorHistoryCreate) SetLatencyMs(v int) *ChannelMonitorHistoryCreate {
  39. _c.mutation.SetLatencyMs(v)
  40. return _c
  41. }
  42. // SetNillableLatencyMs sets the "latency_ms" field if the given value is not nil.
  43. func (_c *ChannelMonitorHistoryCreate) SetNillableLatencyMs(v *int) *ChannelMonitorHistoryCreate {
  44. if v != nil {
  45. _c.SetLatencyMs(*v)
  46. }
  47. return _c
  48. }
  49. // SetPingLatencyMs sets the "ping_latency_ms" field.
  50. func (_c *ChannelMonitorHistoryCreate) SetPingLatencyMs(v int) *ChannelMonitorHistoryCreate {
  51. _c.mutation.SetPingLatencyMs(v)
  52. return _c
  53. }
  54. // SetNillablePingLatencyMs sets the "ping_latency_ms" field if the given value is not nil.
  55. func (_c *ChannelMonitorHistoryCreate) SetNillablePingLatencyMs(v *int) *ChannelMonitorHistoryCreate {
  56. if v != nil {
  57. _c.SetPingLatencyMs(*v)
  58. }
  59. return _c
  60. }
  61. // SetMessage sets the "message" field.
  62. func (_c *ChannelMonitorHistoryCreate) SetMessage(v string) *ChannelMonitorHistoryCreate {
  63. _c.mutation.SetMessage(v)
  64. return _c
  65. }
  66. // SetNillableMessage sets the "message" field if the given value is not nil.
  67. func (_c *ChannelMonitorHistoryCreate) SetNillableMessage(v *string) *ChannelMonitorHistoryCreate {
  68. if v != nil {
  69. _c.SetMessage(*v)
  70. }
  71. return _c
  72. }
  73. // SetQuota sets the "quota" field.
  74. func (_c *ChannelMonitorHistoryCreate) SetQuota(v *domain.MonitorQuotaSnapshot) *ChannelMonitorHistoryCreate {
  75. _c.mutation.SetQuota(v)
  76. return _c
  77. }
  78. // SetCheckedAt sets the "checked_at" field.
  79. func (_c *ChannelMonitorHistoryCreate) SetCheckedAt(v time.Time) *ChannelMonitorHistoryCreate {
  80. _c.mutation.SetCheckedAt(v)
  81. return _c
  82. }
  83. // SetNillableCheckedAt sets the "checked_at" field if the given value is not nil.
  84. func (_c *ChannelMonitorHistoryCreate) SetNillableCheckedAt(v *time.Time) *ChannelMonitorHistoryCreate {
  85. if v != nil {
  86. _c.SetCheckedAt(*v)
  87. }
  88. return _c
  89. }
  90. // SetMonitor sets the "monitor" edge to the ChannelMonitor entity.
  91. func (_c *ChannelMonitorHistoryCreate) SetMonitor(v *ChannelMonitor) *ChannelMonitorHistoryCreate {
  92. return _c.SetMonitorID(v.ID)
  93. }
  94. // Mutation returns the ChannelMonitorHistoryMutation object of the builder.
  95. func (_c *ChannelMonitorHistoryCreate) Mutation() *ChannelMonitorHistoryMutation {
  96. return _c.mutation
  97. }
  98. // Save creates the ChannelMonitorHistory in the database.
  99. func (_c *ChannelMonitorHistoryCreate) Save(ctx context.Context) (*ChannelMonitorHistory, error) {
  100. _c.defaults()
  101. return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
  102. }
  103. // SaveX calls Save and panics if Save returns an error.
  104. func (_c *ChannelMonitorHistoryCreate) SaveX(ctx context.Context) *ChannelMonitorHistory {
  105. v, err := _c.Save(ctx)
  106. if err != nil {
  107. panic(err)
  108. }
  109. return v
  110. }
  111. // Exec executes the query.
  112. func (_c *ChannelMonitorHistoryCreate) Exec(ctx context.Context) error {
  113. _, err := _c.Save(ctx)
  114. return err
  115. }
  116. // ExecX is like Exec, but panics if an error occurs.
  117. func (_c *ChannelMonitorHistoryCreate) ExecX(ctx context.Context) {
  118. if err := _c.Exec(ctx); err != nil {
  119. panic(err)
  120. }
  121. }
  122. // defaults sets the default values of the builder before save.
  123. func (_c *ChannelMonitorHistoryCreate) defaults() {
  124. if _, ok := _c.mutation.Message(); !ok {
  125. v := channelmonitorhistory.DefaultMessage
  126. _c.mutation.SetMessage(v)
  127. }
  128. if _, ok := _c.mutation.CheckedAt(); !ok {
  129. v := channelmonitorhistory.DefaultCheckedAt()
  130. _c.mutation.SetCheckedAt(v)
  131. }
  132. }
  133. // check runs all checks and user-defined validators on the builder.
  134. func (_c *ChannelMonitorHistoryCreate) check() error {
  135. if _, ok := _c.mutation.MonitorID(); !ok {
  136. return &ValidationError{Name: "monitor_id", err: errors.New(`ent: missing required field "ChannelMonitorHistory.monitor_id"`)}
  137. }
  138. if _, ok := _c.mutation.Model(); !ok {
  139. return &ValidationError{Name: "model", err: errors.New(`ent: missing required field "ChannelMonitorHistory.model"`)}
  140. }
  141. if v, ok := _c.mutation.Model(); ok {
  142. if err := channelmonitorhistory.ModelValidator(v); err != nil {
  143. return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "ChannelMonitorHistory.model": %w`, err)}
  144. }
  145. }
  146. if _, ok := _c.mutation.Status(); !ok {
  147. return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "ChannelMonitorHistory.status"`)}
  148. }
  149. if v, ok := _c.mutation.Status(); ok {
  150. if err := channelmonitorhistory.StatusValidator(v); err != nil {
  151. return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "ChannelMonitorHistory.status": %w`, err)}
  152. }
  153. }
  154. if v, ok := _c.mutation.Message(); ok {
  155. if err := channelmonitorhistory.MessageValidator(v); err != nil {
  156. return &ValidationError{Name: "message", err: fmt.Errorf(`ent: validator failed for field "ChannelMonitorHistory.message": %w`, err)}
  157. }
  158. }
  159. if _, ok := _c.mutation.CheckedAt(); !ok {
  160. return &ValidationError{Name: "checked_at", err: errors.New(`ent: missing required field "ChannelMonitorHistory.checked_at"`)}
  161. }
  162. if len(_c.mutation.MonitorIDs()) == 0 {
  163. return &ValidationError{Name: "monitor", err: errors.New(`ent: missing required edge "ChannelMonitorHistory.monitor"`)}
  164. }
  165. return nil
  166. }
  167. func (_c *ChannelMonitorHistoryCreate) sqlSave(ctx context.Context) (*ChannelMonitorHistory, error) {
  168. if err := _c.check(); err != nil {
  169. return nil, err
  170. }
  171. _node, _spec := _c.createSpec()
  172. if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
  173. if sqlgraph.IsConstraintError(err) {
  174. err = &ConstraintError{msg: err.Error(), wrap: err}
  175. }
  176. return nil, err
  177. }
  178. id := _spec.ID.Value.(int64)
  179. _node.ID = int64(id)
  180. _c.mutation.id = &_node.ID
  181. _c.mutation.done = true
  182. return _node, nil
  183. }
  184. func (_c *ChannelMonitorHistoryCreate) createSpec() (*ChannelMonitorHistory, *sqlgraph.CreateSpec) {
  185. var (
  186. _node = &ChannelMonitorHistory{config: _c.config}
  187. _spec = sqlgraph.NewCreateSpec(channelmonitorhistory.Table, sqlgraph.NewFieldSpec(channelmonitorhistory.FieldID, field.TypeInt64))
  188. )
  189. _spec.OnConflict = _c.conflict
  190. if value, ok := _c.mutation.Model(); ok {
  191. _spec.SetField(channelmonitorhistory.FieldModel, field.TypeString, value)
  192. _node.Model = value
  193. }
  194. if value, ok := _c.mutation.Status(); ok {
  195. _spec.SetField(channelmonitorhistory.FieldStatus, field.TypeEnum, value)
  196. _node.Status = value
  197. }
  198. if value, ok := _c.mutation.LatencyMs(); ok {
  199. _spec.SetField(channelmonitorhistory.FieldLatencyMs, field.TypeInt, value)
  200. _node.LatencyMs = &value
  201. }
  202. if value, ok := _c.mutation.PingLatencyMs(); ok {
  203. _spec.SetField(channelmonitorhistory.FieldPingLatencyMs, field.TypeInt, value)
  204. _node.PingLatencyMs = &value
  205. }
  206. if value, ok := _c.mutation.Message(); ok {
  207. _spec.SetField(channelmonitorhistory.FieldMessage, field.TypeString, value)
  208. _node.Message = value
  209. }
  210. if value, ok := _c.mutation.Quota(); ok {
  211. _spec.SetField(channelmonitorhistory.FieldQuota, field.TypeJSON, value)
  212. _node.Quota = value
  213. }
  214. if value, ok := _c.mutation.CheckedAt(); ok {
  215. _spec.SetField(channelmonitorhistory.FieldCheckedAt, field.TypeTime, value)
  216. _node.CheckedAt = value
  217. }
  218. if nodes := _c.mutation.MonitorIDs(); len(nodes) > 0 {
  219. edge := &sqlgraph.EdgeSpec{
  220. Rel: sqlgraph.M2O,
  221. Inverse: true,
  222. Table: channelmonitorhistory.MonitorTable,
  223. Columns: []string{channelmonitorhistory.MonitorColumn},
  224. Bidi: false,
  225. Target: &sqlgraph.EdgeTarget{
  226. IDSpec: sqlgraph.NewFieldSpec(channelmonitor.FieldID, field.TypeInt64),
  227. },
  228. }
  229. for _, k := range nodes {
  230. edge.Target.Nodes = append(edge.Target.Nodes, k)
  231. }
  232. _node.MonitorID = nodes[0]
  233. _spec.Edges = append(_spec.Edges, edge)
  234. }
  235. return _node, _spec
  236. }
  237. // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
  238. // of the `INSERT` statement. For example:
  239. //
  240. // client.ChannelMonitorHistory.Create().
  241. // SetMonitorID(v).
  242. // OnConflict(
  243. // // Update the row with the new values
  244. // // the was proposed for insertion.
  245. // sql.ResolveWithNewValues(),
  246. // ).
  247. // // Override some of the fields with custom
  248. // // update values.
  249. // Update(func(u *ent.ChannelMonitorHistoryUpsert) {
  250. // SetMonitorID(v+v).
  251. // }).
  252. // Exec(ctx)
  253. func (_c *ChannelMonitorHistoryCreate) OnConflict(opts ...sql.ConflictOption) *ChannelMonitorHistoryUpsertOne {
  254. _c.conflict = opts
  255. return &ChannelMonitorHistoryUpsertOne{
  256. create: _c,
  257. }
  258. }
  259. // OnConflictColumns calls `OnConflict` and configures the columns
  260. // as conflict target. Using this option is equivalent to using:
  261. //
  262. // client.ChannelMonitorHistory.Create().
  263. // OnConflict(sql.ConflictColumns(columns...)).
  264. // Exec(ctx)
  265. func (_c *ChannelMonitorHistoryCreate) OnConflictColumns(columns ...string) *ChannelMonitorHistoryUpsertOne {
  266. _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
  267. return &ChannelMonitorHistoryUpsertOne{
  268. create: _c,
  269. }
  270. }
  271. type (
  272. // ChannelMonitorHistoryUpsertOne is the builder for "upsert"-ing
  273. // one ChannelMonitorHistory node.
  274. ChannelMonitorHistoryUpsertOne struct {
  275. create *ChannelMonitorHistoryCreate
  276. }
  277. // ChannelMonitorHistoryUpsert is the "OnConflict" setter.
  278. ChannelMonitorHistoryUpsert struct {
  279. *sql.UpdateSet
  280. }
  281. )
  282. // SetMonitorID sets the "monitor_id" field.
  283. func (u *ChannelMonitorHistoryUpsert) SetMonitorID(v int64) *ChannelMonitorHistoryUpsert {
  284. u.Set(channelmonitorhistory.FieldMonitorID, v)
  285. return u
  286. }
  287. // UpdateMonitorID sets the "monitor_id" field to the value that was provided on create.
  288. func (u *ChannelMonitorHistoryUpsert) UpdateMonitorID() *ChannelMonitorHistoryUpsert {
  289. u.SetExcluded(channelmonitorhistory.FieldMonitorID)
  290. return u
  291. }
  292. // SetModel sets the "model" field.
  293. func (u *ChannelMonitorHistoryUpsert) SetModel(v string) *ChannelMonitorHistoryUpsert {
  294. u.Set(channelmonitorhistory.FieldModel, v)
  295. return u
  296. }
  297. // UpdateModel sets the "model" field to the value that was provided on create.
  298. func (u *ChannelMonitorHistoryUpsert) UpdateModel() *ChannelMonitorHistoryUpsert {
  299. u.SetExcluded(channelmonitorhistory.FieldModel)
  300. return u
  301. }
  302. // SetStatus sets the "status" field.
  303. func (u *ChannelMonitorHistoryUpsert) SetStatus(v channelmonitorhistory.Status) *ChannelMonitorHistoryUpsert {
  304. u.Set(channelmonitorhistory.FieldStatus, v)
  305. return u
  306. }
  307. // UpdateStatus sets the "status" field to the value that was provided on create.
  308. func (u *ChannelMonitorHistoryUpsert) UpdateStatus() *ChannelMonitorHistoryUpsert {
  309. u.SetExcluded(channelmonitorhistory.FieldStatus)
  310. return u
  311. }
  312. // SetLatencyMs sets the "latency_ms" field.
  313. func (u *ChannelMonitorHistoryUpsert) SetLatencyMs(v int) *ChannelMonitorHistoryUpsert {
  314. u.Set(channelmonitorhistory.FieldLatencyMs, v)
  315. return u
  316. }
  317. // UpdateLatencyMs sets the "latency_ms" field to the value that was provided on create.
  318. func (u *ChannelMonitorHistoryUpsert) UpdateLatencyMs() *ChannelMonitorHistoryUpsert {
  319. u.SetExcluded(channelmonitorhistory.FieldLatencyMs)
  320. return u
  321. }
  322. // AddLatencyMs adds v to the "latency_ms" field.
  323. func (u *ChannelMonitorHistoryUpsert) AddLatencyMs(v int) *ChannelMonitorHistoryUpsert {
  324. u.Add(channelmonitorhistory.FieldLatencyMs, v)
  325. return u
  326. }
  327. // ClearLatencyMs clears the value of the "latency_ms" field.
  328. func (u *ChannelMonitorHistoryUpsert) ClearLatencyMs() *ChannelMonitorHistoryUpsert {
  329. u.SetNull(channelmonitorhistory.FieldLatencyMs)
  330. return u
  331. }
  332. // SetPingLatencyMs sets the "ping_latency_ms" field.
  333. func (u *ChannelMonitorHistoryUpsert) SetPingLatencyMs(v int) *ChannelMonitorHistoryUpsert {
  334. u.Set(channelmonitorhistory.FieldPingLatencyMs, v)
  335. return u
  336. }
  337. // UpdatePingLatencyMs sets the "ping_latency_ms" field to the value that was provided on create.
  338. func (u *ChannelMonitorHistoryUpsert) UpdatePingLatencyMs() *ChannelMonitorHistoryUpsert {
  339. u.SetExcluded(channelmonitorhistory.FieldPingLatencyMs)
  340. return u
  341. }
  342. // AddPingLatencyMs adds v to the "ping_latency_ms" field.
  343. func (u *ChannelMonitorHistoryUpsert) AddPingLatencyMs(v int) *ChannelMonitorHistoryUpsert {
  344. u.Add(channelmonitorhistory.FieldPingLatencyMs, v)
  345. return u
  346. }
  347. // ClearPingLatencyMs clears the value of the "ping_latency_ms" field.
  348. func (u *ChannelMonitorHistoryUpsert) ClearPingLatencyMs() *ChannelMonitorHistoryUpsert {
  349. u.SetNull(channelmonitorhistory.FieldPingLatencyMs)
  350. return u
  351. }
  352. // SetMessage sets the "message" field.
  353. func (u *ChannelMonitorHistoryUpsert) SetMessage(v string) *ChannelMonitorHistoryUpsert {
  354. u.Set(channelmonitorhistory.FieldMessage, v)
  355. return u
  356. }
  357. // UpdateMessage sets the "message" field to the value that was provided on create.
  358. func (u *ChannelMonitorHistoryUpsert) UpdateMessage() *ChannelMonitorHistoryUpsert {
  359. u.SetExcluded(channelmonitorhistory.FieldMessage)
  360. return u
  361. }
  362. // ClearMessage clears the value of the "message" field.
  363. func (u *ChannelMonitorHistoryUpsert) ClearMessage() *ChannelMonitorHistoryUpsert {
  364. u.SetNull(channelmonitorhistory.FieldMessage)
  365. return u
  366. }
  367. // SetQuota sets the "quota" field.
  368. func (u *ChannelMonitorHistoryUpsert) SetQuota(v *domain.MonitorQuotaSnapshot) *ChannelMonitorHistoryUpsert {
  369. u.Set(channelmonitorhistory.FieldQuota, v)
  370. return u
  371. }
  372. // UpdateQuota sets the "quota" field to the value that was provided on create.
  373. func (u *ChannelMonitorHistoryUpsert) UpdateQuota() *ChannelMonitorHistoryUpsert {
  374. u.SetExcluded(channelmonitorhistory.FieldQuota)
  375. return u
  376. }
  377. // ClearQuota clears the value of the "quota" field.
  378. func (u *ChannelMonitorHistoryUpsert) ClearQuota() *ChannelMonitorHistoryUpsert {
  379. u.SetNull(channelmonitorhistory.FieldQuota)
  380. return u
  381. }
  382. // SetCheckedAt sets the "checked_at" field.
  383. func (u *ChannelMonitorHistoryUpsert) SetCheckedAt(v time.Time) *ChannelMonitorHistoryUpsert {
  384. u.Set(channelmonitorhistory.FieldCheckedAt, v)
  385. return u
  386. }
  387. // UpdateCheckedAt sets the "checked_at" field to the value that was provided on create.
  388. func (u *ChannelMonitorHistoryUpsert) UpdateCheckedAt() *ChannelMonitorHistoryUpsert {
  389. u.SetExcluded(channelmonitorhistory.FieldCheckedAt)
  390. return u
  391. }
  392. // UpdateNewValues updates the mutable fields using the new values that were set on create.
  393. // Using this option is equivalent to using:
  394. //
  395. // client.ChannelMonitorHistory.Create().
  396. // OnConflict(
  397. // sql.ResolveWithNewValues(),
  398. // ).
  399. // Exec(ctx)
  400. func (u *ChannelMonitorHistoryUpsertOne) UpdateNewValues() *ChannelMonitorHistoryUpsertOne {
  401. u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
  402. return u
  403. }
  404. // Ignore sets each column to itself in case of conflict.
  405. // Using this option is equivalent to using:
  406. //
  407. // client.ChannelMonitorHistory.Create().
  408. // OnConflict(sql.ResolveWithIgnore()).
  409. // Exec(ctx)
  410. func (u *ChannelMonitorHistoryUpsertOne) Ignore() *ChannelMonitorHistoryUpsertOne {
  411. u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
  412. return u
  413. }
  414. // DoNothing configures the conflict_action to `DO NOTHING`.
  415. // Supported only by SQLite and PostgreSQL.
  416. func (u *ChannelMonitorHistoryUpsertOne) DoNothing() *ChannelMonitorHistoryUpsertOne {
  417. u.create.conflict = append(u.create.conflict, sql.DoNothing())
  418. return u
  419. }
  420. // Update allows overriding fields `UPDATE` values. See the ChannelMonitorHistoryCreate.OnConflict
  421. // documentation for more info.
  422. func (u *ChannelMonitorHistoryUpsertOne) Update(set func(*ChannelMonitorHistoryUpsert)) *ChannelMonitorHistoryUpsertOne {
  423. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
  424. set(&ChannelMonitorHistoryUpsert{UpdateSet: update})
  425. }))
  426. return u
  427. }
  428. // SetMonitorID sets the "monitor_id" field.
  429. func (u *ChannelMonitorHistoryUpsertOne) SetMonitorID(v int64) *ChannelMonitorHistoryUpsertOne {
  430. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  431. s.SetMonitorID(v)
  432. })
  433. }
  434. // UpdateMonitorID sets the "monitor_id" field to the value that was provided on create.
  435. func (u *ChannelMonitorHistoryUpsertOne) UpdateMonitorID() *ChannelMonitorHistoryUpsertOne {
  436. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  437. s.UpdateMonitorID()
  438. })
  439. }
  440. // SetModel sets the "model" field.
  441. func (u *ChannelMonitorHistoryUpsertOne) SetModel(v string) *ChannelMonitorHistoryUpsertOne {
  442. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  443. s.SetModel(v)
  444. })
  445. }
  446. // UpdateModel sets the "model" field to the value that was provided on create.
  447. func (u *ChannelMonitorHistoryUpsertOne) UpdateModel() *ChannelMonitorHistoryUpsertOne {
  448. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  449. s.UpdateModel()
  450. })
  451. }
  452. // SetStatus sets the "status" field.
  453. func (u *ChannelMonitorHistoryUpsertOne) SetStatus(v channelmonitorhistory.Status) *ChannelMonitorHistoryUpsertOne {
  454. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  455. s.SetStatus(v)
  456. })
  457. }
  458. // UpdateStatus sets the "status" field to the value that was provided on create.
  459. func (u *ChannelMonitorHistoryUpsertOne) UpdateStatus() *ChannelMonitorHistoryUpsertOne {
  460. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  461. s.UpdateStatus()
  462. })
  463. }
  464. // SetLatencyMs sets the "latency_ms" field.
  465. func (u *ChannelMonitorHistoryUpsertOne) SetLatencyMs(v int) *ChannelMonitorHistoryUpsertOne {
  466. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  467. s.SetLatencyMs(v)
  468. })
  469. }
  470. // AddLatencyMs adds v to the "latency_ms" field.
  471. func (u *ChannelMonitorHistoryUpsertOne) AddLatencyMs(v int) *ChannelMonitorHistoryUpsertOne {
  472. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  473. s.AddLatencyMs(v)
  474. })
  475. }
  476. // UpdateLatencyMs sets the "latency_ms" field to the value that was provided on create.
  477. func (u *ChannelMonitorHistoryUpsertOne) UpdateLatencyMs() *ChannelMonitorHistoryUpsertOne {
  478. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  479. s.UpdateLatencyMs()
  480. })
  481. }
  482. // ClearLatencyMs clears the value of the "latency_ms" field.
  483. func (u *ChannelMonitorHistoryUpsertOne) ClearLatencyMs() *ChannelMonitorHistoryUpsertOne {
  484. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  485. s.ClearLatencyMs()
  486. })
  487. }
  488. // SetPingLatencyMs sets the "ping_latency_ms" field.
  489. func (u *ChannelMonitorHistoryUpsertOne) SetPingLatencyMs(v int) *ChannelMonitorHistoryUpsertOne {
  490. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  491. s.SetPingLatencyMs(v)
  492. })
  493. }
  494. // AddPingLatencyMs adds v to the "ping_latency_ms" field.
  495. func (u *ChannelMonitorHistoryUpsertOne) AddPingLatencyMs(v int) *ChannelMonitorHistoryUpsertOne {
  496. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  497. s.AddPingLatencyMs(v)
  498. })
  499. }
  500. // UpdatePingLatencyMs sets the "ping_latency_ms" field to the value that was provided on create.
  501. func (u *ChannelMonitorHistoryUpsertOne) UpdatePingLatencyMs() *ChannelMonitorHistoryUpsertOne {
  502. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  503. s.UpdatePingLatencyMs()
  504. })
  505. }
  506. // ClearPingLatencyMs clears the value of the "ping_latency_ms" field.
  507. func (u *ChannelMonitorHistoryUpsertOne) ClearPingLatencyMs() *ChannelMonitorHistoryUpsertOne {
  508. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  509. s.ClearPingLatencyMs()
  510. })
  511. }
  512. // SetMessage sets the "message" field.
  513. func (u *ChannelMonitorHistoryUpsertOne) SetMessage(v string) *ChannelMonitorHistoryUpsertOne {
  514. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  515. s.SetMessage(v)
  516. })
  517. }
  518. // UpdateMessage sets the "message" field to the value that was provided on create.
  519. func (u *ChannelMonitorHistoryUpsertOne) UpdateMessage() *ChannelMonitorHistoryUpsertOne {
  520. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  521. s.UpdateMessage()
  522. })
  523. }
  524. // ClearMessage clears the value of the "message" field.
  525. func (u *ChannelMonitorHistoryUpsertOne) ClearMessage() *ChannelMonitorHistoryUpsertOne {
  526. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  527. s.ClearMessage()
  528. })
  529. }
  530. // SetQuota sets the "quota" field.
  531. func (u *ChannelMonitorHistoryUpsertOne) SetQuota(v *domain.MonitorQuotaSnapshot) *ChannelMonitorHistoryUpsertOne {
  532. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  533. s.SetQuota(v)
  534. })
  535. }
  536. // UpdateQuota sets the "quota" field to the value that was provided on create.
  537. func (u *ChannelMonitorHistoryUpsertOne) UpdateQuota() *ChannelMonitorHistoryUpsertOne {
  538. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  539. s.UpdateQuota()
  540. })
  541. }
  542. // ClearQuota clears the value of the "quota" field.
  543. func (u *ChannelMonitorHistoryUpsertOne) ClearQuota() *ChannelMonitorHistoryUpsertOne {
  544. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  545. s.ClearQuota()
  546. })
  547. }
  548. // SetCheckedAt sets the "checked_at" field.
  549. func (u *ChannelMonitorHistoryUpsertOne) SetCheckedAt(v time.Time) *ChannelMonitorHistoryUpsertOne {
  550. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  551. s.SetCheckedAt(v)
  552. })
  553. }
  554. // UpdateCheckedAt sets the "checked_at" field to the value that was provided on create.
  555. func (u *ChannelMonitorHistoryUpsertOne) UpdateCheckedAt() *ChannelMonitorHistoryUpsertOne {
  556. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  557. s.UpdateCheckedAt()
  558. })
  559. }
  560. // Exec executes the query.
  561. func (u *ChannelMonitorHistoryUpsertOne) Exec(ctx context.Context) error {
  562. if len(u.create.conflict) == 0 {
  563. return errors.New("ent: missing options for ChannelMonitorHistoryCreate.OnConflict")
  564. }
  565. return u.create.Exec(ctx)
  566. }
  567. // ExecX is like Exec, but panics if an error occurs.
  568. func (u *ChannelMonitorHistoryUpsertOne) ExecX(ctx context.Context) {
  569. if err := u.create.Exec(ctx); err != nil {
  570. panic(err)
  571. }
  572. }
  573. // Exec executes the UPSERT query and returns the inserted/updated ID.
  574. func (u *ChannelMonitorHistoryUpsertOne) ID(ctx context.Context) (id int64, err error) {
  575. node, err := u.create.Save(ctx)
  576. if err != nil {
  577. return id, err
  578. }
  579. return node.ID, nil
  580. }
  581. // IDX is like ID, but panics if an error occurs.
  582. func (u *ChannelMonitorHistoryUpsertOne) IDX(ctx context.Context) int64 {
  583. id, err := u.ID(ctx)
  584. if err != nil {
  585. panic(err)
  586. }
  587. return id
  588. }
  589. // ChannelMonitorHistoryCreateBulk is the builder for creating many ChannelMonitorHistory entities in bulk.
  590. type ChannelMonitorHistoryCreateBulk struct {
  591. config
  592. err error
  593. builders []*ChannelMonitorHistoryCreate
  594. conflict []sql.ConflictOption
  595. }
  596. // Save creates the ChannelMonitorHistory entities in the database.
  597. func (_c *ChannelMonitorHistoryCreateBulk) Save(ctx context.Context) ([]*ChannelMonitorHistory, error) {
  598. if _c.err != nil {
  599. return nil, _c.err
  600. }
  601. specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
  602. nodes := make([]*ChannelMonitorHistory, len(_c.builders))
  603. mutators := make([]Mutator, len(_c.builders))
  604. for i := range _c.builders {
  605. func(i int, root context.Context) {
  606. builder := _c.builders[i]
  607. builder.defaults()
  608. var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
  609. mutation, ok := m.(*ChannelMonitorHistoryMutation)
  610. if !ok {
  611. return nil, fmt.Errorf("unexpected mutation type %T", m)
  612. }
  613. if err := builder.check(); err != nil {
  614. return nil, err
  615. }
  616. builder.mutation = mutation
  617. var err error
  618. nodes[i], specs[i] = builder.createSpec()
  619. if i < len(mutators)-1 {
  620. _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
  621. } else {
  622. spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
  623. spec.OnConflict = _c.conflict
  624. // Invoke the actual operation on the latest mutation in the chain.
  625. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
  626. if sqlgraph.IsConstraintError(err) {
  627. err = &ConstraintError{msg: err.Error(), wrap: err}
  628. }
  629. }
  630. }
  631. if err != nil {
  632. return nil, err
  633. }
  634. mutation.id = &nodes[i].ID
  635. if specs[i].ID.Value != nil {
  636. id := specs[i].ID.Value.(int64)
  637. nodes[i].ID = int64(id)
  638. }
  639. mutation.done = true
  640. return nodes[i], nil
  641. })
  642. for i := len(builder.hooks) - 1; i >= 0; i-- {
  643. mut = builder.hooks[i](mut)
  644. }
  645. mutators[i] = mut
  646. }(i, ctx)
  647. }
  648. if len(mutators) > 0 {
  649. if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
  650. return nil, err
  651. }
  652. }
  653. return nodes, nil
  654. }
  655. // SaveX is like Save, but panics if an error occurs.
  656. func (_c *ChannelMonitorHistoryCreateBulk) SaveX(ctx context.Context) []*ChannelMonitorHistory {
  657. v, err := _c.Save(ctx)
  658. if err != nil {
  659. panic(err)
  660. }
  661. return v
  662. }
  663. // Exec executes the query.
  664. func (_c *ChannelMonitorHistoryCreateBulk) Exec(ctx context.Context) error {
  665. _, err := _c.Save(ctx)
  666. return err
  667. }
  668. // ExecX is like Exec, but panics if an error occurs.
  669. func (_c *ChannelMonitorHistoryCreateBulk) ExecX(ctx context.Context) {
  670. if err := _c.Exec(ctx); err != nil {
  671. panic(err)
  672. }
  673. }
  674. // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
  675. // of the `INSERT` statement. For example:
  676. //
  677. // client.ChannelMonitorHistory.CreateBulk(builders...).
  678. // OnConflict(
  679. // // Update the row with the new values
  680. // // the was proposed for insertion.
  681. // sql.ResolveWithNewValues(),
  682. // ).
  683. // // Override some of the fields with custom
  684. // // update values.
  685. // Update(func(u *ent.ChannelMonitorHistoryUpsert) {
  686. // SetMonitorID(v+v).
  687. // }).
  688. // Exec(ctx)
  689. func (_c *ChannelMonitorHistoryCreateBulk) OnConflict(opts ...sql.ConflictOption) *ChannelMonitorHistoryUpsertBulk {
  690. _c.conflict = opts
  691. return &ChannelMonitorHistoryUpsertBulk{
  692. create: _c,
  693. }
  694. }
  695. // OnConflictColumns calls `OnConflict` and configures the columns
  696. // as conflict target. Using this option is equivalent to using:
  697. //
  698. // client.ChannelMonitorHistory.Create().
  699. // OnConflict(sql.ConflictColumns(columns...)).
  700. // Exec(ctx)
  701. func (_c *ChannelMonitorHistoryCreateBulk) OnConflictColumns(columns ...string) *ChannelMonitorHistoryUpsertBulk {
  702. _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
  703. return &ChannelMonitorHistoryUpsertBulk{
  704. create: _c,
  705. }
  706. }
  707. // ChannelMonitorHistoryUpsertBulk is the builder for "upsert"-ing
  708. // a bulk of ChannelMonitorHistory nodes.
  709. type ChannelMonitorHistoryUpsertBulk struct {
  710. create *ChannelMonitorHistoryCreateBulk
  711. }
  712. // UpdateNewValues updates the mutable fields using the new values that
  713. // were set on create. Using this option is equivalent to using:
  714. //
  715. // client.ChannelMonitorHistory.Create().
  716. // OnConflict(
  717. // sql.ResolveWithNewValues(),
  718. // ).
  719. // Exec(ctx)
  720. func (u *ChannelMonitorHistoryUpsertBulk) UpdateNewValues() *ChannelMonitorHistoryUpsertBulk {
  721. u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
  722. return u
  723. }
  724. // Ignore sets each column to itself in case of conflict.
  725. // Using this option is equivalent to using:
  726. //
  727. // client.ChannelMonitorHistory.Create().
  728. // OnConflict(sql.ResolveWithIgnore()).
  729. // Exec(ctx)
  730. func (u *ChannelMonitorHistoryUpsertBulk) Ignore() *ChannelMonitorHistoryUpsertBulk {
  731. u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
  732. return u
  733. }
  734. // DoNothing configures the conflict_action to `DO NOTHING`.
  735. // Supported only by SQLite and PostgreSQL.
  736. func (u *ChannelMonitorHistoryUpsertBulk) DoNothing() *ChannelMonitorHistoryUpsertBulk {
  737. u.create.conflict = append(u.create.conflict, sql.DoNothing())
  738. return u
  739. }
  740. // Update allows overriding fields `UPDATE` values. See the ChannelMonitorHistoryCreateBulk.OnConflict
  741. // documentation for more info.
  742. func (u *ChannelMonitorHistoryUpsertBulk) Update(set func(*ChannelMonitorHistoryUpsert)) *ChannelMonitorHistoryUpsertBulk {
  743. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
  744. set(&ChannelMonitorHistoryUpsert{UpdateSet: update})
  745. }))
  746. return u
  747. }
  748. // SetMonitorID sets the "monitor_id" field.
  749. func (u *ChannelMonitorHistoryUpsertBulk) SetMonitorID(v int64) *ChannelMonitorHistoryUpsertBulk {
  750. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  751. s.SetMonitorID(v)
  752. })
  753. }
  754. // UpdateMonitorID sets the "monitor_id" field to the value that was provided on create.
  755. func (u *ChannelMonitorHistoryUpsertBulk) UpdateMonitorID() *ChannelMonitorHistoryUpsertBulk {
  756. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  757. s.UpdateMonitorID()
  758. })
  759. }
  760. // SetModel sets the "model" field.
  761. func (u *ChannelMonitorHistoryUpsertBulk) SetModel(v string) *ChannelMonitorHistoryUpsertBulk {
  762. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  763. s.SetModel(v)
  764. })
  765. }
  766. // UpdateModel sets the "model" field to the value that was provided on create.
  767. func (u *ChannelMonitorHistoryUpsertBulk) UpdateModel() *ChannelMonitorHistoryUpsertBulk {
  768. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  769. s.UpdateModel()
  770. })
  771. }
  772. // SetStatus sets the "status" field.
  773. func (u *ChannelMonitorHistoryUpsertBulk) SetStatus(v channelmonitorhistory.Status) *ChannelMonitorHistoryUpsertBulk {
  774. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  775. s.SetStatus(v)
  776. })
  777. }
  778. // UpdateStatus sets the "status" field to the value that was provided on create.
  779. func (u *ChannelMonitorHistoryUpsertBulk) UpdateStatus() *ChannelMonitorHistoryUpsertBulk {
  780. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  781. s.UpdateStatus()
  782. })
  783. }
  784. // SetLatencyMs sets the "latency_ms" field.
  785. func (u *ChannelMonitorHistoryUpsertBulk) SetLatencyMs(v int) *ChannelMonitorHistoryUpsertBulk {
  786. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  787. s.SetLatencyMs(v)
  788. })
  789. }
  790. // AddLatencyMs adds v to the "latency_ms" field.
  791. func (u *ChannelMonitorHistoryUpsertBulk) AddLatencyMs(v int) *ChannelMonitorHistoryUpsertBulk {
  792. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  793. s.AddLatencyMs(v)
  794. })
  795. }
  796. // UpdateLatencyMs sets the "latency_ms" field to the value that was provided on create.
  797. func (u *ChannelMonitorHistoryUpsertBulk) UpdateLatencyMs() *ChannelMonitorHistoryUpsertBulk {
  798. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  799. s.UpdateLatencyMs()
  800. })
  801. }
  802. // ClearLatencyMs clears the value of the "latency_ms" field.
  803. func (u *ChannelMonitorHistoryUpsertBulk) ClearLatencyMs() *ChannelMonitorHistoryUpsertBulk {
  804. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  805. s.ClearLatencyMs()
  806. })
  807. }
  808. // SetPingLatencyMs sets the "ping_latency_ms" field.
  809. func (u *ChannelMonitorHistoryUpsertBulk) SetPingLatencyMs(v int) *ChannelMonitorHistoryUpsertBulk {
  810. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  811. s.SetPingLatencyMs(v)
  812. })
  813. }
  814. // AddPingLatencyMs adds v to the "ping_latency_ms" field.
  815. func (u *ChannelMonitorHistoryUpsertBulk) AddPingLatencyMs(v int) *ChannelMonitorHistoryUpsertBulk {
  816. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  817. s.AddPingLatencyMs(v)
  818. })
  819. }
  820. // UpdatePingLatencyMs sets the "ping_latency_ms" field to the value that was provided on create.
  821. func (u *ChannelMonitorHistoryUpsertBulk) UpdatePingLatencyMs() *ChannelMonitorHistoryUpsertBulk {
  822. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  823. s.UpdatePingLatencyMs()
  824. })
  825. }
  826. // ClearPingLatencyMs clears the value of the "ping_latency_ms" field.
  827. func (u *ChannelMonitorHistoryUpsertBulk) ClearPingLatencyMs() *ChannelMonitorHistoryUpsertBulk {
  828. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  829. s.ClearPingLatencyMs()
  830. })
  831. }
  832. // SetMessage sets the "message" field.
  833. func (u *ChannelMonitorHistoryUpsertBulk) SetMessage(v string) *ChannelMonitorHistoryUpsertBulk {
  834. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  835. s.SetMessage(v)
  836. })
  837. }
  838. // UpdateMessage sets the "message" field to the value that was provided on create.
  839. func (u *ChannelMonitorHistoryUpsertBulk) UpdateMessage() *ChannelMonitorHistoryUpsertBulk {
  840. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  841. s.UpdateMessage()
  842. })
  843. }
  844. // ClearMessage clears the value of the "message" field.
  845. func (u *ChannelMonitorHistoryUpsertBulk) ClearMessage() *ChannelMonitorHistoryUpsertBulk {
  846. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  847. s.ClearMessage()
  848. })
  849. }
  850. // SetQuota sets the "quota" field.
  851. func (u *ChannelMonitorHistoryUpsertBulk) SetQuota(v *domain.MonitorQuotaSnapshot) *ChannelMonitorHistoryUpsertBulk {
  852. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  853. s.SetQuota(v)
  854. })
  855. }
  856. // UpdateQuota sets the "quota" field to the value that was provided on create.
  857. func (u *ChannelMonitorHistoryUpsertBulk) UpdateQuota() *ChannelMonitorHistoryUpsertBulk {
  858. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  859. s.UpdateQuota()
  860. })
  861. }
  862. // ClearQuota clears the value of the "quota" field.
  863. func (u *ChannelMonitorHistoryUpsertBulk) ClearQuota() *ChannelMonitorHistoryUpsertBulk {
  864. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  865. s.ClearQuota()
  866. })
  867. }
  868. // SetCheckedAt sets the "checked_at" field.
  869. func (u *ChannelMonitorHistoryUpsertBulk) SetCheckedAt(v time.Time) *ChannelMonitorHistoryUpsertBulk {
  870. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  871. s.SetCheckedAt(v)
  872. })
  873. }
  874. // UpdateCheckedAt sets the "checked_at" field to the value that was provided on create.
  875. func (u *ChannelMonitorHistoryUpsertBulk) UpdateCheckedAt() *ChannelMonitorHistoryUpsertBulk {
  876. return u.Update(func(s *ChannelMonitorHistoryUpsert) {
  877. s.UpdateCheckedAt()
  878. })
  879. }
  880. // Exec executes the query.
  881. func (u *ChannelMonitorHistoryUpsertBulk) Exec(ctx context.Context) error {
  882. if u.create.err != nil {
  883. return u.create.err
  884. }
  885. for i, b := range u.create.builders {
  886. if len(b.conflict) != 0 {
  887. return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the ChannelMonitorHistoryCreateBulk instead", i)
  888. }
  889. }
  890. if len(u.create.conflict) == 0 {
  891. return errors.New("ent: missing options for ChannelMonitorHistoryCreateBulk.OnConflict")
  892. }
  893. return u.create.Exec(ctx)
  894. }
  895. // ExecX is like Exec, but panics if an error occurs.
  896. func (u *ChannelMonitorHistoryUpsertBulk) ExecX(ctx context.Context) {
  897. if err := u.create.Exec(ctx); err != nil {
  898. panic(err)
  899. }
  900. }