// Code generated by ent, DO NOT EDIT. package ent import ( "bj_power_wms/ent/alert" "context" "errors" "fmt" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" ) // AlertCreate is the builder for creating a Alert entity. type AlertCreate struct { config mutation *AlertMutation hooks []Hook conflict []sql.ConflictOption } // SetRuleCode sets the "rule_code" field. func (_c *AlertCreate) SetRuleCode(v string) *AlertCreate { _c.mutation.SetRuleCode(v) return _c } // SetLevel sets the "level" field. func (_c *AlertCreate) SetLevel(v string) *AlertCreate { _c.mutation.SetLevel(v) return _c } // SetNillableLevel sets the "level" field if the given value is not nil. func (_c *AlertCreate) SetNillableLevel(v *string) *AlertCreate { if v != nil { _c.SetLevel(*v) } return _c } // SetTitle sets the "title" field. func (_c *AlertCreate) SetTitle(v string) *AlertCreate { _c.mutation.SetTitle(v) return _c } // SetContent sets the "content" field. func (_c *AlertCreate) SetContent(v string) *AlertCreate { _c.mutation.SetContent(v) return _c } // SetTarget sets the "target" field. func (_c *AlertCreate) SetTarget(v string) *AlertCreate { _c.mutation.SetTarget(v) return _c } // SetNillableTarget sets the "target" field if the given value is not nil. func (_c *AlertCreate) SetNillableTarget(v *string) *AlertCreate { if v != nil { _c.SetTarget(*v) } return _c } // SetStatus sets the "status" field. func (_c *AlertCreate) SetStatus(v string) *AlertCreate { _c.mutation.SetStatus(v) return _c } // SetNillableStatus sets the "status" field if the given value is not nil. func (_c *AlertCreate) SetNillableStatus(v *string) *AlertCreate { if v != nil { _c.SetStatus(*v) } return _c } // SetCreatedAt sets the "created_at" field. func (_c *AlertCreate) SetCreatedAt(v int64) *AlertCreate { _c.mutation.SetCreatedAt(v) return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. func (_c *AlertCreate) SetNillableCreatedAt(v *int64) *AlertCreate { if v != nil { _c.SetCreatedAt(*v) } return _c } // SetUpdatedAt sets the "updated_at" field. func (_c *AlertCreate) SetUpdatedAt(v int64) *AlertCreate { _c.mutation.SetUpdatedAt(v) return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. func (_c *AlertCreate) SetNillableUpdatedAt(v *int64) *AlertCreate { if v != nil { _c.SetUpdatedAt(*v) } return _c } // Mutation returns the AlertMutation object of the builder. func (_c *AlertCreate) Mutation() *AlertMutation { return _c.mutation } // Save creates the Alert in the database. func (_c *AlertCreate) Save(ctx context.Context) (*Alert, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *AlertCreate) SaveX(ctx context.Context) *Alert { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AlertCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AlertCreate) 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 *AlertCreate) defaults() { if _, ok := _c.mutation.Level(); !ok { v := alert.DefaultLevel _c.mutation.SetLevel(v) } if _, ok := _c.mutation.Status(); !ok { v := alert.DefaultStatus _c.mutation.SetStatus(v) } if _, ok := _c.mutation.CreatedAt(); !ok { v := alert.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.UpdatedAt(); !ok { v := alert.DefaultUpdatedAt() _c.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. func (_c *AlertCreate) check() error { if _, ok := _c.mutation.RuleCode(); !ok { return &ValidationError{Name: "rule_code", err: errors.New(`ent: missing required field "Alert.rule_code"`)} } if _, ok := _c.mutation.Level(); !ok { return &ValidationError{Name: "level", err: errors.New(`ent: missing required field "Alert.level"`)} } if v, ok := _c.mutation.Level(); ok { if err := alert.LevelValidator(v); err != nil { return &ValidationError{Name: "level", err: fmt.Errorf(`ent: validator failed for field "Alert.level": %w`, err)} } } if _, ok := _c.mutation.Title(); !ok { return &ValidationError{Name: "title", err: errors.New(`ent: missing required field "Alert.title"`)} } if _, ok := _c.mutation.Content(); !ok { return &ValidationError{Name: "content", err: errors.New(`ent: missing required field "Alert.content"`)} } if _, ok := _c.mutation.Status(); !ok { return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Alert.status"`)} } if v, ok := _c.mutation.Status(); ok { if err := alert.StatusValidator(v); err != nil { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Alert.status": %w`, err)} } } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Alert.created_at"`)} } if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Alert.updated_at"`)} } return nil } func (_c *AlertCreate) sqlSave(ctx context.Context) (*Alert, 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 *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) { var ( _node = &Alert{config: _c.config} _spec = sqlgraph.NewCreateSpec(alert.Table, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt)) ) _spec.OnConflict = _c.conflict if value, ok := _c.mutation.RuleCode(); ok { _spec.SetField(alert.FieldRuleCode, field.TypeString, value) _node.RuleCode = value } if value, ok := _c.mutation.Level(); ok { _spec.SetField(alert.FieldLevel, field.TypeString, value) _node.Level = value } if value, ok := _c.mutation.Title(); ok { _spec.SetField(alert.FieldTitle, field.TypeString, value) _node.Title = value } if value, ok := _c.mutation.Content(); ok { _spec.SetField(alert.FieldContent, field.TypeString, value) _node.Content = value } if value, ok := _c.mutation.Target(); ok { _spec.SetField(alert.FieldTarget, field.TypeString, value) _node.Target = value } if value, ok := _c.mutation.Status(); ok { _spec.SetField(alert.FieldStatus, field.TypeString, value) _node.Status = value } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(alert.FieldCreatedAt, field.TypeInt64, value) _node.CreatedAt = value } if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(alert.FieldUpdatedAt, field.TypeInt64, value) _node.UpdatedAt = value } return _node, _spec } // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause // of the `INSERT` statement. For example: // // client.Alert.Create(). // SetRuleCode(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.AlertUpsert) { // SetRuleCode(v+v). // }). // Exec(ctx) func (_c *AlertCreate) OnConflict(opts ...sql.ConflictOption) *AlertUpsertOne { _c.conflict = opts return &AlertUpsertOne{ create: _c, } } // OnConflictColumns calls `OnConflict` and configures the columns // as conflict target. Using this option is equivalent to using: // // client.Alert.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) func (_c *AlertCreate) OnConflictColumns(columns ...string) *AlertUpsertOne { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AlertUpsertOne{ create: _c, } } type ( // AlertUpsertOne is the builder for "upsert"-ing // one Alert node. AlertUpsertOne struct { create *AlertCreate } // AlertUpsert is the "OnConflict" setter. AlertUpsert struct { *sql.UpdateSet } ) // SetRuleCode sets the "rule_code" field. func (u *AlertUpsert) SetRuleCode(v string) *AlertUpsert { u.Set(alert.FieldRuleCode, v) return u } // UpdateRuleCode sets the "rule_code" field to the value that was provided on create. func (u *AlertUpsert) UpdateRuleCode() *AlertUpsert { u.SetExcluded(alert.FieldRuleCode) return u } // SetLevel sets the "level" field. func (u *AlertUpsert) SetLevel(v string) *AlertUpsert { u.Set(alert.FieldLevel, v) return u } // UpdateLevel sets the "level" field to the value that was provided on create. func (u *AlertUpsert) UpdateLevel() *AlertUpsert { u.SetExcluded(alert.FieldLevel) return u } // SetTitle sets the "title" field. func (u *AlertUpsert) SetTitle(v string) *AlertUpsert { u.Set(alert.FieldTitle, v) return u } // UpdateTitle sets the "title" field to the value that was provided on create. func (u *AlertUpsert) UpdateTitle() *AlertUpsert { u.SetExcluded(alert.FieldTitle) return u } // SetContent sets the "content" field. func (u *AlertUpsert) SetContent(v string) *AlertUpsert { u.Set(alert.FieldContent, v) return u } // UpdateContent sets the "content" field to the value that was provided on create. func (u *AlertUpsert) UpdateContent() *AlertUpsert { u.SetExcluded(alert.FieldContent) return u } // SetTarget sets the "target" field. func (u *AlertUpsert) SetTarget(v string) *AlertUpsert { u.Set(alert.FieldTarget, v) return u } // UpdateTarget sets the "target" field to the value that was provided on create. func (u *AlertUpsert) UpdateTarget() *AlertUpsert { u.SetExcluded(alert.FieldTarget) return u } // ClearTarget clears the value of the "target" field. func (u *AlertUpsert) ClearTarget() *AlertUpsert { u.SetNull(alert.FieldTarget) return u } // SetStatus sets the "status" field. func (u *AlertUpsert) SetStatus(v string) *AlertUpsert { u.Set(alert.FieldStatus, v) return u } // UpdateStatus sets the "status" field to the value that was provided on create. func (u *AlertUpsert) UpdateStatus() *AlertUpsert { u.SetExcluded(alert.FieldStatus) return u } // SetCreatedAt sets the "created_at" field. func (u *AlertUpsert) SetCreatedAt(v int64) *AlertUpsert { u.Set(alert.FieldCreatedAt, v) return u } // UpdateCreatedAt sets the "created_at" field to the value that was provided on create. func (u *AlertUpsert) UpdateCreatedAt() *AlertUpsert { u.SetExcluded(alert.FieldCreatedAt) return u } // AddCreatedAt adds v to the "created_at" field. func (u *AlertUpsert) AddCreatedAt(v int64) *AlertUpsert { u.Add(alert.FieldCreatedAt, v) return u } // SetUpdatedAt sets the "updated_at" field. func (u *AlertUpsert) SetUpdatedAt(v int64) *AlertUpsert { u.Set(alert.FieldUpdatedAt, v) return u } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *AlertUpsert) UpdateUpdatedAt() *AlertUpsert { u.SetExcluded(alert.FieldUpdatedAt) return u } // AddUpdatedAt adds v to the "updated_at" field. func (u *AlertUpsert) AddUpdatedAt(v int64) *AlertUpsert { u.Add(alert.FieldUpdatedAt, 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.Alert.Create(). // OnConflict( // sql.ResolveWithNewValues(), // ). // Exec(ctx) func (u *AlertUpsertOne) UpdateNewValues() *AlertUpsertOne { 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.Alert.Create(). // OnConflict(sql.ResolveWithIgnore()). // Exec(ctx) func (u *AlertUpsertOne) Ignore() *AlertUpsertOne { 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 *AlertUpsertOne) DoNothing() *AlertUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u } // Update allows overriding fields `UPDATE` values. See the AlertCreate.OnConflict // documentation for more info. func (u *AlertUpsertOne) Update(set func(*AlertUpsert)) *AlertUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&AlertUpsert{UpdateSet: update}) })) return u } // SetRuleCode sets the "rule_code" field. func (u *AlertUpsertOne) SetRuleCode(v string) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetRuleCode(v) }) } // UpdateRuleCode sets the "rule_code" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateRuleCode() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateRuleCode() }) } // SetLevel sets the "level" field. func (u *AlertUpsertOne) SetLevel(v string) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetLevel(v) }) } // UpdateLevel sets the "level" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateLevel() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateLevel() }) } // SetTitle sets the "title" field. func (u *AlertUpsertOne) SetTitle(v string) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetTitle(v) }) } // UpdateTitle sets the "title" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateTitle() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateTitle() }) } // SetContent sets the "content" field. func (u *AlertUpsertOne) SetContent(v string) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetContent(v) }) } // UpdateContent sets the "content" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateContent() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateContent() }) } // SetTarget sets the "target" field. func (u *AlertUpsertOne) SetTarget(v string) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetTarget(v) }) } // UpdateTarget sets the "target" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateTarget() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateTarget() }) } // ClearTarget clears the value of the "target" field. func (u *AlertUpsertOne) ClearTarget() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.ClearTarget() }) } // SetStatus sets the "status" field. func (u *AlertUpsertOne) SetStatus(v string) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetStatus(v) }) } // UpdateStatus sets the "status" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateStatus() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateStatus() }) } // SetCreatedAt sets the "created_at" field. func (u *AlertUpsertOne) SetCreatedAt(v int64) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetCreatedAt(v) }) } // AddCreatedAt adds v to the "created_at" field. func (u *AlertUpsertOne) AddCreatedAt(v int64) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.AddCreatedAt(v) }) } // UpdateCreatedAt sets the "created_at" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateCreatedAt() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateCreatedAt() }) } // SetUpdatedAt sets the "updated_at" field. func (u *AlertUpsertOne) SetUpdatedAt(v int64) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.SetUpdatedAt(v) }) } // AddUpdatedAt adds v to the "updated_at" field. func (u *AlertUpsertOne) AddUpdatedAt(v int64) *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.AddUpdatedAt(v) }) } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *AlertUpsertOne) UpdateUpdatedAt() *AlertUpsertOne { return u.Update(func(s *AlertUpsert) { s.UpdateUpdatedAt() }) } // Exec executes the query. func (u *AlertUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("ent: missing options for AlertCreate.OnConflict") } return u.create.Exec(ctx) } // ExecX is like Exec, but panics if an error occurs. func (u *AlertUpsertOne) 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 *AlertUpsertOne) 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 *AlertUpsertOne) IDX(ctx context.Context) int { id, err := u.ID(ctx) if err != nil { panic(err) } return id } // AlertCreateBulk is the builder for creating many Alert entities in bulk. type AlertCreateBulk struct { config err error builders []*AlertCreate conflict []sql.ConflictOption } // Save creates the Alert entities in the database. func (_c *AlertCreateBulk) Save(ctx context.Context) ([]*Alert, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*Alert, 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.(*AlertMutation) 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 *AlertCreateBulk) SaveX(ctx context.Context) []*Alert { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AlertCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AlertCreateBulk) 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.Alert.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.AlertUpsert) { // SetRuleCode(v+v). // }). // Exec(ctx) func (_c *AlertCreateBulk) OnConflict(opts ...sql.ConflictOption) *AlertUpsertBulk { _c.conflict = opts return &AlertUpsertBulk{ create: _c, } } // OnConflictColumns calls `OnConflict` and configures the columns // as conflict target. Using this option is equivalent to using: // // client.Alert.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) func (_c *AlertCreateBulk) OnConflictColumns(columns ...string) *AlertUpsertBulk { _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AlertUpsertBulk{ create: _c, } } // AlertUpsertBulk is the builder for "upsert"-ing // a bulk of Alert nodes. type AlertUpsertBulk struct { create *AlertCreateBulk } // UpdateNewValues updates the mutable fields using the new values that // were set on create. Using this option is equivalent to using: // // client.Alert.Create(). // OnConflict( // sql.ResolveWithNewValues(), // ). // Exec(ctx) func (u *AlertUpsertBulk) UpdateNewValues() *AlertUpsertBulk { 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.Alert.Create(). // OnConflict(sql.ResolveWithIgnore()). // Exec(ctx) func (u *AlertUpsertBulk) Ignore() *AlertUpsertBulk { 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 *AlertUpsertBulk) DoNothing() *AlertUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u } // Update allows overriding fields `UPDATE` values. See the AlertCreateBulk.OnConflict // documentation for more info. func (u *AlertUpsertBulk) Update(set func(*AlertUpsert)) *AlertUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&AlertUpsert{UpdateSet: update}) })) return u } // SetRuleCode sets the "rule_code" field. func (u *AlertUpsertBulk) SetRuleCode(v string) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetRuleCode(v) }) } // UpdateRuleCode sets the "rule_code" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateRuleCode() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateRuleCode() }) } // SetLevel sets the "level" field. func (u *AlertUpsertBulk) SetLevel(v string) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetLevel(v) }) } // UpdateLevel sets the "level" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateLevel() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateLevel() }) } // SetTitle sets the "title" field. func (u *AlertUpsertBulk) SetTitle(v string) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetTitle(v) }) } // UpdateTitle sets the "title" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateTitle() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateTitle() }) } // SetContent sets the "content" field. func (u *AlertUpsertBulk) SetContent(v string) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetContent(v) }) } // UpdateContent sets the "content" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateContent() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateContent() }) } // SetTarget sets the "target" field. func (u *AlertUpsertBulk) SetTarget(v string) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetTarget(v) }) } // UpdateTarget sets the "target" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateTarget() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateTarget() }) } // ClearTarget clears the value of the "target" field. func (u *AlertUpsertBulk) ClearTarget() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.ClearTarget() }) } // SetStatus sets the "status" field. func (u *AlertUpsertBulk) SetStatus(v string) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetStatus(v) }) } // UpdateStatus sets the "status" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateStatus() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateStatus() }) } // SetCreatedAt sets the "created_at" field. func (u *AlertUpsertBulk) SetCreatedAt(v int64) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetCreatedAt(v) }) } // AddCreatedAt adds v to the "created_at" field. func (u *AlertUpsertBulk) AddCreatedAt(v int64) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.AddCreatedAt(v) }) } // UpdateCreatedAt sets the "created_at" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateCreatedAt() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateCreatedAt() }) } // SetUpdatedAt sets the "updated_at" field. func (u *AlertUpsertBulk) SetUpdatedAt(v int64) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.SetUpdatedAt(v) }) } // AddUpdatedAt adds v to the "updated_at" field. func (u *AlertUpsertBulk) AddUpdatedAt(v int64) *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.AddUpdatedAt(v) }) } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *AlertUpsertBulk) UpdateUpdatedAt() *AlertUpsertBulk { return u.Update(func(s *AlertUpsert) { s.UpdateUpdatedAt() }) } // Exec executes the query. func (u *AlertUpsertBulk) 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 AlertCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("ent: missing options for AlertCreateBulk.OnConflict") } return u.create.Exec(ctx) } // ExecX is like Exec, but panics if an error occurs. func (u *AlertUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) } }