// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "time" "wechat-api/ent/batchmsg" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" ) // BatchMsgCreate is the builder for creating a BatchMsg entity. type BatchMsgCreate struct { config mutation *BatchMsgMutation hooks []Hook conflict []sql.ConflictOption } // SetCreatedAt sets the "created_at" field. func (bmc *BatchMsgCreate) SetCreatedAt(t time.Time) *BatchMsgCreate { bmc.mutation.SetCreatedAt(t) return bmc } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableCreatedAt(t *time.Time) *BatchMsgCreate { if t != nil { bmc.SetCreatedAt(*t) } return bmc } // SetUpdatedAt sets the "updated_at" field. func (bmc *BatchMsgCreate) SetUpdatedAt(t time.Time) *BatchMsgCreate { bmc.mutation.SetUpdatedAt(t) return bmc } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableUpdatedAt(t *time.Time) *BatchMsgCreate { if t != nil { bmc.SetUpdatedAt(*t) } return bmc } // SetDeletedAt sets the "deleted_at" field. func (bmc *BatchMsgCreate) SetDeletedAt(t time.Time) *BatchMsgCreate { bmc.mutation.SetDeletedAt(t) return bmc } // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableDeletedAt(t *time.Time) *BatchMsgCreate { if t != nil { bmc.SetDeletedAt(*t) } return bmc } // SetStatus sets the "status" field. func (bmc *BatchMsgCreate) SetStatus(u uint8) *BatchMsgCreate { bmc.mutation.SetStatus(u) return bmc } // SetNillableStatus sets the "status" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableStatus(u *uint8) *BatchMsgCreate { if u != nil { bmc.SetStatus(*u) } return bmc } // SetBatchNo sets the "batch_no" field. func (bmc *BatchMsgCreate) SetBatchNo(s string) *BatchMsgCreate { bmc.mutation.SetBatchNo(s) return bmc } // SetNillableBatchNo sets the "batch_no" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableBatchNo(s *string) *BatchMsgCreate { if s != nil { bmc.SetBatchNo(*s) } return bmc } // SetTaskName sets the "task_name" field. func (bmc *BatchMsgCreate) SetTaskName(s string) *BatchMsgCreate { bmc.mutation.SetTaskName(s) return bmc } // SetNillableTaskName sets the "task_name" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableTaskName(s *string) *BatchMsgCreate { if s != nil { bmc.SetTaskName(*s) } return bmc } // SetFromwxid sets the "fromwxid" field. func (bmc *BatchMsgCreate) SetFromwxid(s string) *BatchMsgCreate { bmc.mutation.SetFromwxid(s) return bmc } // SetNillableFromwxid sets the "fromwxid" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableFromwxid(s *string) *BatchMsgCreate { if s != nil { bmc.SetFromwxid(*s) } return bmc } // SetMsg sets the "msg" field. func (bmc *BatchMsgCreate) SetMsg(s string) *BatchMsgCreate { bmc.mutation.SetMsg(s) return bmc } // SetNillableMsg sets the "msg" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableMsg(s *string) *BatchMsgCreate { if s != nil { bmc.SetMsg(*s) } return bmc } // SetTag sets the "tag" field. func (bmc *BatchMsgCreate) SetTag(s string) *BatchMsgCreate { bmc.mutation.SetTag(s) return bmc } // SetNillableTag sets the "tag" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableTag(s *string) *BatchMsgCreate { if s != nil { bmc.SetTag(*s) } return bmc } // SetTagids sets the "tagids" field. func (bmc *BatchMsgCreate) SetTagids(s string) *BatchMsgCreate { bmc.mutation.SetTagids(s) return bmc } // SetNillableTagids sets the "tagids" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableTagids(s *string) *BatchMsgCreate { if s != nil { bmc.SetTagids(*s) } return bmc } // SetTotal sets the "total" field. func (bmc *BatchMsgCreate) SetTotal(i int32) *BatchMsgCreate { bmc.mutation.SetTotal(i) return bmc } // SetNillableTotal sets the "total" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableTotal(i *int32) *BatchMsgCreate { if i != nil { bmc.SetTotal(*i) } return bmc } // SetSuccess sets the "success" field. func (bmc *BatchMsgCreate) SetSuccess(i int32) *BatchMsgCreate { bmc.mutation.SetSuccess(i) return bmc } // SetNillableSuccess sets the "success" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableSuccess(i *int32) *BatchMsgCreate { if i != nil { bmc.SetSuccess(*i) } return bmc } // SetFail sets the "fail" field. func (bmc *BatchMsgCreate) SetFail(i int32) *BatchMsgCreate { bmc.mutation.SetFail(i) return bmc } // SetNillableFail sets the "fail" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableFail(i *int32) *BatchMsgCreate { if i != nil { bmc.SetFail(*i) } return bmc } // SetStartTime sets the "start_time" field. func (bmc *BatchMsgCreate) SetStartTime(t time.Time) *BatchMsgCreate { bmc.mutation.SetStartTime(t) return bmc } // SetNillableStartTime sets the "start_time" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableStartTime(t *time.Time) *BatchMsgCreate { if t != nil { bmc.SetStartTime(*t) } return bmc } // SetStopTime sets the "stop_time" field. func (bmc *BatchMsgCreate) SetStopTime(t time.Time) *BatchMsgCreate { bmc.mutation.SetStopTime(t) return bmc } // SetNillableStopTime sets the "stop_time" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableStopTime(t *time.Time) *BatchMsgCreate { if t != nil { bmc.SetStopTime(*t) } return bmc } // SetSendTime sets the "send_time" field. func (bmc *BatchMsgCreate) SetSendTime(t time.Time) *BatchMsgCreate { bmc.mutation.SetSendTime(t) return bmc } // SetNillableSendTime sets the "send_time" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableSendTime(t *time.Time) *BatchMsgCreate { if t != nil { bmc.SetSendTime(*t) } return bmc } // SetType sets the "type" field. func (bmc *BatchMsgCreate) SetType(i int32) *BatchMsgCreate { bmc.mutation.SetType(i) return bmc } // SetNillableType sets the "type" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableType(i *int32) *BatchMsgCreate { if i != nil { bmc.SetType(*i) } return bmc } // SetOrganizationID sets the "organization_id" field. func (bmc *BatchMsgCreate) SetOrganizationID(u uint64) *BatchMsgCreate { bmc.mutation.SetOrganizationID(u) return bmc } // SetCtype sets the "ctype" field. func (bmc *BatchMsgCreate) SetCtype(u uint64) *BatchMsgCreate { bmc.mutation.SetCtype(u) return bmc } // SetNillableCtype sets the "ctype" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableCtype(u *uint64) *BatchMsgCreate { if u != nil { bmc.SetCtype(*u) } return bmc } // SetCc sets the "cc" field. func (bmc *BatchMsgCreate) SetCc(s string) *BatchMsgCreate { bmc.mutation.SetCc(s) return bmc } // SetNillableCc sets the "cc" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableCc(s *string) *BatchMsgCreate { if s != nil { bmc.SetCc(*s) } return bmc } // SetPhone sets the "phone" field. func (bmc *BatchMsgCreate) SetPhone(s string) *BatchMsgCreate { bmc.mutation.SetPhone(s) return bmc } // SetNillablePhone sets the "phone" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillablePhone(s *string) *BatchMsgCreate { if s != nil { bmc.SetPhone(*s) } return bmc } // SetTemplateName sets the "template_name" field. func (bmc *BatchMsgCreate) SetTemplateName(s string) *BatchMsgCreate { bmc.mutation.SetTemplateName(s) return bmc } // SetNillableTemplateName sets the "template_name" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableTemplateName(s *string) *BatchMsgCreate { if s != nil { bmc.SetTemplateName(*s) } return bmc } // SetTemplateCode sets the "template_code" field. func (bmc *BatchMsgCreate) SetTemplateCode(s string) *BatchMsgCreate { bmc.mutation.SetTemplateCode(s) return bmc } // SetNillableTemplateCode sets the "template_code" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableTemplateCode(s *string) *BatchMsgCreate { if s != nil { bmc.SetTemplateCode(*s) } return bmc } // SetLang sets the "lang" field. func (bmc *BatchMsgCreate) SetLang(s string) *BatchMsgCreate { bmc.mutation.SetLang(s) return bmc } // SetNillableLang sets the "lang" field if the given value is not nil. func (bmc *BatchMsgCreate) SetNillableLang(s *string) *BatchMsgCreate { if s != nil { bmc.SetLang(*s) } return bmc } // SetID sets the "id" field. func (bmc *BatchMsgCreate) SetID(u uint64) *BatchMsgCreate { bmc.mutation.SetID(u) return bmc } // Mutation returns the BatchMsgMutation object of the builder. func (bmc *BatchMsgCreate) Mutation() *BatchMsgMutation { return bmc.mutation } // Save creates the BatchMsg in the database. func (bmc *BatchMsgCreate) Save(ctx context.Context) (*BatchMsg, error) { if err := bmc.defaults(); err != nil { return nil, err } return withHooks(ctx, bmc.sqlSave, bmc.mutation, bmc.hooks) } // SaveX calls Save and panics if Save returns an error. func (bmc *BatchMsgCreate) SaveX(ctx context.Context) *BatchMsg { v, err := bmc.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (bmc *BatchMsgCreate) Exec(ctx context.Context) error { _, err := bmc.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (bmc *BatchMsgCreate) ExecX(ctx context.Context) { if err := bmc.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (bmc *BatchMsgCreate) defaults() error { if _, ok := bmc.mutation.CreatedAt(); !ok { if batchmsg.DefaultCreatedAt == nil { return fmt.Errorf("ent: uninitialized batchmsg.DefaultCreatedAt (forgotten import ent/runtime?)") } v := batchmsg.DefaultCreatedAt() bmc.mutation.SetCreatedAt(v) } if _, ok := bmc.mutation.UpdatedAt(); !ok { if batchmsg.DefaultUpdatedAt == nil { return fmt.Errorf("ent: uninitialized batchmsg.DefaultUpdatedAt (forgotten import ent/runtime?)") } v := batchmsg.DefaultUpdatedAt() bmc.mutation.SetUpdatedAt(v) } if _, ok := bmc.mutation.TaskName(); !ok { v := batchmsg.DefaultTaskName bmc.mutation.SetTaskName(v) } if _, ok := bmc.mutation.Ctype(); !ok { v := batchmsg.DefaultCtype bmc.mutation.SetCtype(v) } return nil } // check runs all checks and user-defined validators on the builder. func (bmc *BatchMsgCreate) check() error { if _, ok := bmc.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BatchMsg.created_at"`)} } if _, ok := bmc.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "BatchMsg.updated_at"`)} } if _, ok := bmc.mutation.OrganizationID(); !ok { return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "BatchMsg.organization_id"`)} } if v, ok := bmc.mutation.OrganizationID(); ok { if err := batchmsg.OrganizationIDValidator(v); err != nil { return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "BatchMsg.organization_id": %w`, err)} } } if _, ok := bmc.mutation.Ctype(); !ok { return &ValidationError{Name: "ctype", err: errors.New(`ent: missing required field "BatchMsg.ctype"`)} } return nil } func (bmc *BatchMsgCreate) sqlSave(ctx context.Context) (*BatchMsg, error) { if err := bmc.check(); err != nil { return nil, err } _node, _spec := bmc.createSpec() if err := sqlgraph.CreateNode(ctx, bmc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != _node.ID { id := _spec.ID.Value.(int64) _node.ID = uint64(id) } bmc.mutation.id = &_node.ID bmc.mutation.done = true return _node, nil } func (bmc *BatchMsgCreate) createSpec() (*BatchMsg, *sqlgraph.CreateSpec) { var ( _node = &BatchMsg{config: bmc.config} _spec = sqlgraph.NewCreateSpec(batchmsg.Table, sqlgraph.NewFieldSpec(batchmsg.FieldID, field.TypeUint64)) ) _spec.OnConflict = bmc.conflict if id, ok := bmc.mutation.ID(); ok { _node.ID = id _spec.ID.Value = id } if value, ok := bmc.mutation.CreatedAt(); ok { _spec.SetField(batchmsg.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } if value, ok := bmc.mutation.UpdatedAt(); ok { _spec.SetField(batchmsg.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } if value, ok := bmc.mutation.DeletedAt(); ok { _spec.SetField(batchmsg.FieldDeletedAt, field.TypeTime, value) _node.DeletedAt = value } if value, ok := bmc.mutation.Status(); ok { _spec.SetField(batchmsg.FieldStatus, field.TypeUint8, value) _node.Status = value } if value, ok := bmc.mutation.BatchNo(); ok { _spec.SetField(batchmsg.FieldBatchNo, field.TypeString, value) _node.BatchNo = value } if value, ok := bmc.mutation.TaskName(); ok { _spec.SetField(batchmsg.FieldTaskName, field.TypeString, value) _node.TaskName = value } if value, ok := bmc.mutation.Fromwxid(); ok { _spec.SetField(batchmsg.FieldFromwxid, field.TypeString, value) _node.Fromwxid = value } if value, ok := bmc.mutation.Msg(); ok { _spec.SetField(batchmsg.FieldMsg, field.TypeString, value) _node.Msg = value } if value, ok := bmc.mutation.Tag(); ok { _spec.SetField(batchmsg.FieldTag, field.TypeString, value) _node.Tag = value } if value, ok := bmc.mutation.Tagids(); ok { _spec.SetField(batchmsg.FieldTagids, field.TypeString, value) _node.Tagids = value } if value, ok := bmc.mutation.Total(); ok { _spec.SetField(batchmsg.FieldTotal, field.TypeInt32, value) _node.Total = value } if value, ok := bmc.mutation.Success(); ok { _spec.SetField(batchmsg.FieldSuccess, field.TypeInt32, value) _node.Success = value } if value, ok := bmc.mutation.Fail(); ok { _spec.SetField(batchmsg.FieldFail, field.TypeInt32, value) _node.Fail = value } if value, ok := bmc.mutation.StartTime(); ok { _spec.SetField(batchmsg.FieldStartTime, field.TypeTime, value) _node.StartTime = value } if value, ok := bmc.mutation.StopTime(); ok { _spec.SetField(batchmsg.FieldStopTime, field.TypeTime, value) _node.StopTime = value } if value, ok := bmc.mutation.SendTime(); ok { _spec.SetField(batchmsg.FieldSendTime, field.TypeTime, value) _node.SendTime = value } if value, ok := bmc.mutation.GetType(); ok { _spec.SetField(batchmsg.FieldType, field.TypeInt32, value) _node.Type = value } if value, ok := bmc.mutation.OrganizationID(); ok { _spec.SetField(batchmsg.FieldOrganizationID, field.TypeUint64, value) _node.OrganizationID = value } if value, ok := bmc.mutation.Ctype(); ok { _spec.SetField(batchmsg.FieldCtype, field.TypeUint64, value) _node.Ctype = value } if value, ok := bmc.mutation.Cc(); ok { _spec.SetField(batchmsg.FieldCc, field.TypeString, value) _node.Cc = value } if value, ok := bmc.mutation.Phone(); ok { _spec.SetField(batchmsg.FieldPhone, field.TypeString, value) _node.Phone = value } if value, ok := bmc.mutation.TemplateName(); ok { _spec.SetField(batchmsg.FieldTemplateName, field.TypeString, value) _node.TemplateName = value } if value, ok := bmc.mutation.TemplateCode(); ok { _spec.SetField(batchmsg.FieldTemplateCode, field.TypeString, value) _node.TemplateCode = value } if value, ok := bmc.mutation.Lang(); ok { _spec.SetField(batchmsg.FieldLang, field.TypeString, value) _node.Lang = value } return _node, _spec } // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause // of the `INSERT` statement. For example: // // client.BatchMsg.Create(). // SetCreatedAt(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.BatchMsgUpsert) { // SetCreatedAt(v+v). // }). // Exec(ctx) func (bmc *BatchMsgCreate) OnConflict(opts ...sql.ConflictOption) *BatchMsgUpsertOne { bmc.conflict = opts return &BatchMsgUpsertOne{ create: bmc, } } // OnConflictColumns calls `OnConflict` and configures the columns // as conflict target. Using this option is equivalent to using: // // client.BatchMsg.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) func (bmc *BatchMsgCreate) OnConflictColumns(columns ...string) *BatchMsgUpsertOne { bmc.conflict = append(bmc.conflict, sql.ConflictColumns(columns...)) return &BatchMsgUpsertOne{ create: bmc, } } type ( // BatchMsgUpsertOne is the builder for "upsert"-ing // one BatchMsg node. BatchMsgUpsertOne struct { create *BatchMsgCreate } // BatchMsgUpsert is the "OnConflict" setter. BatchMsgUpsert struct { *sql.UpdateSet } ) // SetUpdatedAt sets the "updated_at" field. func (u *BatchMsgUpsert) SetUpdatedAt(v time.Time) *BatchMsgUpsert { u.Set(batchmsg.FieldUpdatedAt, v) return u } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateUpdatedAt() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldUpdatedAt) return u } // SetDeletedAt sets the "deleted_at" field. func (u *BatchMsgUpsert) SetDeletedAt(v time.Time) *BatchMsgUpsert { u.Set(batchmsg.FieldDeletedAt, v) return u } // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateDeletedAt() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldDeletedAt) return u } // ClearDeletedAt clears the value of the "deleted_at" field. func (u *BatchMsgUpsert) ClearDeletedAt() *BatchMsgUpsert { u.SetNull(batchmsg.FieldDeletedAt) return u } // SetStatus sets the "status" field. func (u *BatchMsgUpsert) SetStatus(v uint8) *BatchMsgUpsert { u.Set(batchmsg.FieldStatus, v) return u } // UpdateStatus sets the "status" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateStatus() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldStatus) return u } // AddStatus adds v to the "status" field. func (u *BatchMsgUpsert) AddStatus(v uint8) *BatchMsgUpsert { u.Add(batchmsg.FieldStatus, v) return u } // ClearStatus clears the value of the "status" field. func (u *BatchMsgUpsert) ClearStatus() *BatchMsgUpsert { u.SetNull(batchmsg.FieldStatus) return u } // SetBatchNo sets the "batch_no" field. func (u *BatchMsgUpsert) SetBatchNo(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldBatchNo, v) return u } // UpdateBatchNo sets the "batch_no" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateBatchNo() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldBatchNo) return u } // ClearBatchNo clears the value of the "batch_no" field. func (u *BatchMsgUpsert) ClearBatchNo() *BatchMsgUpsert { u.SetNull(batchmsg.FieldBatchNo) return u } // SetTaskName sets the "task_name" field. func (u *BatchMsgUpsert) SetTaskName(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldTaskName, v) return u } // UpdateTaskName sets the "task_name" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateTaskName() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldTaskName) return u } // ClearTaskName clears the value of the "task_name" field. func (u *BatchMsgUpsert) ClearTaskName() *BatchMsgUpsert { u.SetNull(batchmsg.FieldTaskName) return u } // SetFromwxid sets the "fromwxid" field. func (u *BatchMsgUpsert) SetFromwxid(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldFromwxid, v) return u } // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateFromwxid() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldFromwxid) return u } // ClearFromwxid clears the value of the "fromwxid" field. func (u *BatchMsgUpsert) ClearFromwxid() *BatchMsgUpsert { u.SetNull(batchmsg.FieldFromwxid) return u } // SetMsg sets the "msg" field. func (u *BatchMsgUpsert) SetMsg(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldMsg, v) return u } // UpdateMsg sets the "msg" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateMsg() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldMsg) return u } // ClearMsg clears the value of the "msg" field. func (u *BatchMsgUpsert) ClearMsg() *BatchMsgUpsert { u.SetNull(batchmsg.FieldMsg) return u } // SetTag sets the "tag" field. func (u *BatchMsgUpsert) SetTag(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldTag, v) return u } // UpdateTag sets the "tag" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateTag() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldTag) return u } // ClearTag clears the value of the "tag" field. func (u *BatchMsgUpsert) ClearTag() *BatchMsgUpsert { u.SetNull(batchmsg.FieldTag) return u } // SetTagids sets the "tagids" field. func (u *BatchMsgUpsert) SetTagids(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldTagids, v) return u } // UpdateTagids sets the "tagids" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateTagids() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldTagids) return u } // ClearTagids clears the value of the "tagids" field. func (u *BatchMsgUpsert) ClearTagids() *BatchMsgUpsert { u.SetNull(batchmsg.FieldTagids) return u } // SetTotal sets the "total" field. func (u *BatchMsgUpsert) SetTotal(v int32) *BatchMsgUpsert { u.Set(batchmsg.FieldTotal, v) return u } // UpdateTotal sets the "total" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateTotal() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldTotal) return u } // AddTotal adds v to the "total" field. func (u *BatchMsgUpsert) AddTotal(v int32) *BatchMsgUpsert { u.Add(batchmsg.FieldTotal, v) return u } // ClearTotal clears the value of the "total" field. func (u *BatchMsgUpsert) ClearTotal() *BatchMsgUpsert { u.SetNull(batchmsg.FieldTotal) return u } // SetSuccess sets the "success" field. func (u *BatchMsgUpsert) SetSuccess(v int32) *BatchMsgUpsert { u.Set(batchmsg.FieldSuccess, v) return u } // UpdateSuccess sets the "success" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateSuccess() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldSuccess) return u } // AddSuccess adds v to the "success" field. func (u *BatchMsgUpsert) AddSuccess(v int32) *BatchMsgUpsert { u.Add(batchmsg.FieldSuccess, v) return u } // ClearSuccess clears the value of the "success" field. func (u *BatchMsgUpsert) ClearSuccess() *BatchMsgUpsert { u.SetNull(batchmsg.FieldSuccess) return u } // SetFail sets the "fail" field. func (u *BatchMsgUpsert) SetFail(v int32) *BatchMsgUpsert { u.Set(batchmsg.FieldFail, v) return u } // UpdateFail sets the "fail" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateFail() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldFail) return u } // AddFail adds v to the "fail" field. func (u *BatchMsgUpsert) AddFail(v int32) *BatchMsgUpsert { u.Add(batchmsg.FieldFail, v) return u } // ClearFail clears the value of the "fail" field. func (u *BatchMsgUpsert) ClearFail() *BatchMsgUpsert { u.SetNull(batchmsg.FieldFail) return u } // SetStartTime sets the "start_time" field. func (u *BatchMsgUpsert) SetStartTime(v time.Time) *BatchMsgUpsert { u.Set(batchmsg.FieldStartTime, v) return u } // UpdateStartTime sets the "start_time" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateStartTime() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldStartTime) return u } // ClearStartTime clears the value of the "start_time" field. func (u *BatchMsgUpsert) ClearStartTime() *BatchMsgUpsert { u.SetNull(batchmsg.FieldStartTime) return u } // SetStopTime sets the "stop_time" field. func (u *BatchMsgUpsert) SetStopTime(v time.Time) *BatchMsgUpsert { u.Set(batchmsg.FieldStopTime, v) return u } // UpdateStopTime sets the "stop_time" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateStopTime() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldStopTime) return u } // ClearStopTime clears the value of the "stop_time" field. func (u *BatchMsgUpsert) ClearStopTime() *BatchMsgUpsert { u.SetNull(batchmsg.FieldStopTime) return u } // SetSendTime sets the "send_time" field. func (u *BatchMsgUpsert) SetSendTime(v time.Time) *BatchMsgUpsert { u.Set(batchmsg.FieldSendTime, v) return u } // UpdateSendTime sets the "send_time" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateSendTime() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldSendTime) return u } // ClearSendTime clears the value of the "send_time" field. func (u *BatchMsgUpsert) ClearSendTime() *BatchMsgUpsert { u.SetNull(batchmsg.FieldSendTime) return u } // SetType sets the "type" field. func (u *BatchMsgUpsert) SetType(v int32) *BatchMsgUpsert { u.Set(batchmsg.FieldType, v) return u } // UpdateType sets the "type" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateType() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldType) return u } // AddType adds v to the "type" field. func (u *BatchMsgUpsert) AddType(v int32) *BatchMsgUpsert { u.Add(batchmsg.FieldType, v) return u } // ClearType clears the value of the "type" field. func (u *BatchMsgUpsert) ClearType() *BatchMsgUpsert { u.SetNull(batchmsg.FieldType) return u } // SetOrganizationID sets the "organization_id" field. func (u *BatchMsgUpsert) SetOrganizationID(v uint64) *BatchMsgUpsert { u.Set(batchmsg.FieldOrganizationID, v) return u } // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateOrganizationID() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldOrganizationID) return u } // AddOrganizationID adds v to the "organization_id" field. func (u *BatchMsgUpsert) AddOrganizationID(v uint64) *BatchMsgUpsert { u.Add(batchmsg.FieldOrganizationID, v) return u } // SetCtype sets the "ctype" field. func (u *BatchMsgUpsert) SetCtype(v uint64) *BatchMsgUpsert { u.Set(batchmsg.FieldCtype, v) return u } // UpdateCtype sets the "ctype" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateCtype() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldCtype) return u } // AddCtype adds v to the "ctype" field. func (u *BatchMsgUpsert) AddCtype(v uint64) *BatchMsgUpsert { u.Add(batchmsg.FieldCtype, v) return u } // SetCc sets the "cc" field. func (u *BatchMsgUpsert) SetCc(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldCc, v) return u } // UpdateCc sets the "cc" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateCc() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldCc) return u } // ClearCc clears the value of the "cc" field. func (u *BatchMsgUpsert) ClearCc() *BatchMsgUpsert { u.SetNull(batchmsg.FieldCc) return u } // SetPhone sets the "phone" field. func (u *BatchMsgUpsert) SetPhone(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldPhone, v) return u } // UpdatePhone sets the "phone" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdatePhone() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldPhone) return u } // ClearPhone clears the value of the "phone" field. func (u *BatchMsgUpsert) ClearPhone() *BatchMsgUpsert { u.SetNull(batchmsg.FieldPhone) return u } // SetTemplateName sets the "template_name" field. func (u *BatchMsgUpsert) SetTemplateName(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldTemplateName, v) return u } // UpdateTemplateName sets the "template_name" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateTemplateName() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldTemplateName) return u } // ClearTemplateName clears the value of the "template_name" field. func (u *BatchMsgUpsert) ClearTemplateName() *BatchMsgUpsert { u.SetNull(batchmsg.FieldTemplateName) return u } // SetTemplateCode sets the "template_code" field. func (u *BatchMsgUpsert) SetTemplateCode(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldTemplateCode, v) return u } // UpdateTemplateCode sets the "template_code" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateTemplateCode() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldTemplateCode) return u } // ClearTemplateCode clears the value of the "template_code" field. func (u *BatchMsgUpsert) ClearTemplateCode() *BatchMsgUpsert { u.SetNull(batchmsg.FieldTemplateCode) return u } // SetLang sets the "lang" field. func (u *BatchMsgUpsert) SetLang(v string) *BatchMsgUpsert { u.Set(batchmsg.FieldLang, v) return u } // UpdateLang sets the "lang" field to the value that was provided on create. func (u *BatchMsgUpsert) UpdateLang() *BatchMsgUpsert { u.SetExcluded(batchmsg.FieldLang) return u } // ClearLang clears the value of the "lang" field. func (u *BatchMsgUpsert) ClearLang() *BatchMsgUpsert { u.SetNull(batchmsg.FieldLang) return u } // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. // Using this option is equivalent to using: // // client.BatchMsg.Create(). // OnConflict( // sql.ResolveWithNewValues(), // sql.ResolveWith(func(u *sql.UpdateSet) { // u.SetIgnore(batchmsg.FieldID) // }), // ). // Exec(ctx) func (u *BatchMsgUpsertOne) UpdateNewValues() *BatchMsgUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { if _, exists := u.create.mutation.ID(); exists { s.SetIgnore(batchmsg.FieldID) } if _, exists := u.create.mutation.CreatedAt(); exists { s.SetIgnore(batchmsg.FieldCreatedAt) } })) return u } // Ignore sets each column to itself in case of conflict. // Using this option is equivalent to using: // // client.BatchMsg.Create(). // OnConflict(sql.ResolveWithIgnore()). // Exec(ctx) func (u *BatchMsgUpsertOne) Ignore() *BatchMsgUpsertOne { 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 *BatchMsgUpsertOne) DoNothing() *BatchMsgUpsertOne { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u } // Update allows overriding fields `UPDATE` values. See the BatchMsgCreate.OnConflict // documentation for more info. func (u *BatchMsgUpsertOne) Update(set func(*BatchMsgUpsert)) *BatchMsgUpsertOne { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BatchMsgUpsert{UpdateSet: update}) })) return u } // SetUpdatedAt sets the "updated_at" field. func (u *BatchMsgUpsertOne) SetUpdatedAt(v time.Time) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetUpdatedAt(v) }) } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateUpdatedAt() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateUpdatedAt() }) } // SetDeletedAt sets the "deleted_at" field. func (u *BatchMsgUpsertOne) SetDeletedAt(v time.Time) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetDeletedAt(v) }) } // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateDeletedAt() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateDeletedAt() }) } // ClearDeletedAt clears the value of the "deleted_at" field. func (u *BatchMsgUpsertOne) ClearDeletedAt() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearDeletedAt() }) } // SetStatus sets the "status" field. func (u *BatchMsgUpsertOne) SetStatus(v uint8) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetStatus(v) }) } // AddStatus adds v to the "status" field. func (u *BatchMsgUpsertOne) AddStatus(v uint8) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.AddStatus(v) }) } // UpdateStatus sets the "status" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateStatus() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateStatus() }) } // ClearStatus clears the value of the "status" field. func (u *BatchMsgUpsertOne) ClearStatus() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearStatus() }) } // SetBatchNo sets the "batch_no" field. func (u *BatchMsgUpsertOne) SetBatchNo(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetBatchNo(v) }) } // UpdateBatchNo sets the "batch_no" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateBatchNo() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateBatchNo() }) } // ClearBatchNo clears the value of the "batch_no" field. func (u *BatchMsgUpsertOne) ClearBatchNo() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearBatchNo() }) } // SetTaskName sets the "task_name" field. func (u *BatchMsgUpsertOne) SetTaskName(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetTaskName(v) }) } // UpdateTaskName sets the "task_name" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateTaskName() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTaskName() }) } // ClearTaskName clears the value of the "task_name" field. func (u *BatchMsgUpsertOne) ClearTaskName() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearTaskName() }) } // SetFromwxid sets the "fromwxid" field. func (u *BatchMsgUpsertOne) SetFromwxid(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetFromwxid(v) }) } // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateFromwxid() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateFromwxid() }) } // ClearFromwxid clears the value of the "fromwxid" field. func (u *BatchMsgUpsertOne) ClearFromwxid() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearFromwxid() }) } // SetMsg sets the "msg" field. func (u *BatchMsgUpsertOne) SetMsg(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetMsg(v) }) } // UpdateMsg sets the "msg" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateMsg() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateMsg() }) } // ClearMsg clears the value of the "msg" field. func (u *BatchMsgUpsertOne) ClearMsg() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearMsg() }) } // SetTag sets the "tag" field. func (u *BatchMsgUpsertOne) SetTag(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetTag(v) }) } // UpdateTag sets the "tag" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateTag() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTag() }) } // ClearTag clears the value of the "tag" field. func (u *BatchMsgUpsertOne) ClearTag() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearTag() }) } // SetTagids sets the "tagids" field. func (u *BatchMsgUpsertOne) SetTagids(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetTagids(v) }) } // UpdateTagids sets the "tagids" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateTagids() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTagids() }) } // ClearTagids clears the value of the "tagids" field. func (u *BatchMsgUpsertOne) ClearTagids() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearTagids() }) } // SetTotal sets the "total" field. func (u *BatchMsgUpsertOne) SetTotal(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetTotal(v) }) } // AddTotal adds v to the "total" field. func (u *BatchMsgUpsertOne) AddTotal(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.AddTotal(v) }) } // UpdateTotal sets the "total" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateTotal() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTotal() }) } // ClearTotal clears the value of the "total" field. func (u *BatchMsgUpsertOne) ClearTotal() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearTotal() }) } // SetSuccess sets the "success" field. func (u *BatchMsgUpsertOne) SetSuccess(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetSuccess(v) }) } // AddSuccess adds v to the "success" field. func (u *BatchMsgUpsertOne) AddSuccess(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.AddSuccess(v) }) } // UpdateSuccess sets the "success" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateSuccess() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateSuccess() }) } // ClearSuccess clears the value of the "success" field. func (u *BatchMsgUpsertOne) ClearSuccess() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearSuccess() }) } // SetFail sets the "fail" field. func (u *BatchMsgUpsertOne) SetFail(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetFail(v) }) } // AddFail adds v to the "fail" field. func (u *BatchMsgUpsertOne) AddFail(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.AddFail(v) }) } // UpdateFail sets the "fail" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateFail() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateFail() }) } // ClearFail clears the value of the "fail" field. func (u *BatchMsgUpsertOne) ClearFail() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearFail() }) } // SetStartTime sets the "start_time" field. func (u *BatchMsgUpsertOne) SetStartTime(v time.Time) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetStartTime(v) }) } // UpdateStartTime sets the "start_time" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateStartTime() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateStartTime() }) } // ClearStartTime clears the value of the "start_time" field. func (u *BatchMsgUpsertOne) ClearStartTime() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearStartTime() }) } // SetStopTime sets the "stop_time" field. func (u *BatchMsgUpsertOne) SetStopTime(v time.Time) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetStopTime(v) }) } // UpdateStopTime sets the "stop_time" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateStopTime() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateStopTime() }) } // ClearStopTime clears the value of the "stop_time" field. func (u *BatchMsgUpsertOne) ClearStopTime() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearStopTime() }) } // SetSendTime sets the "send_time" field. func (u *BatchMsgUpsertOne) SetSendTime(v time.Time) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetSendTime(v) }) } // UpdateSendTime sets the "send_time" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateSendTime() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateSendTime() }) } // ClearSendTime clears the value of the "send_time" field. func (u *BatchMsgUpsertOne) ClearSendTime() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearSendTime() }) } // SetType sets the "type" field. func (u *BatchMsgUpsertOne) SetType(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetType(v) }) } // AddType adds v to the "type" field. func (u *BatchMsgUpsertOne) AddType(v int32) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.AddType(v) }) } // UpdateType sets the "type" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateType() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateType() }) } // ClearType clears the value of the "type" field. func (u *BatchMsgUpsertOne) ClearType() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearType() }) } // SetOrganizationID sets the "organization_id" field. func (u *BatchMsgUpsertOne) SetOrganizationID(v uint64) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetOrganizationID(v) }) } // AddOrganizationID adds v to the "organization_id" field. func (u *BatchMsgUpsertOne) AddOrganizationID(v uint64) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.AddOrganizationID(v) }) } // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateOrganizationID() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateOrganizationID() }) } // SetCtype sets the "ctype" field. func (u *BatchMsgUpsertOne) SetCtype(v uint64) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetCtype(v) }) } // AddCtype adds v to the "ctype" field. func (u *BatchMsgUpsertOne) AddCtype(v uint64) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.AddCtype(v) }) } // UpdateCtype sets the "ctype" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateCtype() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateCtype() }) } // SetCc sets the "cc" field. func (u *BatchMsgUpsertOne) SetCc(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetCc(v) }) } // UpdateCc sets the "cc" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateCc() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateCc() }) } // ClearCc clears the value of the "cc" field. func (u *BatchMsgUpsertOne) ClearCc() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearCc() }) } // SetPhone sets the "phone" field. func (u *BatchMsgUpsertOne) SetPhone(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetPhone(v) }) } // UpdatePhone sets the "phone" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdatePhone() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdatePhone() }) } // ClearPhone clears the value of the "phone" field. func (u *BatchMsgUpsertOne) ClearPhone() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearPhone() }) } // SetTemplateName sets the "template_name" field. func (u *BatchMsgUpsertOne) SetTemplateName(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetTemplateName(v) }) } // UpdateTemplateName sets the "template_name" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateTemplateName() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTemplateName() }) } // ClearTemplateName clears the value of the "template_name" field. func (u *BatchMsgUpsertOne) ClearTemplateName() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearTemplateName() }) } // SetTemplateCode sets the "template_code" field. func (u *BatchMsgUpsertOne) SetTemplateCode(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetTemplateCode(v) }) } // UpdateTemplateCode sets the "template_code" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateTemplateCode() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTemplateCode() }) } // ClearTemplateCode clears the value of the "template_code" field. func (u *BatchMsgUpsertOne) ClearTemplateCode() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearTemplateCode() }) } // SetLang sets the "lang" field. func (u *BatchMsgUpsertOne) SetLang(v string) *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.SetLang(v) }) } // UpdateLang sets the "lang" field to the value that was provided on create. func (u *BatchMsgUpsertOne) UpdateLang() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.UpdateLang() }) } // ClearLang clears the value of the "lang" field. func (u *BatchMsgUpsertOne) ClearLang() *BatchMsgUpsertOne { return u.Update(func(s *BatchMsgUpsert) { s.ClearLang() }) } // Exec executes the query. func (u *BatchMsgUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { return errors.New("ent: missing options for BatchMsgCreate.OnConflict") } return u.create.Exec(ctx) } // ExecX is like Exec, but panics if an error occurs. func (u *BatchMsgUpsertOne) 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 *BatchMsgUpsertOne) ID(ctx context.Context) (id uint64, 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 *BatchMsgUpsertOne) IDX(ctx context.Context) uint64 { id, err := u.ID(ctx) if err != nil { panic(err) } return id } // BatchMsgCreateBulk is the builder for creating many BatchMsg entities in bulk. type BatchMsgCreateBulk struct { config err error builders []*BatchMsgCreate conflict []sql.ConflictOption } // Save creates the BatchMsg entities in the database. func (bmcb *BatchMsgCreateBulk) Save(ctx context.Context) ([]*BatchMsg, error) { if bmcb.err != nil { return nil, bmcb.err } specs := make([]*sqlgraph.CreateSpec, len(bmcb.builders)) nodes := make([]*BatchMsg, len(bmcb.builders)) mutators := make([]Mutator, len(bmcb.builders)) for i := range bmcb.builders { func(i int, root context.Context) { builder := bmcb.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BatchMsgMutation) 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, bmcb.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} spec.OnConflict = bmcb.conflict // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, bmcb.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 && nodes[i].ID == 0 { id := specs[i].ID.Value.(int64) nodes[i].ID = uint64(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, bmcb.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (bmcb *BatchMsgCreateBulk) SaveX(ctx context.Context) []*BatchMsg { v, err := bmcb.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (bmcb *BatchMsgCreateBulk) Exec(ctx context.Context) error { _, err := bmcb.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (bmcb *BatchMsgCreateBulk) ExecX(ctx context.Context) { if err := bmcb.Exec(ctx); err != nil { panic(err) } } // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause // of the `INSERT` statement. For example: // // client.BatchMsg.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.BatchMsgUpsert) { // SetCreatedAt(v+v). // }). // Exec(ctx) func (bmcb *BatchMsgCreateBulk) OnConflict(opts ...sql.ConflictOption) *BatchMsgUpsertBulk { bmcb.conflict = opts return &BatchMsgUpsertBulk{ create: bmcb, } } // OnConflictColumns calls `OnConflict` and configures the columns // as conflict target. Using this option is equivalent to using: // // client.BatchMsg.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) func (bmcb *BatchMsgCreateBulk) OnConflictColumns(columns ...string) *BatchMsgUpsertBulk { bmcb.conflict = append(bmcb.conflict, sql.ConflictColumns(columns...)) return &BatchMsgUpsertBulk{ create: bmcb, } } // BatchMsgUpsertBulk is the builder for "upsert"-ing // a bulk of BatchMsg nodes. type BatchMsgUpsertBulk struct { create *BatchMsgCreateBulk } // UpdateNewValues updates the mutable fields using the new values that // were set on create. Using this option is equivalent to using: // // client.BatchMsg.Create(). // OnConflict( // sql.ResolveWithNewValues(), // sql.ResolveWith(func(u *sql.UpdateSet) { // u.SetIgnore(batchmsg.FieldID) // }), // ). // Exec(ctx) func (u *BatchMsgUpsertBulk) UpdateNewValues() *BatchMsgUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { for _, b := range u.create.builders { if _, exists := b.mutation.ID(); exists { s.SetIgnore(batchmsg.FieldID) } if _, exists := b.mutation.CreatedAt(); exists { s.SetIgnore(batchmsg.FieldCreatedAt) } } })) return u } // Ignore sets each column to itself in case of conflict. // Using this option is equivalent to using: // // client.BatchMsg.Create(). // OnConflict(sql.ResolveWithIgnore()). // Exec(ctx) func (u *BatchMsgUpsertBulk) Ignore() *BatchMsgUpsertBulk { 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 *BatchMsgUpsertBulk) DoNothing() *BatchMsgUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u } // Update allows overriding fields `UPDATE` values. See the BatchMsgCreateBulk.OnConflict // documentation for more info. func (u *BatchMsgUpsertBulk) Update(set func(*BatchMsgUpsert)) *BatchMsgUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BatchMsgUpsert{UpdateSet: update}) })) return u } // SetUpdatedAt sets the "updated_at" field. func (u *BatchMsgUpsertBulk) SetUpdatedAt(v time.Time) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetUpdatedAt(v) }) } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateUpdatedAt() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateUpdatedAt() }) } // SetDeletedAt sets the "deleted_at" field. func (u *BatchMsgUpsertBulk) SetDeletedAt(v time.Time) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetDeletedAt(v) }) } // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateDeletedAt() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateDeletedAt() }) } // ClearDeletedAt clears the value of the "deleted_at" field. func (u *BatchMsgUpsertBulk) ClearDeletedAt() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearDeletedAt() }) } // SetStatus sets the "status" field. func (u *BatchMsgUpsertBulk) SetStatus(v uint8) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetStatus(v) }) } // AddStatus adds v to the "status" field. func (u *BatchMsgUpsertBulk) AddStatus(v uint8) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.AddStatus(v) }) } // UpdateStatus sets the "status" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateStatus() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateStatus() }) } // ClearStatus clears the value of the "status" field. func (u *BatchMsgUpsertBulk) ClearStatus() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearStatus() }) } // SetBatchNo sets the "batch_no" field. func (u *BatchMsgUpsertBulk) SetBatchNo(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetBatchNo(v) }) } // UpdateBatchNo sets the "batch_no" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateBatchNo() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateBatchNo() }) } // ClearBatchNo clears the value of the "batch_no" field. func (u *BatchMsgUpsertBulk) ClearBatchNo() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearBatchNo() }) } // SetTaskName sets the "task_name" field. func (u *BatchMsgUpsertBulk) SetTaskName(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetTaskName(v) }) } // UpdateTaskName sets the "task_name" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateTaskName() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTaskName() }) } // ClearTaskName clears the value of the "task_name" field. func (u *BatchMsgUpsertBulk) ClearTaskName() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearTaskName() }) } // SetFromwxid sets the "fromwxid" field. func (u *BatchMsgUpsertBulk) SetFromwxid(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetFromwxid(v) }) } // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateFromwxid() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateFromwxid() }) } // ClearFromwxid clears the value of the "fromwxid" field. func (u *BatchMsgUpsertBulk) ClearFromwxid() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearFromwxid() }) } // SetMsg sets the "msg" field. func (u *BatchMsgUpsertBulk) SetMsg(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetMsg(v) }) } // UpdateMsg sets the "msg" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateMsg() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateMsg() }) } // ClearMsg clears the value of the "msg" field. func (u *BatchMsgUpsertBulk) ClearMsg() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearMsg() }) } // SetTag sets the "tag" field. func (u *BatchMsgUpsertBulk) SetTag(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetTag(v) }) } // UpdateTag sets the "tag" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateTag() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTag() }) } // ClearTag clears the value of the "tag" field. func (u *BatchMsgUpsertBulk) ClearTag() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearTag() }) } // SetTagids sets the "tagids" field. func (u *BatchMsgUpsertBulk) SetTagids(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetTagids(v) }) } // UpdateTagids sets the "tagids" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateTagids() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTagids() }) } // ClearTagids clears the value of the "tagids" field. func (u *BatchMsgUpsertBulk) ClearTagids() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearTagids() }) } // SetTotal sets the "total" field. func (u *BatchMsgUpsertBulk) SetTotal(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetTotal(v) }) } // AddTotal adds v to the "total" field. func (u *BatchMsgUpsertBulk) AddTotal(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.AddTotal(v) }) } // UpdateTotal sets the "total" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateTotal() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTotal() }) } // ClearTotal clears the value of the "total" field. func (u *BatchMsgUpsertBulk) ClearTotal() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearTotal() }) } // SetSuccess sets the "success" field. func (u *BatchMsgUpsertBulk) SetSuccess(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetSuccess(v) }) } // AddSuccess adds v to the "success" field. func (u *BatchMsgUpsertBulk) AddSuccess(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.AddSuccess(v) }) } // UpdateSuccess sets the "success" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateSuccess() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateSuccess() }) } // ClearSuccess clears the value of the "success" field. func (u *BatchMsgUpsertBulk) ClearSuccess() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearSuccess() }) } // SetFail sets the "fail" field. func (u *BatchMsgUpsertBulk) SetFail(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetFail(v) }) } // AddFail adds v to the "fail" field. func (u *BatchMsgUpsertBulk) AddFail(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.AddFail(v) }) } // UpdateFail sets the "fail" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateFail() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateFail() }) } // ClearFail clears the value of the "fail" field. func (u *BatchMsgUpsertBulk) ClearFail() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearFail() }) } // SetStartTime sets the "start_time" field. func (u *BatchMsgUpsertBulk) SetStartTime(v time.Time) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetStartTime(v) }) } // UpdateStartTime sets the "start_time" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateStartTime() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateStartTime() }) } // ClearStartTime clears the value of the "start_time" field. func (u *BatchMsgUpsertBulk) ClearStartTime() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearStartTime() }) } // SetStopTime sets the "stop_time" field. func (u *BatchMsgUpsertBulk) SetStopTime(v time.Time) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetStopTime(v) }) } // UpdateStopTime sets the "stop_time" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateStopTime() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateStopTime() }) } // ClearStopTime clears the value of the "stop_time" field. func (u *BatchMsgUpsertBulk) ClearStopTime() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearStopTime() }) } // SetSendTime sets the "send_time" field. func (u *BatchMsgUpsertBulk) SetSendTime(v time.Time) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetSendTime(v) }) } // UpdateSendTime sets the "send_time" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateSendTime() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateSendTime() }) } // ClearSendTime clears the value of the "send_time" field. func (u *BatchMsgUpsertBulk) ClearSendTime() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearSendTime() }) } // SetType sets the "type" field. func (u *BatchMsgUpsertBulk) SetType(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetType(v) }) } // AddType adds v to the "type" field. func (u *BatchMsgUpsertBulk) AddType(v int32) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.AddType(v) }) } // UpdateType sets the "type" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateType() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateType() }) } // ClearType clears the value of the "type" field. func (u *BatchMsgUpsertBulk) ClearType() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearType() }) } // SetOrganizationID sets the "organization_id" field. func (u *BatchMsgUpsertBulk) SetOrganizationID(v uint64) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetOrganizationID(v) }) } // AddOrganizationID adds v to the "organization_id" field. func (u *BatchMsgUpsertBulk) AddOrganizationID(v uint64) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.AddOrganizationID(v) }) } // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateOrganizationID() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateOrganizationID() }) } // SetCtype sets the "ctype" field. func (u *BatchMsgUpsertBulk) SetCtype(v uint64) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetCtype(v) }) } // AddCtype adds v to the "ctype" field. func (u *BatchMsgUpsertBulk) AddCtype(v uint64) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.AddCtype(v) }) } // UpdateCtype sets the "ctype" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateCtype() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateCtype() }) } // SetCc sets the "cc" field. func (u *BatchMsgUpsertBulk) SetCc(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetCc(v) }) } // UpdateCc sets the "cc" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateCc() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateCc() }) } // ClearCc clears the value of the "cc" field. func (u *BatchMsgUpsertBulk) ClearCc() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearCc() }) } // SetPhone sets the "phone" field. func (u *BatchMsgUpsertBulk) SetPhone(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetPhone(v) }) } // UpdatePhone sets the "phone" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdatePhone() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdatePhone() }) } // ClearPhone clears the value of the "phone" field. func (u *BatchMsgUpsertBulk) ClearPhone() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearPhone() }) } // SetTemplateName sets the "template_name" field. func (u *BatchMsgUpsertBulk) SetTemplateName(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetTemplateName(v) }) } // UpdateTemplateName sets the "template_name" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateTemplateName() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTemplateName() }) } // ClearTemplateName clears the value of the "template_name" field. func (u *BatchMsgUpsertBulk) ClearTemplateName() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearTemplateName() }) } // SetTemplateCode sets the "template_code" field. func (u *BatchMsgUpsertBulk) SetTemplateCode(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetTemplateCode(v) }) } // UpdateTemplateCode sets the "template_code" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateTemplateCode() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateTemplateCode() }) } // ClearTemplateCode clears the value of the "template_code" field. func (u *BatchMsgUpsertBulk) ClearTemplateCode() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearTemplateCode() }) } // SetLang sets the "lang" field. func (u *BatchMsgUpsertBulk) SetLang(v string) *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.SetLang(v) }) } // UpdateLang sets the "lang" field to the value that was provided on create. func (u *BatchMsgUpsertBulk) UpdateLang() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.UpdateLang() }) } // ClearLang clears the value of the "lang" field. func (u *BatchMsgUpsertBulk) ClearLang() *BatchMsgUpsertBulk { return u.Update(func(s *BatchMsgUpsert) { s.ClearLang() }) } // Exec executes the query. func (u *BatchMsgUpsertBulk) 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 BatchMsgCreateBulk instead", i) } } if len(u.create.conflict) == 0 { return errors.New("ent: missing options for BatchMsgCreateBulk.OnConflict") } return u.create.Exec(ctx) } // ExecX is like Exec, but panics if an error occurs. func (u *BatchMsgUpsertBulk) ExecX(ctx context.Context) { if err := u.create.Exec(ctx); err != nil { panic(err) } }