123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/msg"
- "wechat-api/ent/predicate"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // MsgUpdate is the builder for updating Msg entities.
- type MsgUpdate struct {
- config
- hooks []Hook
- mutation *MsgMutation
- }
- // Where appends a list predicates to the MsgUpdate builder.
- func (mu *MsgUpdate) Where(ps ...predicate.Msg) *MsgUpdate {
- mu.mutation.Where(ps...)
- return mu
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (mu *MsgUpdate) SetUpdatedAt(t time.Time) *MsgUpdate {
- mu.mutation.SetUpdatedAt(t)
- return mu
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (mu *MsgUpdate) SetDeletedAt(t time.Time) *MsgUpdate {
- mu.mutation.SetDeletedAt(t)
- return mu
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableDeletedAt(t *time.Time) *MsgUpdate {
- if t != nil {
- mu.SetDeletedAt(*t)
- }
- return mu
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (mu *MsgUpdate) ClearDeletedAt() *MsgUpdate {
- mu.mutation.ClearDeletedAt()
- return mu
- }
- // SetStatus sets the "status" field.
- func (mu *MsgUpdate) SetStatus(u uint8) *MsgUpdate {
- mu.mutation.ResetStatus()
- mu.mutation.SetStatus(u)
- return mu
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableStatus(u *uint8) *MsgUpdate {
- if u != nil {
- mu.SetStatus(*u)
- }
- return mu
- }
- // AddStatus adds u to the "status" field.
- func (mu *MsgUpdate) AddStatus(u int8) *MsgUpdate {
- mu.mutation.AddStatus(u)
- return mu
- }
- // ClearStatus clears the value of the "status" field.
- func (mu *MsgUpdate) ClearStatus() *MsgUpdate {
- mu.mutation.ClearStatus()
- return mu
- }
- // SetFromwxid sets the "fromwxid" field.
- func (mu *MsgUpdate) SetFromwxid(s string) *MsgUpdate {
- mu.mutation.SetFromwxid(s)
- return mu
- }
- // SetNillableFromwxid sets the "fromwxid" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableFromwxid(s *string) *MsgUpdate {
- if s != nil {
- mu.SetFromwxid(*s)
- }
- return mu
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (mu *MsgUpdate) ClearFromwxid() *MsgUpdate {
- mu.mutation.ClearFromwxid()
- return mu
- }
- // SetToid sets the "toid" field.
- func (mu *MsgUpdate) SetToid(s string) *MsgUpdate {
- mu.mutation.SetToid(s)
- return mu
- }
- // SetNillableToid sets the "toid" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableToid(s *string) *MsgUpdate {
- if s != nil {
- mu.SetToid(*s)
- }
- return mu
- }
- // ClearToid clears the value of the "toid" field.
- func (mu *MsgUpdate) ClearToid() *MsgUpdate {
- mu.mutation.ClearToid()
- return mu
- }
- // SetMsgtype sets the "msgtype" field.
- func (mu *MsgUpdate) SetMsgtype(i int32) *MsgUpdate {
- mu.mutation.ResetMsgtype()
- mu.mutation.SetMsgtype(i)
- return mu
- }
- // SetNillableMsgtype sets the "msgtype" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableMsgtype(i *int32) *MsgUpdate {
- if i != nil {
- mu.SetMsgtype(*i)
- }
- return mu
- }
- // AddMsgtype adds i to the "msgtype" field.
- func (mu *MsgUpdate) AddMsgtype(i int32) *MsgUpdate {
- mu.mutation.AddMsgtype(i)
- return mu
- }
- // ClearMsgtype clears the value of the "msgtype" field.
- func (mu *MsgUpdate) ClearMsgtype() *MsgUpdate {
- mu.mutation.ClearMsgtype()
- return mu
- }
- // SetMsg sets the "msg" field.
- func (mu *MsgUpdate) SetMsg(s string) *MsgUpdate {
- mu.mutation.SetMsg(s)
- return mu
- }
- // SetNillableMsg sets the "msg" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableMsg(s *string) *MsgUpdate {
- if s != nil {
- mu.SetMsg(*s)
- }
- return mu
- }
- // ClearMsg clears the value of the "msg" field.
- func (mu *MsgUpdate) ClearMsg() *MsgUpdate {
- mu.mutation.ClearMsg()
- return mu
- }
- // SetBatchNo sets the "batch_no" field.
- func (mu *MsgUpdate) SetBatchNo(s string) *MsgUpdate {
- mu.mutation.SetBatchNo(s)
- return mu
- }
- // SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableBatchNo(s *string) *MsgUpdate {
- if s != nil {
- mu.SetBatchNo(*s)
- }
- return mu
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (mu *MsgUpdate) ClearBatchNo() *MsgUpdate {
- mu.mutation.ClearBatchNo()
- return mu
- }
- // SetCc sets the "cc" field.
- func (mu *MsgUpdate) SetCc(s string) *MsgUpdate {
- mu.mutation.SetCc(s)
- return mu
- }
- // SetNillableCc sets the "cc" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillableCc(s *string) *MsgUpdate {
- if s != nil {
- mu.SetCc(*s)
- }
- return mu
- }
- // SetPhone sets the "phone" field.
- func (mu *MsgUpdate) SetPhone(s string) *MsgUpdate {
- mu.mutation.SetPhone(s)
- return mu
- }
- // SetNillablePhone sets the "phone" field if the given value is not nil.
- func (mu *MsgUpdate) SetNillablePhone(s *string) *MsgUpdate {
- if s != nil {
- mu.SetPhone(*s)
- }
- return mu
- }
- // Mutation returns the MsgMutation object of the builder.
- func (mu *MsgUpdate) Mutation() *MsgMutation {
- return mu.mutation
- }
- // Save executes the query and returns the number of nodes affected by the update operation.
- func (mu *MsgUpdate) Save(ctx context.Context) (int, error) {
- if err := mu.defaults(); err != nil {
- return 0, err
- }
- return withHooks(ctx, mu.sqlSave, mu.mutation, mu.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (mu *MsgUpdate) SaveX(ctx context.Context) int {
- affected, err := mu.Save(ctx)
- if err != nil {
- panic(err)
- }
- return affected
- }
- // Exec executes the query.
- func (mu *MsgUpdate) Exec(ctx context.Context) error {
- _, err := mu.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (mu *MsgUpdate) ExecX(ctx context.Context) {
- if err := mu.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (mu *MsgUpdate) defaults() error {
- if _, ok := mu.mutation.UpdatedAt(); !ok {
- if msg.UpdateDefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized msg.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := msg.UpdateDefaultUpdatedAt()
- mu.mutation.SetUpdatedAt(v)
- }
- return nil
- }
- func (mu *MsgUpdate) sqlSave(ctx context.Context) (n int, err error) {
- _spec := sqlgraph.NewUpdateSpec(msg.Table, msg.Columns, sqlgraph.NewFieldSpec(msg.FieldID, field.TypeUint64))
- if ps := mu.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := mu.mutation.UpdatedAt(); ok {
- _spec.SetField(msg.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := mu.mutation.DeletedAt(); ok {
- _spec.SetField(msg.FieldDeletedAt, field.TypeTime, value)
- }
- if mu.mutation.DeletedAtCleared() {
- _spec.ClearField(msg.FieldDeletedAt, field.TypeTime)
- }
- if value, ok := mu.mutation.Status(); ok {
- _spec.SetField(msg.FieldStatus, field.TypeUint8, value)
- }
- if value, ok := mu.mutation.AddedStatus(); ok {
- _spec.AddField(msg.FieldStatus, field.TypeUint8, value)
- }
- if mu.mutation.StatusCleared() {
- _spec.ClearField(msg.FieldStatus, field.TypeUint8)
- }
- if value, ok := mu.mutation.Fromwxid(); ok {
- _spec.SetField(msg.FieldFromwxid, field.TypeString, value)
- }
- if mu.mutation.FromwxidCleared() {
- _spec.ClearField(msg.FieldFromwxid, field.TypeString)
- }
- if value, ok := mu.mutation.Toid(); ok {
- _spec.SetField(msg.FieldToid, field.TypeString, value)
- }
- if mu.mutation.ToidCleared() {
- _spec.ClearField(msg.FieldToid, field.TypeString)
- }
- if value, ok := mu.mutation.Msgtype(); ok {
- _spec.SetField(msg.FieldMsgtype, field.TypeInt32, value)
- }
- if value, ok := mu.mutation.AddedMsgtype(); ok {
- _spec.AddField(msg.FieldMsgtype, field.TypeInt32, value)
- }
- if mu.mutation.MsgtypeCleared() {
- _spec.ClearField(msg.FieldMsgtype, field.TypeInt32)
- }
- if value, ok := mu.mutation.Msg(); ok {
- _spec.SetField(msg.FieldMsg, field.TypeString, value)
- }
- if mu.mutation.MsgCleared() {
- _spec.ClearField(msg.FieldMsg, field.TypeString)
- }
- if value, ok := mu.mutation.BatchNo(); ok {
- _spec.SetField(msg.FieldBatchNo, field.TypeString, value)
- }
- if mu.mutation.BatchNoCleared() {
- _spec.ClearField(msg.FieldBatchNo, field.TypeString)
- }
- if value, ok := mu.mutation.Cc(); ok {
- _spec.SetField(msg.FieldCc, field.TypeString, value)
- }
- if value, ok := mu.mutation.Phone(); ok {
- _spec.SetField(msg.FieldPhone, field.TypeString, value)
- }
- if n, err = sqlgraph.UpdateNodes(ctx, mu.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{msg.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return 0, err
- }
- mu.mutation.done = true
- return n, nil
- }
- // MsgUpdateOne is the builder for updating a single Msg entity.
- type MsgUpdateOne struct {
- config
- fields []string
- hooks []Hook
- mutation *MsgMutation
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (muo *MsgUpdateOne) SetUpdatedAt(t time.Time) *MsgUpdateOne {
- muo.mutation.SetUpdatedAt(t)
- return muo
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (muo *MsgUpdateOne) SetDeletedAt(t time.Time) *MsgUpdateOne {
- muo.mutation.SetDeletedAt(t)
- return muo
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableDeletedAt(t *time.Time) *MsgUpdateOne {
- if t != nil {
- muo.SetDeletedAt(*t)
- }
- return muo
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (muo *MsgUpdateOne) ClearDeletedAt() *MsgUpdateOne {
- muo.mutation.ClearDeletedAt()
- return muo
- }
- // SetStatus sets the "status" field.
- func (muo *MsgUpdateOne) SetStatus(u uint8) *MsgUpdateOne {
- muo.mutation.ResetStatus()
- muo.mutation.SetStatus(u)
- return muo
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableStatus(u *uint8) *MsgUpdateOne {
- if u != nil {
- muo.SetStatus(*u)
- }
- return muo
- }
- // AddStatus adds u to the "status" field.
- func (muo *MsgUpdateOne) AddStatus(u int8) *MsgUpdateOne {
- muo.mutation.AddStatus(u)
- return muo
- }
- // ClearStatus clears the value of the "status" field.
- func (muo *MsgUpdateOne) ClearStatus() *MsgUpdateOne {
- muo.mutation.ClearStatus()
- return muo
- }
- // SetFromwxid sets the "fromwxid" field.
- func (muo *MsgUpdateOne) SetFromwxid(s string) *MsgUpdateOne {
- muo.mutation.SetFromwxid(s)
- return muo
- }
- // SetNillableFromwxid sets the "fromwxid" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableFromwxid(s *string) *MsgUpdateOne {
- if s != nil {
- muo.SetFromwxid(*s)
- }
- return muo
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (muo *MsgUpdateOne) ClearFromwxid() *MsgUpdateOne {
- muo.mutation.ClearFromwxid()
- return muo
- }
- // SetToid sets the "toid" field.
- func (muo *MsgUpdateOne) SetToid(s string) *MsgUpdateOne {
- muo.mutation.SetToid(s)
- return muo
- }
- // SetNillableToid sets the "toid" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableToid(s *string) *MsgUpdateOne {
- if s != nil {
- muo.SetToid(*s)
- }
- return muo
- }
- // ClearToid clears the value of the "toid" field.
- func (muo *MsgUpdateOne) ClearToid() *MsgUpdateOne {
- muo.mutation.ClearToid()
- return muo
- }
- // SetMsgtype sets the "msgtype" field.
- func (muo *MsgUpdateOne) SetMsgtype(i int32) *MsgUpdateOne {
- muo.mutation.ResetMsgtype()
- muo.mutation.SetMsgtype(i)
- return muo
- }
- // SetNillableMsgtype sets the "msgtype" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableMsgtype(i *int32) *MsgUpdateOne {
- if i != nil {
- muo.SetMsgtype(*i)
- }
- return muo
- }
- // AddMsgtype adds i to the "msgtype" field.
- func (muo *MsgUpdateOne) AddMsgtype(i int32) *MsgUpdateOne {
- muo.mutation.AddMsgtype(i)
- return muo
- }
- // ClearMsgtype clears the value of the "msgtype" field.
- func (muo *MsgUpdateOne) ClearMsgtype() *MsgUpdateOne {
- muo.mutation.ClearMsgtype()
- return muo
- }
- // SetMsg sets the "msg" field.
- func (muo *MsgUpdateOne) SetMsg(s string) *MsgUpdateOne {
- muo.mutation.SetMsg(s)
- return muo
- }
- // SetNillableMsg sets the "msg" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableMsg(s *string) *MsgUpdateOne {
- if s != nil {
- muo.SetMsg(*s)
- }
- return muo
- }
- // ClearMsg clears the value of the "msg" field.
- func (muo *MsgUpdateOne) ClearMsg() *MsgUpdateOne {
- muo.mutation.ClearMsg()
- return muo
- }
- // SetBatchNo sets the "batch_no" field.
- func (muo *MsgUpdateOne) SetBatchNo(s string) *MsgUpdateOne {
- muo.mutation.SetBatchNo(s)
- return muo
- }
- // SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableBatchNo(s *string) *MsgUpdateOne {
- if s != nil {
- muo.SetBatchNo(*s)
- }
- return muo
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (muo *MsgUpdateOne) ClearBatchNo() *MsgUpdateOne {
- muo.mutation.ClearBatchNo()
- return muo
- }
- // SetCc sets the "cc" field.
- func (muo *MsgUpdateOne) SetCc(s string) *MsgUpdateOne {
- muo.mutation.SetCc(s)
- return muo
- }
- // SetNillableCc sets the "cc" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillableCc(s *string) *MsgUpdateOne {
- if s != nil {
- muo.SetCc(*s)
- }
- return muo
- }
- // SetPhone sets the "phone" field.
- func (muo *MsgUpdateOne) SetPhone(s string) *MsgUpdateOne {
- muo.mutation.SetPhone(s)
- return muo
- }
- // SetNillablePhone sets the "phone" field if the given value is not nil.
- func (muo *MsgUpdateOne) SetNillablePhone(s *string) *MsgUpdateOne {
- if s != nil {
- muo.SetPhone(*s)
- }
- return muo
- }
- // Mutation returns the MsgMutation object of the builder.
- func (muo *MsgUpdateOne) Mutation() *MsgMutation {
- return muo.mutation
- }
- // Where appends a list predicates to the MsgUpdate builder.
- func (muo *MsgUpdateOne) Where(ps ...predicate.Msg) *MsgUpdateOne {
- muo.mutation.Where(ps...)
- return muo
- }
- // Select allows selecting one or more fields (columns) of the returned entity.
- // The default is selecting all fields defined in the entity schema.
- func (muo *MsgUpdateOne) Select(field string, fields ...string) *MsgUpdateOne {
- muo.fields = append([]string{field}, fields...)
- return muo
- }
- // Save executes the query and returns the updated Msg entity.
- func (muo *MsgUpdateOne) Save(ctx context.Context) (*Msg, error) {
- if err := muo.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, muo.sqlSave, muo.mutation, muo.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (muo *MsgUpdateOne) SaveX(ctx context.Context) *Msg {
- node, err := muo.Save(ctx)
- if err != nil {
- panic(err)
- }
- return node
- }
- // Exec executes the query on the entity.
- func (muo *MsgUpdateOne) Exec(ctx context.Context) error {
- _, err := muo.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (muo *MsgUpdateOne) ExecX(ctx context.Context) {
- if err := muo.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (muo *MsgUpdateOne) defaults() error {
- if _, ok := muo.mutation.UpdatedAt(); !ok {
- if msg.UpdateDefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized msg.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := msg.UpdateDefaultUpdatedAt()
- muo.mutation.SetUpdatedAt(v)
- }
- return nil
- }
- func (muo *MsgUpdateOne) sqlSave(ctx context.Context) (_node *Msg, err error) {
- _spec := sqlgraph.NewUpdateSpec(msg.Table, msg.Columns, sqlgraph.NewFieldSpec(msg.FieldID, field.TypeUint64))
- id, ok := muo.mutation.ID()
- if !ok {
- return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Msg.id" for update`)}
- }
- _spec.Node.ID.Value = id
- if fields := muo.fields; len(fields) > 0 {
- _spec.Node.Columns = make([]string, 0, len(fields))
- _spec.Node.Columns = append(_spec.Node.Columns, msg.FieldID)
- for _, f := range fields {
- if !msg.ValidColumn(f) {
- return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
- }
- if f != msg.FieldID {
- _spec.Node.Columns = append(_spec.Node.Columns, f)
- }
- }
- }
- if ps := muo.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := muo.mutation.UpdatedAt(); ok {
- _spec.SetField(msg.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := muo.mutation.DeletedAt(); ok {
- _spec.SetField(msg.FieldDeletedAt, field.TypeTime, value)
- }
- if muo.mutation.DeletedAtCleared() {
- _spec.ClearField(msg.FieldDeletedAt, field.TypeTime)
- }
- if value, ok := muo.mutation.Status(); ok {
- _spec.SetField(msg.FieldStatus, field.TypeUint8, value)
- }
- if value, ok := muo.mutation.AddedStatus(); ok {
- _spec.AddField(msg.FieldStatus, field.TypeUint8, value)
- }
- if muo.mutation.StatusCleared() {
- _spec.ClearField(msg.FieldStatus, field.TypeUint8)
- }
- if value, ok := muo.mutation.Fromwxid(); ok {
- _spec.SetField(msg.FieldFromwxid, field.TypeString, value)
- }
- if muo.mutation.FromwxidCleared() {
- _spec.ClearField(msg.FieldFromwxid, field.TypeString)
- }
- if value, ok := muo.mutation.Toid(); ok {
- _spec.SetField(msg.FieldToid, field.TypeString, value)
- }
- if muo.mutation.ToidCleared() {
- _spec.ClearField(msg.FieldToid, field.TypeString)
- }
- if value, ok := muo.mutation.Msgtype(); ok {
- _spec.SetField(msg.FieldMsgtype, field.TypeInt32, value)
- }
- if value, ok := muo.mutation.AddedMsgtype(); ok {
- _spec.AddField(msg.FieldMsgtype, field.TypeInt32, value)
- }
- if muo.mutation.MsgtypeCleared() {
- _spec.ClearField(msg.FieldMsgtype, field.TypeInt32)
- }
- if value, ok := muo.mutation.Msg(); ok {
- _spec.SetField(msg.FieldMsg, field.TypeString, value)
- }
- if muo.mutation.MsgCleared() {
- _spec.ClearField(msg.FieldMsg, field.TypeString)
- }
- if value, ok := muo.mutation.BatchNo(); ok {
- _spec.SetField(msg.FieldBatchNo, field.TypeString, value)
- }
- if muo.mutation.BatchNoCleared() {
- _spec.ClearField(msg.FieldBatchNo, field.TypeString)
- }
- if value, ok := muo.mutation.Cc(); ok {
- _spec.SetField(msg.FieldCc, field.TypeString, value)
- }
- if value, ok := muo.mutation.Phone(); ok {
- _spec.SetField(msg.FieldPhone, field.TypeString, value)
- }
- _node = &Msg{config: muo.config}
- _spec.Assign = _node.assignValues
- _spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, muo.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{msg.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- muo.mutation.done = true
- return _node, nil
- }
|