plc.directory mirror
1// Code generated by ent, DO NOT EDIT.
2
3package ent
4
5import (
6 "context"
7 "errors"
8 "fmt"
9 "time"
10
11 "entgo.io/ent/dialect/sql"
12 "entgo.io/ent/dialect/sql/sqlgraph"
13 "entgo.io/ent/schema/field"
14 "tangled.sh/seiso.moe/aletheia.directory/ent/operation"
15 "tangled.sh/seiso.moe/aletheia.directory/pkg/plc"
16)
17
18// OperationCreate is the builder for creating a Operation entity.
19type OperationCreate struct {
20 config
21 mutation *OperationMutation
22 hooks []Hook
23 conflict []sql.ConflictOption
24}
25
26// SetDid sets the "did" field.
27func (oc *OperationCreate) SetDid(s string) *OperationCreate {
28 oc.mutation.SetDid(s)
29 return oc
30}
31
32// SetOperation sets the "operation" field.
33func (oc *OperationCreate) SetOperation(po plc.PLCOperation) *OperationCreate {
34 oc.mutation.SetOperation(po)
35 return oc
36}
37
38// SetCid sets the "cid" field.
39func (oc *OperationCreate) SetCid(s string) *OperationCreate {
40 oc.mutation.SetCid(s)
41 return oc
42}
43
44// SetNullified sets the "nullified" field.
45func (oc *OperationCreate) SetNullified(b bool) *OperationCreate {
46 oc.mutation.SetNullified(b)
47 return oc
48}
49
50// SetNillableNullified sets the "nullified" field if the given value is not nil.
51func (oc *OperationCreate) SetNillableNullified(b *bool) *OperationCreate {
52 if b != nil {
53 oc.SetNullified(*b)
54 }
55 return oc
56}
57
58// SetCreatedAt sets the "created_at" field.
59func (oc *OperationCreate) SetCreatedAt(t time.Time) *OperationCreate {
60 oc.mutation.SetCreatedAt(t)
61 return oc
62}
63
64// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
65func (oc *OperationCreate) SetNillableCreatedAt(t *time.Time) *OperationCreate {
66 if t != nil {
67 oc.SetCreatedAt(*t)
68 }
69 return oc
70}
71
72// Mutation returns the OperationMutation object of the builder.
73func (oc *OperationCreate) Mutation() *OperationMutation {
74 return oc.mutation
75}
76
77// Save creates the Operation in the database.
78func (oc *OperationCreate) Save(ctx context.Context) (*Operation, error) {
79 oc.defaults()
80 return withHooks(ctx, oc.sqlSave, oc.mutation, oc.hooks)
81}
82
83// SaveX calls Save and panics if Save returns an error.
84func (oc *OperationCreate) SaveX(ctx context.Context) *Operation {
85 v, err := oc.Save(ctx)
86 if err != nil {
87 panic(err)
88 }
89 return v
90}
91
92// Exec executes the query.
93func (oc *OperationCreate) Exec(ctx context.Context) error {
94 _, err := oc.Save(ctx)
95 return err
96}
97
98// ExecX is like Exec, but panics if an error occurs.
99func (oc *OperationCreate) ExecX(ctx context.Context) {
100 if err := oc.Exec(ctx); err != nil {
101 panic(err)
102 }
103}
104
105// defaults sets the default values of the builder before save.
106func (oc *OperationCreate) defaults() {
107 if _, ok := oc.mutation.Nullified(); !ok {
108 v := operation.DefaultNullified
109 oc.mutation.SetNullified(v)
110 }
111 if _, ok := oc.mutation.CreatedAt(); !ok {
112 v := operation.DefaultCreatedAt()
113 oc.mutation.SetCreatedAt(v)
114 }
115}
116
117// check runs all checks and user-defined validators on the builder.
118func (oc *OperationCreate) check() error {
119 if _, ok := oc.mutation.Did(); !ok {
120 return &ValidationError{Name: "did", err: errors.New(`ent: missing required field "Operation.did"`)}
121 }
122 if v, ok := oc.mutation.Did(); ok {
123 if err := operation.DidValidator(v); err != nil {
124 return &ValidationError{Name: "did", err: fmt.Errorf(`ent: validator failed for field "Operation.did": %w`, err)}
125 }
126 }
127 if _, ok := oc.mutation.Operation(); !ok {
128 return &ValidationError{Name: "operation", err: errors.New(`ent: missing required field "Operation.operation"`)}
129 }
130 if _, ok := oc.mutation.Cid(); !ok {
131 return &ValidationError{Name: "cid", err: errors.New(`ent: missing required field "Operation.cid"`)}
132 }
133 if v, ok := oc.mutation.Cid(); ok {
134 if err := operation.CidValidator(v); err != nil {
135 return &ValidationError{Name: "cid", err: fmt.Errorf(`ent: validator failed for field "Operation.cid": %w`, err)}
136 }
137 }
138 if _, ok := oc.mutation.Nullified(); !ok {
139 return &ValidationError{Name: "nullified", err: errors.New(`ent: missing required field "Operation.nullified"`)}
140 }
141 if _, ok := oc.mutation.CreatedAt(); !ok {
142 return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Operation.created_at"`)}
143 }
144 return nil
145}
146
147func (oc *OperationCreate) sqlSave(ctx context.Context) (*Operation, error) {
148 if err := oc.check(); err != nil {
149 return nil, err
150 }
151 _node, _spec := oc.createSpec()
152 if err := sqlgraph.CreateNode(ctx, oc.driver, _spec); err != nil {
153 if sqlgraph.IsConstraintError(err) {
154 err = &ConstraintError{msg: err.Error(), wrap: err}
155 }
156 return nil, err
157 }
158 id := _spec.ID.Value.(int64)
159 _node.ID = int(id)
160 oc.mutation.id = &_node.ID
161 oc.mutation.done = true
162 return _node, nil
163}
164
165func (oc *OperationCreate) createSpec() (*Operation, *sqlgraph.CreateSpec) {
166 var (
167 _node = &Operation{config: oc.config}
168 _spec = sqlgraph.NewCreateSpec(operation.Table, sqlgraph.NewFieldSpec(operation.FieldID, field.TypeInt))
169 )
170 _spec.OnConflict = oc.conflict
171 if value, ok := oc.mutation.Did(); ok {
172 _spec.SetField(operation.FieldDid, field.TypeString, value)
173 _node.Did = value
174 }
175 if value, ok := oc.mutation.Operation(); ok {
176 _spec.SetField(operation.FieldOperation, field.TypeJSON, value)
177 _node.Operation = value
178 }
179 if value, ok := oc.mutation.Cid(); ok {
180 _spec.SetField(operation.FieldCid, field.TypeString, value)
181 _node.Cid = value
182 }
183 if value, ok := oc.mutation.Nullified(); ok {
184 _spec.SetField(operation.FieldNullified, field.TypeBool, value)
185 _node.Nullified = value
186 }
187 if value, ok := oc.mutation.CreatedAt(); ok {
188 _spec.SetField(operation.FieldCreatedAt, field.TypeTime, value)
189 _node.CreatedAt = value
190 }
191 return _node, _spec
192}
193
194// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
195// of the `INSERT` statement. For example:
196//
197// client.Operation.Create().
198// SetDid(v).
199// OnConflict(
200// // Update the row with the new values
201// // the was proposed for insertion.
202// sql.ResolveWithNewValues(),
203// ).
204// // Override some of the fields with custom
205// // update values.
206// Update(func(u *ent.OperationUpsert) {
207// SetDid(v+v).
208// }).
209// Exec(ctx)
210func (oc *OperationCreate) OnConflict(opts ...sql.ConflictOption) *OperationUpsertOne {
211 oc.conflict = opts
212 return &OperationUpsertOne{
213 create: oc,
214 }
215}
216
217// OnConflictColumns calls `OnConflict` and configures the columns
218// as conflict target. Using this option is equivalent to using:
219//
220// client.Operation.Create().
221// OnConflict(sql.ConflictColumns(columns...)).
222// Exec(ctx)
223func (oc *OperationCreate) OnConflictColumns(columns ...string) *OperationUpsertOne {
224 oc.conflict = append(oc.conflict, sql.ConflictColumns(columns...))
225 return &OperationUpsertOne{
226 create: oc,
227 }
228}
229
230type (
231 // OperationUpsertOne is the builder for "upsert"-ing
232 // one Operation node.
233 OperationUpsertOne struct {
234 create *OperationCreate
235 }
236
237 // OperationUpsert is the "OnConflict" setter.
238 OperationUpsert struct {
239 *sql.UpdateSet
240 }
241)
242
243// SetDid sets the "did" field.
244func (u *OperationUpsert) SetDid(v string) *OperationUpsert {
245 u.Set(operation.FieldDid, v)
246 return u
247}
248
249// UpdateDid sets the "did" field to the value that was provided on create.
250func (u *OperationUpsert) UpdateDid() *OperationUpsert {
251 u.SetExcluded(operation.FieldDid)
252 return u
253}
254
255// SetOperation sets the "operation" field.
256func (u *OperationUpsert) SetOperation(v plc.PLCOperation) *OperationUpsert {
257 u.Set(operation.FieldOperation, v)
258 return u
259}
260
261// UpdateOperation sets the "operation" field to the value that was provided on create.
262func (u *OperationUpsert) UpdateOperation() *OperationUpsert {
263 u.SetExcluded(operation.FieldOperation)
264 return u
265}
266
267// SetCid sets the "cid" field.
268func (u *OperationUpsert) SetCid(v string) *OperationUpsert {
269 u.Set(operation.FieldCid, v)
270 return u
271}
272
273// UpdateCid sets the "cid" field to the value that was provided on create.
274func (u *OperationUpsert) UpdateCid() *OperationUpsert {
275 u.SetExcluded(operation.FieldCid)
276 return u
277}
278
279// SetNullified sets the "nullified" field.
280func (u *OperationUpsert) SetNullified(v bool) *OperationUpsert {
281 u.Set(operation.FieldNullified, v)
282 return u
283}
284
285// UpdateNullified sets the "nullified" field to the value that was provided on create.
286func (u *OperationUpsert) UpdateNullified() *OperationUpsert {
287 u.SetExcluded(operation.FieldNullified)
288 return u
289}
290
291// SetCreatedAt sets the "created_at" field.
292func (u *OperationUpsert) SetCreatedAt(v time.Time) *OperationUpsert {
293 u.Set(operation.FieldCreatedAt, v)
294 return u
295}
296
297// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
298func (u *OperationUpsert) UpdateCreatedAt() *OperationUpsert {
299 u.SetExcluded(operation.FieldCreatedAt)
300 return u
301}
302
303// UpdateNewValues updates the mutable fields using the new values that were set on create.
304// Using this option is equivalent to using:
305//
306// client.Operation.Create().
307// OnConflict(
308// sql.ResolveWithNewValues(),
309// ).
310// Exec(ctx)
311func (u *OperationUpsertOne) UpdateNewValues() *OperationUpsertOne {
312 u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
313 return u
314}
315
316// Ignore sets each column to itself in case of conflict.
317// Using this option is equivalent to using:
318//
319// client.Operation.Create().
320// OnConflict(sql.ResolveWithIgnore()).
321// Exec(ctx)
322func (u *OperationUpsertOne) Ignore() *OperationUpsertOne {
323 u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
324 return u
325}
326
327// DoNothing configures the conflict_action to `DO NOTHING`.
328// Supported only by SQLite and PostgreSQL.
329func (u *OperationUpsertOne) DoNothing() *OperationUpsertOne {
330 u.create.conflict = append(u.create.conflict, sql.DoNothing())
331 return u
332}
333
334// Update allows overriding fields `UPDATE` values. See the OperationCreate.OnConflict
335// documentation for more info.
336func (u *OperationUpsertOne) Update(set func(*OperationUpsert)) *OperationUpsertOne {
337 u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
338 set(&OperationUpsert{UpdateSet: update})
339 }))
340 return u
341}
342
343// SetDid sets the "did" field.
344func (u *OperationUpsertOne) SetDid(v string) *OperationUpsertOne {
345 return u.Update(func(s *OperationUpsert) {
346 s.SetDid(v)
347 })
348}
349
350// UpdateDid sets the "did" field to the value that was provided on create.
351func (u *OperationUpsertOne) UpdateDid() *OperationUpsertOne {
352 return u.Update(func(s *OperationUpsert) {
353 s.UpdateDid()
354 })
355}
356
357// SetOperation sets the "operation" field.
358func (u *OperationUpsertOne) SetOperation(v plc.PLCOperation) *OperationUpsertOne {
359 return u.Update(func(s *OperationUpsert) {
360 s.SetOperation(v)
361 })
362}
363
364// UpdateOperation sets the "operation" field to the value that was provided on create.
365func (u *OperationUpsertOne) UpdateOperation() *OperationUpsertOne {
366 return u.Update(func(s *OperationUpsert) {
367 s.UpdateOperation()
368 })
369}
370
371// SetCid sets the "cid" field.
372func (u *OperationUpsertOne) SetCid(v string) *OperationUpsertOne {
373 return u.Update(func(s *OperationUpsert) {
374 s.SetCid(v)
375 })
376}
377
378// UpdateCid sets the "cid" field to the value that was provided on create.
379func (u *OperationUpsertOne) UpdateCid() *OperationUpsertOne {
380 return u.Update(func(s *OperationUpsert) {
381 s.UpdateCid()
382 })
383}
384
385// SetNullified sets the "nullified" field.
386func (u *OperationUpsertOne) SetNullified(v bool) *OperationUpsertOne {
387 return u.Update(func(s *OperationUpsert) {
388 s.SetNullified(v)
389 })
390}
391
392// UpdateNullified sets the "nullified" field to the value that was provided on create.
393func (u *OperationUpsertOne) UpdateNullified() *OperationUpsertOne {
394 return u.Update(func(s *OperationUpsert) {
395 s.UpdateNullified()
396 })
397}
398
399// SetCreatedAt sets the "created_at" field.
400func (u *OperationUpsertOne) SetCreatedAt(v time.Time) *OperationUpsertOne {
401 return u.Update(func(s *OperationUpsert) {
402 s.SetCreatedAt(v)
403 })
404}
405
406// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
407func (u *OperationUpsertOne) UpdateCreatedAt() *OperationUpsertOne {
408 return u.Update(func(s *OperationUpsert) {
409 s.UpdateCreatedAt()
410 })
411}
412
413// Exec executes the query.
414func (u *OperationUpsertOne) Exec(ctx context.Context) error {
415 if len(u.create.conflict) == 0 {
416 return errors.New("ent: missing options for OperationCreate.OnConflict")
417 }
418 return u.create.Exec(ctx)
419}
420
421// ExecX is like Exec, but panics if an error occurs.
422func (u *OperationUpsertOne) ExecX(ctx context.Context) {
423 if err := u.create.Exec(ctx); err != nil {
424 panic(err)
425 }
426}
427
428// Exec executes the UPSERT query and returns the inserted/updated ID.
429func (u *OperationUpsertOne) ID(ctx context.Context) (id int, err error) {
430 node, err := u.create.Save(ctx)
431 if err != nil {
432 return id, err
433 }
434 return node.ID, nil
435}
436
437// IDX is like ID, but panics if an error occurs.
438func (u *OperationUpsertOne) IDX(ctx context.Context) int {
439 id, err := u.ID(ctx)
440 if err != nil {
441 panic(err)
442 }
443 return id
444}
445
446// OperationCreateBulk is the builder for creating many Operation entities in bulk.
447type OperationCreateBulk struct {
448 config
449 err error
450 builders []*OperationCreate
451 conflict []sql.ConflictOption
452}
453
454// Save creates the Operation entities in the database.
455func (ocb *OperationCreateBulk) Save(ctx context.Context) ([]*Operation, error) {
456 if ocb.err != nil {
457 return nil, ocb.err
458 }
459 specs := make([]*sqlgraph.CreateSpec, len(ocb.builders))
460 nodes := make([]*Operation, len(ocb.builders))
461 mutators := make([]Mutator, len(ocb.builders))
462 for i := range ocb.builders {
463 func(i int, root context.Context) {
464 builder := ocb.builders[i]
465 builder.defaults()
466 var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
467 mutation, ok := m.(*OperationMutation)
468 if !ok {
469 return nil, fmt.Errorf("unexpected mutation type %T", m)
470 }
471 if err := builder.check(); err != nil {
472 return nil, err
473 }
474 builder.mutation = mutation
475 var err error
476 nodes[i], specs[i] = builder.createSpec()
477 if i < len(mutators)-1 {
478 _, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation)
479 } else {
480 spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
481 spec.OnConflict = ocb.conflict
482 // Invoke the actual operation on the latest mutation in the chain.
483 if err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil {
484 if sqlgraph.IsConstraintError(err) {
485 err = &ConstraintError{msg: err.Error(), wrap: err}
486 }
487 }
488 }
489 if err != nil {
490 return nil, err
491 }
492 mutation.id = &nodes[i].ID
493 if specs[i].ID.Value != nil {
494 id := specs[i].ID.Value.(int64)
495 nodes[i].ID = int(id)
496 }
497 mutation.done = true
498 return nodes[i], nil
499 })
500 for i := len(builder.hooks) - 1; i >= 0; i-- {
501 mut = builder.hooks[i](mut)
502 }
503 mutators[i] = mut
504 }(i, ctx)
505 }
506 if len(mutators) > 0 {
507 if _, err := mutators[0].Mutate(ctx, ocb.builders[0].mutation); err != nil {
508 return nil, err
509 }
510 }
511 return nodes, nil
512}
513
514// SaveX is like Save, but panics if an error occurs.
515func (ocb *OperationCreateBulk) SaveX(ctx context.Context) []*Operation {
516 v, err := ocb.Save(ctx)
517 if err != nil {
518 panic(err)
519 }
520 return v
521}
522
523// Exec executes the query.
524func (ocb *OperationCreateBulk) Exec(ctx context.Context) error {
525 _, err := ocb.Save(ctx)
526 return err
527}
528
529// ExecX is like Exec, but panics if an error occurs.
530func (ocb *OperationCreateBulk) ExecX(ctx context.Context) {
531 if err := ocb.Exec(ctx); err != nil {
532 panic(err)
533 }
534}
535
536// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
537// of the `INSERT` statement. For example:
538//
539// client.Operation.CreateBulk(builders...).
540// OnConflict(
541// // Update the row with the new values
542// // the was proposed for insertion.
543// sql.ResolveWithNewValues(),
544// ).
545// // Override some of the fields with custom
546// // update values.
547// Update(func(u *ent.OperationUpsert) {
548// SetDid(v+v).
549// }).
550// Exec(ctx)
551func (ocb *OperationCreateBulk) OnConflict(opts ...sql.ConflictOption) *OperationUpsertBulk {
552 ocb.conflict = opts
553 return &OperationUpsertBulk{
554 create: ocb,
555 }
556}
557
558// OnConflictColumns calls `OnConflict` and configures the columns
559// as conflict target. Using this option is equivalent to using:
560//
561// client.Operation.Create().
562// OnConflict(sql.ConflictColumns(columns...)).
563// Exec(ctx)
564func (ocb *OperationCreateBulk) OnConflictColumns(columns ...string) *OperationUpsertBulk {
565 ocb.conflict = append(ocb.conflict, sql.ConflictColumns(columns...))
566 return &OperationUpsertBulk{
567 create: ocb,
568 }
569}
570
571// OperationUpsertBulk is the builder for "upsert"-ing
572// a bulk of Operation nodes.
573type OperationUpsertBulk struct {
574 create *OperationCreateBulk
575}
576
577// UpdateNewValues updates the mutable fields using the new values that
578// were set on create. Using this option is equivalent to using:
579//
580// client.Operation.Create().
581// OnConflict(
582// sql.ResolveWithNewValues(),
583// ).
584// Exec(ctx)
585func (u *OperationUpsertBulk) UpdateNewValues() *OperationUpsertBulk {
586 u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
587 return u
588}
589
590// Ignore sets each column to itself in case of conflict.
591// Using this option is equivalent to using:
592//
593// client.Operation.Create().
594// OnConflict(sql.ResolveWithIgnore()).
595// Exec(ctx)
596func (u *OperationUpsertBulk) Ignore() *OperationUpsertBulk {
597 u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
598 return u
599}
600
601// DoNothing configures the conflict_action to `DO NOTHING`.
602// Supported only by SQLite and PostgreSQL.
603func (u *OperationUpsertBulk) DoNothing() *OperationUpsertBulk {
604 u.create.conflict = append(u.create.conflict, sql.DoNothing())
605 return u
606}
607
608// Update allows overriding fields `UPDATE` values. See the OperationCreateBulk.OnConflict
609// documentation for more info.
610func (u *OperationUpsertBulk) Update(set func(*OperationUpsert)) *OperationUpsertBulk {
611 u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
612 set(&OperationUpsert{UpdateSet: update})
613 }))
614 return u
615}
616
617// SetDid sets the "did" field.
618func (u *OperationUpsertBulk) SetDid(v string) *OperationUpsertBulk {
619 return u.Update(func(s *OperationUpsert) {
620 s.SetDid(v)
621 })
622}
623
624// UpdateDid sets the "did" field to the value that was provided on create.
625func (u *OperationUpsertBulk) UpdateDid() *OperationUpsertBulk {
626 return u.Update(func(s *OperationUpsert) {
627 s.UpdateDid()
628 })
629}
630
631// SetOperation sets the "operation" field.
632func (u *OperationUpsertBulk) SetOperation(v plc.PLCOperation) *OperationUpsertBulk {
633 return u.Update(func(s *OperationUpsert) {
634 s.SetOperation(v)
635 })
636}
637
638// UpdateOperation sets the "operation" field to the value that was provided on create.
639func (u *OperationUpsertBulk) UpdateOperation() *OperationUpsertBulk {
640 return u.Update(func(s *OperationUpsert) {
641 s.UpdateOperation()
642 })
643}
644
645// SetCid sets the "cid" field.
646func (u *OperationUpsertBulk) SetCid(v string) *OperationUpsertBulk {
647 return u.Update(func(s *OperationUpsert) {
648 s.SetCid(v)
649 })
650}
651
652// UpdateCid sets the "cid" field to the value that was provided on create.
653func (u *OperationUpsertBulk) UpdateCid() *OperationUpsertBulk {
654 return u.Update(func(s *OperationUpsert) {
655 s.UpdateCid()
656 })
657}
658
659// SetNullified sets the "nullified" field.
660func (u *OperationUpsertBulk) SetNullified(v bool) *OperationUpsertBulk {
661 return u.Update(func(s *OperationUpsert) {
662 s.SetNullified(v)
663 })
664}
665
666// UpdateNullified sets the "nullified" field to the value that was provided on create.
667func (u *OperationUpsertBulk) UpdateNullified() *OperationUpsertBulk {
668 return u.Update(func(s *OperationUpsert) {
669 s.UpdateNullified()
670 })
671}
672
673// SetCreatedAt sets the "created_at" field.
674func (u *OperationUpsertBulk) SetCreatedAt(v time.Time) *OperationUpsertBulk {
675 return u.Update(func(s *OperationUpsert) {
676 s.SetCreatedAt(v)
677 })
678}
679
680// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
681func (u *OperationUpsertBulk) UpdateCreatedAt() *OperationUpsertBulk {
682 return u.Update(func(s *OperationUpsert) {
683 s.UpdateCreatedAt()
684 })
685}
686
687// Exec executes the query.
688func (u *OperationUpsertBulk) Exec(ctx context.Context) error {
689 if u.create.err != nil {
690 return u.create.err
691 }
692 for i, b := range u.create.builders {
693 if len(b.conflict) != 0 {
694 return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the OperationCreateBulk instead", i)
695 }
696 }
697 if len(u.create.conflict) == 0 {
698 return errors.New("ent: missing options for OperationCreateBulk.OnConflict")
699 }
700 return u.create.Exec(ctx)
701}
702
703// ExecX is like Exec, but panics if an error occurs.
704func (u *OperationUpsertBulk) ExecX(ctx context.Context) {
705 if err := u.create.Exec(ctx); err != nil {
706 panic(err)
707 }
708}