// Code generated by ent, DO NOT EDIT. package ent import ( "bj_power_wms/ent/inspectiondisposalitem" "context" "errors" "fmt" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" ) // InspectionDisposalItemCreate is the builder for creating a InspectionDisposalItem entity. type InspectionDisposalItemCreate struct { config mutation *InspectionDisposalItemMutation hooks []Hook conflict []sql.ConflictOption } // SetRecordID sets the "record_id" field. func (_c *InspectionDisposalItemCreate) SetRecordID(v int64) *InspectionDisposalItemCreate { _c.mutation.SetRecordID(v) return _c } // SetDisposeType sets the "dispose_type" field. func (_c *InspectionDisposalItemCreate) SetDisposeType(v string) *InspectionDisposalItemCreate { _c.mutation.SetDisposeType(v) return _c } // SetQty sets the "qty" field. func (_c *InspectionDisposalItemCreate) SetQty(v int) *InspectionDisposalItemCreate { _c.mutation.SetQty(v) return _c } // SetRemark sets the "remark" field. func (_c *InspectionDisposalItemCreate) SetRemark(v string) *InspectionDisposalItemCreate { _c.mutation.SetRemark(v) return _c } // SetNillableRemark sets the "remark" field if the given value is not nil. func (_c *InspectionDisposalItemCreate) SetNillableRemark(v *string) *InspectionDisposalItemCreate { if v != nil { _c.SetRemark(*v) } return _c } // SetOperator sets the "operator" field. func (_c *InspectionDisposalItemCreate) SetOperator(v string) *InspectionDisposalItemCreate { _c.mutation.SetOperator(v) return _c } // SetNillableOperator sets the "operator" field if the given value is not nil. func (_c *InspectionDisposalItemCreate) SetNillableOperator(v *string) *InspectionDisposalItemCreate { if v != nil { _c.SetOperator(*v) } return _c } // SetCreatedAt sets the "created_at" field. func (_c *InspectionDisposalItemCreate) SetCreatedAt(v int64) *InspectionDisposalItemCreate { _c.mutation.SetCreatedAt(v) return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. func (_c *InspectionDisposalItemCreate) SetNillableCreatedAt(v *int64) *InspectionDisposalItemCreate { if v != nil { _c.SetCreatedAt(*v) } return _c } // Mutation returns the InspectionDisposalItemMutation object of the builder. func (_c *InspectionDisposalItemCreate) Mutation() *InspectionDisposalItemMutation { return _c.mutation } // Save creates the InspectionDisposalItem in the database. func (_c *InspectionDisposalItemCreate) Save(ctx context.Context) (*InspectionDisposalItem, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *InspectionDisposalItemCreate) SaveX(ctx context.Context) *InspectionDisposalItem { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *InspectionDisposalItemCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *InspectionDisposalItemCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *InspectionDisposalItemCreate) defaults() { if _, ok := _c.mutation.Operator(); !ok { v := inspectiondisposalitem.DefaultOperator _c.mutation.SetOperator(v) } if _, ok := _c.mutation.CreatedAt(); !ok { v := inspectiondisposalitem.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } } // check runs all checks and user-defined validators on the builder. func (_c *InspectionDisposalItemCreate) check() error { if _, ok := _c.mutation.RecordID(); !ok { return &ValidationError{Name: "record_id", err: errors.New(`ent: missing required field "InspectionDisposalItem.record_id"`)} } if _, ok := _c.mutation.DisposeType(); !ok { return &ValidationError{Name: "dispose_type", err: errors.New(`ent: missing required field "InspectionDisposalItem.dispose_type"`)} } if _, ok := _c.mutation.Qty(); !ok { return &ValidationError{Name: "qty", err: errors.New(`ent: missing required field "InspectionDisposalItem.qty"`)} } if v, ok := _c.mutation.Qty(); ok { if err := inspectiondisposalitem.QtyValidator(v); err != nil { return &ValidationError{Name: "qty", err: fmt.Errorf(`ent: validator failed for field "InspectionDisposalItem.qty": %w`, err)} } } if _, ok := _c.mutation.Operator(); !ok { return &ValidationError{Name: "operator", err: errors.New(`ent: missing required field "InspectionDisposalItem.operator"`)} } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "InspectionDisposalItem.created_at"`)} } return nil } func (_c *InspectionDisposalItemCreate) sqlSave(ctx context.Context) (*InspectionDisposalItem, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } id := _spec.ID.Value.(int64) _node.ID = int(id) _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *InspectionDisposalItemCreate) createSpec() (*InspectionDisposalItem, *sqlgraph.CreateSpec) { var ( _node = &InspectionDisposalItem{config: _c.config} _spec = sqlgraph.NewCreateSpec(inspectiondisposalitem.Table, sqlgraph.NewFieldSpec(inspectiondisposalitem.FieldID, field.TypeInt)) ) _spec.OnConflict = _c.conflict if value, ok := _c.mutation.RecordID(); ok { _spec.SetField(inspectiondisposalitem.FieldRecordID, field.TypeInt64, value) _node.RecordID = value } if value, ok := _c.mutation.DisposeType(); ok { _spec.SetField(inspectiondisposalitem.FieldDisposeType, field.TypeString, value) _node.DisposeType = value } if value, ok := _c.mutation.Qty(); ok { _spec.SetField(inspectiondisposalitem.FieldQty, field.TypeInt, value) _node.Qty = value } if value, ok := _c.mutation.Remark(); ok { _spec.SetField(inspectiondisposalitem.FieldRemark, field.TypeString, value) _node.Remark = value } if value, ok := _c.mutation.Operator(); ok { _spec.SetField(inspectiondisposalitem.FieldOperator, field.TypeString, value) _node.Operator = value } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(inspectiondisposalitem.FieldCreatedAt, field.TypeInt64, value) _node.CreatedAt = value } return _node, _spec } // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause // of the `INSERT` statement. For example: // // client.InspectionDisposalItem.Create(). // SetRecordID(v). // OnConflict( // // Update the row with the new values // // the was proposed for insertion. // sql.ResolveWithNewValues(), // ). // // Override some of the fields with custom // // update values. // Update(func(u *ent.InspectionDisposalItemUpsert) { // SetRecordID(v+v). // }). // Exec(ctx) func (_c *InspectionDisposalItemCreate) OnConflict(opts ...sql.ConflictOption) *InspectionDisposalItemUpsertOne { _c.conflict = opts return &InspectionDisposalItemUpsertOne{ create: _c, } } // OnConflictColumns calls `OnConflict` and configures the columns // as conflict target. Using this option is equivalent to using: // // client.InspectionDisposalItem.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) func (_c *InspectionDisposalItemCreate) OnConflictColumns(columns ...string) *InspectionDisposalItemUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &InspectionDisposalItemUpsertOne{ create: _c, } } type ( // InspectionDisposalItemUpsertOne is the builder for "upsert"-ing // one InspectionDisposalItem node. InspectionDisposalItemUpsertOne struct { create *InspectionDisposalItemCreate } // InspectionDisposalItemUpsert is the "OnConflict" setter. InspectionDisposalItemUpsert struct { *sql.UpdateSet } ) // SetRecordID sets the "record_id" field. func (u *InspectionDisposalItemUpsert) SetRecordID(v int64) *InspectionDisposalItemUpsert { u.Set(inspectiondisposalitem.FieldRecordID, v) return u } // UpdateRecordID sets the "record_id" field to the value that was provided on create. func (u *InspectionDisposalItemUpsert) UpdateRecordID() *InspectionDisposalItemUpsert { u.SetExcluded(inspectiondisposalitem.FieldRecordID) return u } // AddRecordID adds v to the "record_id" field. func (u *InspectionDisposalItemUpsert) AddRecordID(v int64) *InspectionDisposalItemUpsert { u.Add(inspectiondisposalitem.FieldRecordID, v) return u } // SetDisposeType sets the "dispose_type" field. func (u *InspectionDisposalItemUpsert) SetDisposeType(v string) *InspectionDisposalItemUpsert { u.Set(inspectiondisposalitem.FieldDisposeType, v) return u } // UpdateDisposeType sets the "dispose_type" field to the value that was provided on create. func (u *InspectionDisposalItemUpsert) UpdateDisposeType() *InspectionDisposalItemUpsert { u.SetExcluded(inspectiondisposalitem.FieldDisposeType) return u } // SetQty sets the "qty" field. func (u *InspectionDisposalItemUpsert) SetQty(v int) *InspectionDisposalItemUpsert { u.Set(inspectiondisposalitem.FieldQty, v) return u } // UpdateQty sets the "qty" field to the value that was provided on create. func (u *InspectionDisposalItemUpsert) UpdateQty() *InspectionDisposalItemUpsert { u.SetExcluded(inspectiondisposalitem.FieldQty) return u } // AddQty adds v to the "qty" field. func (u *InspectionDisposalItemUpsert) AddQty(v int) *InspectionDisposalItemUpsert { u.Add(inspectiondisposalitem.FieldQty, v) return u } // SetRemark sets the "remark" field. func (u *InspectionDisposalItemUpsert) SetRemark(v string) *InspectionDisposalItemUpsert { u.Set(inspectiondisposalitem.FieldRemark, v) return u } // UpdateRemark sets the "remark" field to the value that was provided on create. func (u *InspectionDisposalItemUpsert) UpdateRemark() *InspectionDisposalItemUpsert { u.SetExcluded(inspectiondisposalitem.FieldRemark) return u } // ClearRemark clears the value of the "remark" field. func (u *InspectionDisposalItemUpsert) ClearRemark() *InspectionDisposalItemUpsert { u.SetNull(inspectiondisposalitem.FieldRemark) return u } // SetOperator sets the "operator" field. func (u *InspectionDisposalItemUpsert) SetOperator(v string) *InspectionDisposalItemUpsert { u.Set(inspectiondisposalitem.FieldOperator, v) return u } // UpdateOperator sets the "operator" field to the value that was provided on create. func (u *InspectionDisposalItemUpsert) UpdateOperator() *InspectionDisposalItemUpsert { u.SetExcluded(inspectiondisposalitem.FieldOperator) return u } // SetCreatedAt sets the "created_at" field. func (u *InspectionDisposalItemUpsert) SetCreatedAt(v int64) *InspectionDisposalItemUpsert { u.Set(inspectiondisposalitem.FieldCreatedAt, v) return u } // UpdateCreatedAt sets the "created_at" field to the value that was provided on create. func (u *InspectionDisposalItemUpsert) UpdateCreatedAt() *InspectionDisposalItemUpsert { u.SetExcluded(inspectiondisposalitem.FieldCreatedAt) return u } // AddCreatedAt adds v to the "created_at" field. func (u *InspectionDisposalItemUpsert) AddCreatedAt(v int64) *InspectionDisposalItemUpsert { u.Add(inspectiondisposalitem.FieldCreatedAt, v) return u } // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // // client.InspectionDisposalItem.Create(). // OnConflict( // sql.ResolveWithNewValues(), // ). // Exec(ctx) func (u *InspectionDisposalItemUpsertOne) UpdateNewValues() *InspectionDisposalItemUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) return u } // Ignore sets each column to itself in case of conflict. // Using this option is equivalent to using: // // client.InspectionDisposalItem.Create(). // OnConflict(sql.ResolveWithIgnore()). // Exec(ctx) func (u *InspectionDisposalItemUpsertOne) Ignore() *InspectionDisposalItemUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u } // DoNothing configures the conflict_action to `DO NOTHING`. // Supported only by SQLite and PostgreSQL. func (u *InspectionDisposalItemUpsertOne) DoNothing() *InspectionDisposalItemUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u } // Update allows overriding fields `UPDATE` values. See the InspectionDisposalItemCreate.OnConflict // documentation for more info. func (u *InspectionDisposalItemUpsertOne) Update(set func(*InspectionDisposalItemUpsert)) *InspectionDisposalItemUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&InspectionDisposalItemUpsert{UpdateSet: update}) })) return u } // SetRecordID sets the "record_id" field. func (u *InspectionDisposalItemUpsertOne) SetRecordID(v int64) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetRecordID(v) }) } // AddRecordID adds v to the "record_id" field. func (u *InspectionDisposalItemUpsertOne) AddRecordID(v int64) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.AddRecordID(v) }) } // UpdateRecordID sets the "record_id" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertOne) UpdateRecordID() *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateRecordID() }) } // SetDisposeType sets the "dispose_type" field. func (u *InspectionDisposalItemUpsertOne) SetDisposeType(v string) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetDisposeType(v) }) } // UpdateDisposeType sets the "dispose_type" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertOne) UpdateDisposeType() *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateDisposeType() }) } // SetQty sets the "qty" field. func (u *InspectionDisposalItemUpsertOne) SetQty(v int) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetQty(v) }) } // AddQty adds v to the "qty" field. func (u *InspectionDisposalItemUpsertOne) AddQty(v int) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.AddQty(v) }) } // UpdateQty sets the "qty" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertOne) UpdateQty() *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateQty() }) } // SetRemark sets the "remark" field. func (u *InspectionDisposalItemUpsertOne) SetRemark(v string) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetRemark(v) }) } // UpdateRemark sets the "remark" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertOne) UpdateRemark() *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateRemark() }) } // ClearRemark clears the value of the "remark" field. func (u *InspectionDisposalItemUpsertOne) ClearRemark() *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.ClearRemark() }) } // SetOperator sets the "operator" field. func (u *InspectionDisposalItemUpsertOne) SetOperator(v string) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetOperator(v) }) } // UpdateOperator sets the "operator" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertOne) UpdateOperator() *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateOperator() }) } // SetCreatedAt sets the "created_at" field. func (u *InspectionDisposalItemUpsertOne) SetCreatedAt(v int64) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetCreatedAt(v) }) } // AddCreatedAt adds v to the "created_at" field. func (u *InspectionDisposalItemUpsertOne) AddCreatedAt(v int64) *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.AddCreatedAt(v) }) } // UpdateCreatedAt sets the "created_at" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertOne) UpdateCreatedAt() *InspectionDisposalItemUpsertOne { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateCreatedAt() }) } // Exec executes the query. func (u *InspectionDisposalItemUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("ent: missing options for InspectionDisposalItemCreate.OnConflict") } return u.create.Exec(ctx) } // ExecX is like Exec, but panics if an error occurs. func (u *InspectionDisposalItemUpsertOne) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) } } // Exec executes the UPSERT query and returns the inserted/updated ID. func (u *InspectionDisposalItemUpsertOne) ID(ctx context.Context) (id int, err error) { node, err := u.create.Save(ctx) if err != nil { return id, err } return node.ID, nil } // IDX is like ID, but panics if an error occurs. func (u *InspectionDisposalItemUpsertOne) IDX(ctx context.Context) int { id, err := u.ID(ctx) if err != nil { panic(err) } return id } // InspectionDisposalItemCreateBulk is the builder for creating many InspectionDisposalItem entities in bulk. type InspectionDisposalItemCreateBulk struct { config err error builders []*InspectionDisposalItemCreate conflict []sql.ConflictOption } // Save creates the InspectionDisposalItem entities in the database. func (_c *InspectionDisposalItemCreateBulk) Save(ctx context.Context) ([]*InspectionDisposalItem, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*InspectionDisposalItem, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*InspectionDisposalItemMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } } } if err != nil { return nil, err } mutation.id = &nodes[i].ID if specs[i].ID.Value != nil { id := specs[i].ID.Value.(int64) nodes[i].ID = int(id) } mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { mut = builder.hooks[i](mut) } mutators[i] = mut }(i, ctx) } if len(mutators) > 0 { if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *InspectionDisposalItemCreateBulk) SaveX(ctx context.Context) []*InspectionDisposalItem { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *InspectionDisposalItemCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *InspectionDisposalItemCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause // of the `INSERT` statement. For example: // // client.InspectionDisposalItem.CreateBulk(builders...). // OnConflict( // // Update the row with the new values // // the was proposed for insertion. // sql.ResolveWithNewValues(), // ). // // Override some of the fields with custom // // update values. // Update(func(u *ent.InspectionDisposalItemUpsert) { // SetRecordID(v+v). // }). // Exec(ctx) func (_c *InspectionDisposalItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *InspectionDisposalItemUpsertBulk { _c.conflict = opts return &InspectionDisposalItemUpsertBulk{ create: _c, } } // OnConflictColumns calls `OnConflict` and configures the columns // as conflict target. Using this option is equivalent to using: // // client.InspectionDisposalItem.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) func (_c *InspectionDisposalItemCreateBulk) OnConflictColumns(columns ...string) *InspectionDisposalItemUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &InspectionDisposalItemUpsertBulk{ create: _c, } } // InspectionDisposalItemUpsertBulk is the builder for "upsert"-ing // a bulk of InspectionDisposalItem nodes. type InspectionDisposalItemUpsertBulk struct { create *InspectionDisposalItemCreateBulk } // UpdateNewValues updates the mutable fields using the new values that // were set on create. Using this option is equivalent to using: // // client.InspectionDisposalItem.Create(). // OnConflict( // sql.ResolveWithNewValues(), // ). // Exec(ctx) func (u *InspectionDisposalItemUpsertBulk) UpdateNewValues() *InspectionDisposalItemUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) return u } // Ignore sets each column to itself in case of conflict. // Using this option is equivalent to using: // // client.InspectionDisposalItem.Create(). // OnConflict(sql.ResolveWithIgnore()). // Exec(ctx) func (u *InspectionDisposalItemUpsertBulk) Ignore() *InspectionDisposalItemUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u } // DoNothing configures the conflict_action to `DO NOTHING`. // Supported only by SQLite and PostgreSQL. func (u *InspectionDisposalItemUpsertBulk) DoNothing() *InspectionDisposalItemUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u } // Update allows overriding fields `UPDATE` values. See the InspectionDisposalItemCreateBulk.OnConflict // documentation for more info. func (u *InspectionDisposalItemUpsertBulk) Update(set func(*InspectionDisposalItemUpsert)) *InspectionDisposalItemUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&InspectionDisposalItemUpsert{UpdateSet: update}) })) return u } // SetRecordID sets the "record_id" field. func (u *InspectionDisposalItemUpsertBulk) SetRecordID(v int64) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetRecordID(v) }) } // AddRecordID adds v to the "record_id" field. func (u *InspectionDisposalItemUpsertBulk) AddRecordID(v int64) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.AddRecordID(v) }) } // UpdateRecordID sets the "record_id" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertBulk) UpdateRecordID() *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateRecordID() }) } // SetDisposeType sets the "dispose_type" field. func (u *InspectionDisposalItemUpsertBulk) SetDisposeType(v string) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetDisposeType(v) }) } // UpdateDisposeType sets the "dispose_type" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertBulk) UpdateDisposeType() *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateDisposeType() }) } // SetQty sets the "qty" field. func (u *InspectionDisposalItemUpsertBulk) SetQty(v int) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetQty(v) }) } // AddQty adds v to the "qty" field. func (u *InspectionDisposalItemUpsertBulk) AddQty(v int) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.AddQty(v) }) } // UpdateQty sets the "qty" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertBulk) UpdateQty() *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateQty() }) } // SetRemark sets the "remark" field. func (u *InspectionDisposalItemUpsertBulk) SetRemark(v string) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetRemark(v) }) } // UpdateRemark sets the "remark" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertBulk) UpdateRemark() *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateRemark() }) } // ClearRemark clears the value of the "remark" field. func (u *InspectionDisposalItemUpsertBulk) ClearRemark() *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.ClearRemark() }) } // SetOperator sets the "operator" field. func (u *InspectionDisposalItemUpsertBulk) SetOperator(v string) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetOperator(v) }) } // UpdateOperator sets the "operator" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertBulk) UpdateOperator() *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateOperator() }) } // SetCreatedAt sets the "created_at" field. func (u *InspectionDisposalItemUpsertBulk) SetCreatedAt(v int64) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.SetCreatedAt(v) }) } // AddCreatedAt adds v to the "created_at" field. func (u *InspectionDisposalItemUpsertBulk) AddCreatedAt(v int64) *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.AddCreatedAt(v) }) } // UpdateCreatedAt sets the "created_at" field to the value that was provided on create. func (u *InspectionDisposalItemUpsertBulk) UpdateCreatedAt() *InspectionDisposalItemUpsertBulk { return u.Update(func(s *InspectionDisposalItemUpsert) { s.UpdateCreatedAt() }) } // Exec executes the query. func (u *InspectionDisposalItemUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { return u.create.err } for i, b := range u.create.builders { if len(b.conflict) != 0 { return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the InspectionDisposalItemCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("ent: missing options for InspectionDisposalItemCreateBulk.OnConflict") } return u.create.Exec(ctx) } // ExecX is like Exec, but panics if an error occurs. func (u *InspectionDisposalItemUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) } }