// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "mingyang-admin-pay/rpc/ent/app" "mingyang-admin-pay/rpc/ent/paychannel" "mingyang-admin-pay/rpc/ent/paynotifytask" "mingyang-admin-pay/rpc/ent/predicate" "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" ) // AppUpdate is the builder for updating App entities. type AppUpdate struct { config hooks []Hook mutation *AppMutation } // Where appends a list predicates to the AppUpdate builder. func (_u *AppUpdate) Where(ps ...predicate.App) *AppUpdate { _u.mutation.Where(ps...) return _u } // SetUpdatedAt sets the "updated_at" field. func (_u *AppUpdate) SetUpdatedAt(v time.Time) *AppUpdate { _u.mutation.SetUpdatedAt(v) return _u } // SetStatus sets the "status" field. func (_u *AppUpdate) SetStatus(v uint8) *AppUpdate { _u.mutation.ResetStatus() _u.mutation.SetStatus(v) return _u } // SetNillableStatus sets the "status" field if the given value is not nil. func (_u *AppUpdate) SetNillableStatus(v *uint8) *AppUpdate { if v != nil { _u.SetStatus(*v) } return _u } // AddStatus adds value to the "status" field. func (_u *AppUpdate) AddStatus(v int8) *AppUpdate { _u.mutation.AddStatus(v) return _u } // ClearStatus clears the value of the "status" field. func (_u *AppUpdate) ClearStatus() *AppUpdate { _u.mutation.ClearStatus() return _u } // SetDeletedAt sets the "deleted_at" field. func (_u *AppUpdate) SetDeletedAt(v time.Time) *AppUpdate { _u.mutation.SetDeletedAt(v) return _u } // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. func (_u *AppUpdate) SetNillableDeletedAt(v *time.Time) *AppUpdate { if v != nil { _u.SetDeletedAt(*v) } return _u } // ClearDeletedAt clears the value of the "deleted_at" field. func (_u *AppUpdate) ClearDeletedAt() *AppUpdate { _u.mutation.ClearDeletedAt() return _u } // SetAppKey sets the "app_key" field. func (_u *AppUpdate) SetAppKey(v string) *AppUpdate { _u.mutation.SetAppKey(v) return _u } // SetNillableAppKey sets the "app_key" field if the given value is not nil. func (_u *AppUpdate) SetNillableAppKey(v *string) *AppUpdate { if v != nil { _u.SetAppKey(*v) } return _u } // SetAppName sets the "app_name" field. func (_u *AppUpdate) SetAppName(v string) *AppUpdate { _u.mutation.SetAppName(v) return _u } // SetNillableAppName sets the "app_name" field if the given value is not nil. func (_u *AppUpdate) SetNillableAppName(v *string) *AppUpdate { if v != nil { _u.SetAppName(*v) } return _u } // SetOrderNotifyURL sets the "order_notify_url" field. func (_u *AppUpdate) SetOrderNotifyURL(v string) *AppUpdate { _u.mutation.SetOrderNotifyURL(v) return _u } // SetNillableOrderNotifyURL sets the "order_notify_url" field if the given value is not nil. func (_u *AppUpdate) SetNillableOrderNotifyURL(v *string) *AppUpdate { if v != nil { _u.SetOrderNotifyURL(*v) } return _u } // ClearOrderNotifyURL clears the value of the "order_notify_url" field. func (_u *AppUpdate) ClearOrderNotifyURL() *AppUpdate { _u.mutation.ClearOrderNotifyURL() return _u } // SetRefundNotifyURL sets the "refund_notify_url" field. func (_u *AppUpdate) SetRefundNotifyURL(v string) *AppUpdate { _u.mutation.SetRefundNotifyURL(v) return _u } // SetNillableRefundNotifyURL sets the "refund_notify_url" field if the given value is not nil. func (_u *AppUpdate) SetNillableRefundNotifyURL(v *string) *AppUpdate { if v != nil { _u.SetRefundNotifyURL(*v) } return _u } // ClearRefundNotifyURL clears the value of the "refund_notify_url" field. func (_u *AppUpdate) ClearRefundNotifyURL() *AppUpdate { _u.mutation.ClearRefundNotifyURL() return _u } // AddChannelIDs adds the "channel" edge to the PayChannel entity by IDs. func (_u *AppUpdate) AddChannelIDs(ids ...uint64) *AppUpdate { _u.mutation.AddChannelIDs(ids...) return _u } // AddChannel adds the "channel" edges to the PayChannel entity. func (_u *AppUpdate) AddChannel(v ...*PayChannel) *AppUpdate { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddChannelIDs(ids...) } // AddNotifyTaskIDs adds the "notify_task" edge to the PayNotifyTask entity by IDs. func (_u *AppUpdate) AddNotifyTaskIDs(ids ...uint64) *AppUpdate { _u.mutation.AddNotifyTaskIDs(ids...) return _u } // AddNotifyTask adds the "notify_task" edges to the PayNotifyTask entity. func (_u *AppUpdate) AddNotifyTask(v ...*PayNotifyTask) *AppUpdate { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddNotifyTaskIDs(ids...) } // Mutation returns the AppMutation object of the builder. func (_u *AppUpdate) Mutation() *AppMutation { return _u.mutation } // ClearChannel clears all "channel" edges to the PayChannel entity. func (_u *AppUpdate) ClearChannel() *AppUpdate { _u.mutation.ClearChannel() return _u } // RemoveChannelIDs removes the "channel" edge to PayChannel entities by IDs. func (_u *AppUpdate) RemoveChannelIDs(ids ...uint64) *AppUpdate { _u.mutation.RemoveChannelIDs(ids...) return _u } // RemoveChannel removes "channel" edges to PayChannel entities. func (_u *AppUpdate) RemoveChannel(v ...*PayChannel) *AppUpdate { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveChannelIDs(ids...) } // ClearNotifyTask clears all "notify_task" edges to the PayNotifyTask entity. func (_u *AppUpdate) ClearNotifyTask() *AppUpdate { _u.mutation.ClearNotifyTask() return _u } // RemoveNotifyTaskIDs removes the "notify_task" edge to PayNotifyTask entities by IDs. func (_u *AppUpdate) RemoveNotifyTaskIDs(ids ...uint64) *AppUpdate { _u.mutation.RemoveNotifyTaskIDs(ids...) return _u } // RemoveNotifyTask removes "notify_task" edges to PayNotifyTask entities. func (_u *AppUpdate) RemoveNotifyTask(v ...*PayNotifyTask) *AppUpdate { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveNotifyTaskIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *AppUpdate) Save(ctx context.Context) (int, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AppUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *AppUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AppUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_u *AppUpdate) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := app.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) } } func (_u *AppUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(app.Table, app.Columns, sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(app.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.Status(); ok { _spec.SetField(app.FieldStatus, field.TypeUint8, value) } if value, ok := _u.mutation.AddedStatus(); ok { _spec.AddField(app.FieldStatus, field.TypeUint8, value) } if _u.mutation.StatusCleared() { _spec.ClearField(app.FieldStatus, field.TypeUint8) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(app.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(app.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.AppKey(); ok { _spec.SetField(app.FieldAppKey, field.TypeString, value) } if value, ok := _u.mutation.AppName(); ok { _spec.SetField(app.FieldAppName, field.TypeString, value) } if value, ok := _u.mutation.OrderNotifyURL(); ok { _spec.SetField(app.FieldOrderNotifyURL, field.TypeString, value) } if _u.mutation.OrderNotifyURLCleared() { _spec.ClearField(app.FieldOrderNotifyURL, field.TypeString) } if value, ok := _u.mutation.RefundNotifyURL(); ok { _spec.SetField(app.FieldRefundNotifyURL, field.TypeString, value) } if _u.mutation.RefundNotifyURLCleared() { _spec.ClearField(app.FieldRefundNotifyURL, field.TypeString) } if _u.mutation.ChannelCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.ChannelTable, Columns: []string{app.ChannelColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedChannelIDs(); len(nodes) > 0 && !_u.mutation.ChannelCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.ChannelTable, Columns: []string{app.ChannelColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ChannelIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.ChannelTable, Columns: []string{app.ChannelColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.NotifyTaskCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.NotifyTaskTable, Columns: []string{app.NotifyTaskColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedNotifyTaskIDs(); len(nodes) > 0 && !_u.mutation.NotifyTaskCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.NotifyTaskTable, Columns: []string{app.NotifyTaskColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.NotifyTaskIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.NotifyTaskTable, Columns: []string{app.NotifyTaskColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{app.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // AppUpdateOne is the builder for updating a single App entity. type AppUpdateOne struct { config fields []string hooks []Hook mutation *AppMutation } // SetUpdatedAt sets the "updated_at" field. func (_u *AppUpdateOne) SetUpdatedAt(v time.Time) *AppUpdateOne { _u.mutation.SetUpdatedAt(v) return _u } // SetStatus sets the "status" field. func (_u *AppUpdateOne) SetStatus(v uint8) *AppUpdateOne { _u.mutation.ResetStatus() _u.mutation.SetStatus(v) return _u } // SetNillableStatus sets the "status" field if the given value is not nil. func (_u *AppUpdateOne) SetNillableStatus(v *uint8) *AppUpdateOne { if v != nil { _u.SetStatus(*v) } return _u } // AddStatus adds value to the "status" field. func (_u *AppUpdateOne) AddStatus(v int8) *AppUpdateOne { _u.mutation.AddStatus(v) return _u } // ClearStatus clears the value of the "status" field. func (_u *AppUpdateOne) ClearStatus() *AppUpdateOne { _u.mutation.ClearStatus() return _u } // SetDeletedAt sets the "deleted_at" field. func (_u *AppUpdateOne) SetDeletedAt(v time.Time) *AppUpdateOne { _u.mutation.SetDeletedAt(v) return _u } // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. func (_u *AppUpdateOne) SetNillableDeletedAt(v *time.Time) *AppUpdateOne { if v != nil { _u.SetDeletedAt(*v) } return _u } // ClearDeletedAt clears the value of the "deleted_at" field. func (_u *AppUpdateOne) ClearDeletedAt() *AppUpdateOne { _u.mutation.ClearDeletedAt() return _u } // SetAppKey sets the "app_key" field. func (_u *AppUpdateOne) SetAppKey(v string) *AppUpdateOne { _u.mutation.SetAppKey(v) return _u } // SetNillableAppKey sets the "app_key" field if the given value is not nil. func (_u *AppUpdateOne) SetNillableAppKey(v *string) *AppUpdateOne { if v != nil { _u.SetAppKey(*v) } return _u } // SetAppName sets the "app_name" field. func (_u *AppUpdateOne) SetAppName(v string) *AppUpdateOne { _u.mutation.SetAppName(v) return _u } // SetNillableAppName sets the "app_name" field if the given value is not nil. func (_u *AppUpdateOne) SetNillableAppName(v *string) *AppUpdateOne { if v != nil { _u.SetAppName(*v) } return _u } // SetOrderNotifyURL sets the "order_notify_url" field. func (_u *AppUpdateOne) SetOrderNotifyURL(v string) *AppUpdateOne { _u.mutation.SetOrderNotifyURL(v) return _u } // SetNillableOrderNotifyURL sets the "order_notify_url" field if the given value is not nil. func (_u *AppUpdateOne) SetNillableOrderNotifyURL(v *string) *AppUpdateOne { if v != nil { _u.SetOrderNotifyURL(*v) } return _u } // ClearOrderNotifyURL clears the value of the "order_notify_url" field. func (_u *AppUpdateOne) ClearOrderNotifyURL() *AppUpdateOne { _u.mutation.ClearOrderNotifyURL() return _u } // SetRefundNotifyURL sets the "refund_notify_url" field. func (_u *AppUpdateOne) SetRefundNotifyURL(v string) *AppUpdateOne { _u.mutation.SetRefundNotifyURL(v) return _u } // SetNillableRefundNotifyURL sets the "refund_notify_url" field if the given value is not nil. func (_u *AppUpdateOne) SetNillableRefundNotifyURL(v *string) *AppUpdateOne { if v != nil { _u.SetRefundNotifyURL(*v) } return _u } // ClearRefundNotifyURL clears the value of the "refund_notify_url" field. func (_u *AppUpdateOne) ClearRefundNotifyURL() *AppUpdateOne { _u.mutation.ClearRefundNotifyURL() return _u } // AddChannelIDs adds the "channel" edge to the PayChannel entity by IDs. func (_u *AppUpdateOne) AddChannelIDs(ids ...uint64) *AppUpdateOne { _u.mutation.AddChannelIDs(ids...) return _u } // AddChannel adds the "channel" edges to the PayChannel entity. func (_u *AppUpdateOne) AddChannel(v ...*PayChannel) *AppUpdateOne { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddChannelIDs(ids...) } // AddNotifyTaskIDs adds the "notify_task" edge to the PayNotifyTask entity by IDs. func (_u *AppUpdateOne) AddNotifyTaskIDs(ids ...uint64) *AppUpdateOne { _u.mutation.AddNotifyTaskIDs(ids...) return _u } // AddNotifyTask adds the "notify_task" edges to the PayNotifyTask entity. func (_u *AppUpdateOne) AddNotifyTask(v ...*PayNotifyTask) *AppUpdateOne { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddNotifyTaskIDs(ids...) } // Mutation returns the AppMutation object of the builder. func (_u *AppUpdateOne) Mutation() *AppMutation { return _u.mutation } // ClearChannel clears all "channel" edges to the PayChannel entity. func (_u *AppUpdateOne) ClearChannel() *AppUpdateOne { _u.mutation.ClearChannel() return _u } // RemoveChannelIDs removes the "channel" edge to PayChannel entities by IDs. func (_u *AppUpdateOne) RemoveChannelIDs(ids ...uint64) *AppUpdateOne { _u.mutation.RemoveChannelIDs(ids...) return _u } // RemoveChannel removes "channel" edges to PayChannel entities. func (_u *AppUpdateOne) RemoveChannel(v ...*PayChannel) *AppUpdateOne { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveChannelIDs(ids...) } // ClearNotifyTask clears all "notify_task" edges to the PayNotifyTask entity. func (_u *AppUpdateOne) ClearNotifyTask() *AppUpdateOne { _u.mutation.ClearNotifyTask() return _u } // RemoveNotifyTaskIDs removes the "notify_task" edge to PayNotifyTask entities by IDs. func (_u *AppUpdateOne) RemoveNotifyTaskIDs(ids ...uint64) *AppUpdateOne { _u.mutation.RemoveNotifyTaskIDs(ids...) return _u } // RemoveNotifyTask removes "notify_task" edges to PayNotifyTask entities. func (_u *AppUpdateOne) RemoveNotifyTask(v ...*PayNotifyTask) *AppUpdateOne { ids := make([]uint64, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveNotifyTaskIDs(ids...) } // Where appends a list predicates to the AppUpdate builder. func (_u *AppUpdateOne) Where(ps ...predicate.App) *AppUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *AppUpdateOne) Select(field string, fields ...string) *AppUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated App entity. func (_u *AppUpdateOne) Save(ctx context.Context) (*App, error) { _u.defaults() return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AppUpdateOne) SaveX(ctx context.Context) *App { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *AppUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AppUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_u *AppUpdateOne) defaults() { if _, ok := _u.mutation.UpdatedAt(); !ok { v := app.UpdateDefaultUpdatedAt() _u.mutation.SetUpdatedAt(v) } } func (_u *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { _spec := sqlgraph.NewUpdateSpec(app.Table, app.Columns, sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "App.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, app.FieldID) for _, f := range fields { if !app.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != app.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(app.FieldUpdatedAt, field.TypeTime, value) } if value, ok := _u.mutation.Status(); ok { _spec.SetField(app.FieldStatus, field.TypeUint8, value) } if value, ok := _u.mutation.AddedStatus(); ok { _spec.AddField(app.FieldStatus, field.TypeUint8, value) } if _u.mutation.StatusCleared() { _spec.ClearField(app.FieldStatus, field.TypeUint8) } if value, ok := _u.mutation.DeletedAt(); ok { _spec.SetField(app.FieldDeletedAt, field.TypeTime, value) } if _u.mutation.DeletedAtCleared() { _spec.ClearField(app.FieldDeletedAt, field.TypeTime) } if value, ok := _u.mutation.AppKey(); ok { _spec.SetField(app.FieldAppKey, field.TypeString, value) } if value, ok := _u.mutation.AppName(); ok { _spec.SetField(app.FieldAppName, field.TypeString, value) } if value, ok := _u.mutation.OrderNotifyURL(); ok { _spec.SetField(app.FieldOrderNotifyURL, field.TypeString, value) } if _u.mutation.OrderNotifyURLCleared() { _spec.ClearField(app.FieldOrderNotifyURL, field.TypeString) } if value, ok := _u.mutation.RefundNotifyURL(); ok { _spec.SetField(app.FieldRefundNotifyURL, field.TypeString, value) } if _u.mutation.RefundNotifyURLCleared() { _spec.ClearField(app.FieldRefundNotifyURL, field.TypeString) } if _u.mutation.ChannelCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.ChannelTable, Columns: []string{app.ChannelColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedChannelIDs(); len(nodes) > 0 && !_u.mutation.ChannelCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.ChannelTable, Columns: []string{app.ChannelColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ChannelIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.ChannelTable, Columns: []string{app.ChannelColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.NotifyTaskCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.NotifyTaskTable, Columns: []string{app.NotifyTaskColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedNotifyTaskIDs(); len(nodes) > 0 && !_u.mutation.NotifyTaskCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.NotifyTaskTable, Columns: []string{app.NotifyTaskColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.NotifyTaskIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: app.NotifyTaskTable, Columns: []string{app.NotifyTaskColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &App{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{app.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil }