1208 lines
37 KiB
Go
1208 lines
37 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"mingyang-admin-pay/rpc/ent/app"
|
|
"mingyang-admin-pay/rpc/ent/paynotifylog"
|
|
"mingyang-admin-pay/rpc/ent/paynotifytask"
|
|
"mingyang-admin-pay/rpc/ent/payorder"
|
|
"mingyang-admin-pay/rpc/ent/predicate"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// PayNotifyTaskUpdate is the builder for updating PayNotifyTask entities.
|
|
type PayNotifyTaskUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *PayNotifyTaskMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the PayNotifyTaskUpdate builder.
|
|
func (_u *PayNotifyTaskUpdate) Where(ps ...predicate.PayNotifyTask) *PayNotifyTaskUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *PayNotifyTaskUpdate) SetUpdatedAt(v time.Time) *PayNotifyTaskUpdate {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *PayNotifyTaskUpdate) SetStatus(v uint8) *PayNotifyTaskUpdate {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableStatus(v *uint8) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *PayNotifyTaskUpdate) AddStatus(v int8) *PayNotifyTaskUpdate {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *PayNotifyTaskUpdate) ClearStatus() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *PayNotifyTaskUpdate) SetDeletedAt(v time.Time) *PayNotifyTaskUpdate {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableDeletedAt(v *time.Time) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *PayNotifyTaskUpdate) ClearDeletedAt() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetType sets the "type" field.
|
|
func (_u *PayNotifyTaskUpdate) SetType(v uint8) *PayNotifyTaskUpdate {
|
|
_u.mutation.ResetType()
|
|
_u.mutation.SetType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableType sets the "type" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableType(v *uint8) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddType adds value to the "type" field.
|
|
func (_u *PayNotifyTaskUpdate) AddType(v int8) *PayNotifyTaskUpdate {
|
|
_u.mutation.AddType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetDataID sets the "data_id" field.
|
|
func (_u *PayNotifyTaskUpdate) SetDataID(v uint64) *PayNotifyTaskUpdate {
|
|
_u.mutation.ResetDataID()
|
|
_u.mutation.SetDataID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDataID sets the "data_id" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableDataID(v *uint64) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetDataID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddDataID adds value to the "data_id" field.
|
|
func (_u *PayNotifyTaskUpdate) AddDataID(v int64) *PayNotifyTaskUpdate {
|
|
_u.mutation.AddDataID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOrderID sets the "order_id" field.
|
|
func (_u *PayNotifyTaskUpdate) SetOrderID(v uint64) *PayNotifyTaskUpdate {
|
|
_u.mutation.SetOrderID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderID sets the "order_id" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableOrderID(v *uint64) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetOrderID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetAppID sets the "app_id" field.
|
|
func (_u *PayNotifyTaskUpdate) SetAppID(v uint64) *PayNotifyTaskUpdate {
|
|
_u.mutation.SetAppID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAppID sets the "app_id" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableAppID(v *uint64) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetAppID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyStatus sets the "notify_status" field.
|
|
func (_u *PayNotifyTaskUpdate) SetNotifyStatus(v uint8) *PayNotifyTaskUpdate {
|
|
_u.mutation.ResetNotifyStatus()
|
|
_u.mutation.SetNotifyStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyStatus sets the "notify_status" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableNotifyStatus(v *uint8) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetNotifyStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddNotifyStatus adds value to the "notify_status" field.
|
|
func (_u *PayNotifyTaskUpdate) AddNotifyStatus(v int8) *PayNotifyTaskUpdate {
|
|
_u.mutation.AddNotifyStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNextNotifyTime sets the "next_notify_time" field.
|
|
func (_u *PayNotifyTaskUpdate) SetNextNotifyTime(v time.Time) *PayNotifyTaskUpdate {
|
|
_u.mutation.SetNextNotifyTime(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNextNotifyTime sets the "next_notify_time" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableNextNotifyTime(v *time.Time) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetNextNotifyTime(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNextNotifyTime clears the value of the "next_notify_time" field.
|
|
func (_u *PayNotifyTaskUpdate) ClearNextNotifyTime() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearNextNotifyTime()
|
|
return _u
|
|
}
|
|
|
|
// SetLastExecuteTime sets the "last_execute_time" field.
|
|
func (_u *PayNotifyTaskUpdate) SetLastExecuteTime(v time.Time) *PayNotifyTaskUpdate {
|
|
_u.mutation.SetLastExecuteTime(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableLastExecuteTime sets the "last_execute_time" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableLastExecuteTime(v *time.Time) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetLastExecuteTime(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearLastExecuteTime clears the value of the "last_execute_time" field.
|
|
func (_u *PayNotifyTaskUpdate) ClearLastExecuteTime() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearLastExecuteTime()
|
|
return _u
|
|
}
|
|
|
|
// SetRetryCount sets the "retry_count" field.
|
|
func (_u *PayNotifyTaskUpdate) SetRetryCount(v uint32) *PayNotifyTaskUpdate {
|
|
_u.mutation.ResetRetryCount()
|
|
_u.mutation.SetRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableRetryCount(v *uint32) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetRetryCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddRetryCount adds value to the "retry_count" field.
|
|
func (_u *PayNotifyTaskUpdate) AddRetryCount(v int32) *PayNotifyTaskUpdate {
|
|
_u.mutation.AddRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearRetryCount clears the value of the "retry_count" field.
|
|
func (_u *PayNotifyTaskUpdate) ClearRetryCount() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearRetryCount()
|
|
return _u
|
|
}
|
|
|
|
// SetMaxRetryCount sets the "max_retry_count" field.
|
|
func (_u *PayNotifyTaskUpdate) SetMaxRetryCount(v uint32) *PayNotifyTaskUpdate {
|
|
_u.mutation.ResetMaxRetryCount()
|
|
_u.mutation.SetMaxRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaxRetryCount sets the "max_retry_count" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableMaxRetryCount(v *uint32) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetMaxRetryCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddMaxRetryCount adds value to the "max_retry_count" field.
|
|
func (_u *PayNotifyTaskUpdate) AddMaxRetryCount(v int32) *PayNotifyTaskUpdate {
|
|
_u.mutation.AddMaxRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearMaxRetryCount clears the value of the "max_retry_count" field.
|
|
func (_u *PayNotifyTaskUpdate) ClearMaxRetryCount() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearMaxRetryCount()
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyURL sets the "notify_url" field.
|
|
func (_u *PayNotifyTaskUpdate) SetNotifyURL(v string) *PayNotifyTaskUpdate {
|
|
_u.mutation.SetNotifyURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyURL sets the "notify_url" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdate) SetNillableNotifyURL(v *string) *PayNotifyTaskUpdate {
|
|
if v != nil {
|
|
_u.SetNotifyURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyURL clears the value of the "notify_url" field.
|
|
func (_u *PayNotifyTaskUpdate) ClearNotifyURL() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearNotifyURL()
|
|
return _u
|
|
}
|
|
|
|
// SetApp sets the "app" edge to the App entity.
|
|
func (_u *PayNotifyTaskUpdate) SetApp(v *App) *PayNotifyTaskUpdate {
|
|
return _u.SetAppID(v.ID)
|
|
}
|
|
|
|
// SetOrder sets the "order" edge to the PayOrder entity.
|
|
func (_u *PayNotifyTaskUpdate) SetOrder(v *PayOrder) *PayNotifyTaskUpdate {
|
|
return _u.SetOrderID(v.ID)
|
|
}
|
|
|
|
// AddNotifyLogIDs adds the "notify_log" edge to the PayNotifyLog entity by IDs.
|
|
func (_u *PayNotifyTaskUpdate) AddNotifyLogIDs(ids ...uint64) *PayNotifyTaskUpdate {
|
|
_u.mutation.AddNotifyLogIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddNotifyLog adds the "notify_log" edges to the PayNotifyLog entity.
|
|
func (_u *PayNotifyTaskUpdate) AddNotifyLog(v ...*PayNotifyLog) *PayNotifyTaskUpdate {
|
|
ids := make([]uint64, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddNotifyLogIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the PayNotifyTaskMutation object of the builder.
|
|
func (_u *PayNotifyTaskUpdate) Mutation() *PayNotifyTaskMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearApp clears the "app" edge to the App entity.
|
|
func (_u *PayNotifyTaskUpdate) ClearApp() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearApp()
|
|
return _u
|
|
}
|
|
|
|
// ClearOrder clears the "order" edge to the PayOrder entity.
|
|
func (_u *PayNotifyTaskUpdate) ClearOrder() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearOrder()
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyLog clears all "notify_log" edges to the PayNotifyLog entity.
|
|
func (_u *PayNotifyTaskUpdate) ClearNotifyLog() *PayNotifyTaskUpdate {
|
|
_u.mutation.ClearNotifyLog()
|
|
return _u
|
|
}
|
|
|
|
// RemoveNotifyLogIDs removes the "notify_log" edge to PayNotifyLog entities by IDs.
|
|
func (_u *PayNotifyTaskUpdate) RemoveNotifyLogIDs(ids ...uint64) *PayNotifyTaskUpdate {
|
|
_u.mutation.RemoveNotifyLogIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveNotifyLog removes "notify_log" edges to PayNotifyLog entities.
|
|
func (_u *PayNotifyTaskUpdate) RemoveNotifyLog(v ...*PayNotifyLog) *PayNotifyTaskUpdate {
|
|
ids := make([]uint64, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveNotifyLogIDs(ids...)
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *PayNotifyTaskUpdate) 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 *PayNotifyTaskUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *PayNotifyTaskUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *PayNotifyTaskUpdate) 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 *PayNotifyTaskUpdate) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := paynotifytask.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *PayNotifyTaskUpdate) check() error {
|
|
if _u.mutation.AppCleared() && len(_u.mutation.AppIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayNotifyTask.app"`)
|
|
}
|
|
if _u.mutation.OrderCleared() && len(_u.mutation.OrderIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayNotifyTask.order"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *PayNotifyTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(paynotifytask.Table, paynotifytask.Columns, sqlgraph.NewFieldSpec(paynotifytask.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(paynotifytask.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(paynotifytask.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(paynotifytask.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(paynotifytask.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(paynotifytask.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(paynotifytask.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.GetType(); ok {
|
|
_spec.SetField(paynotifytask.FieldType, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedType(); ok {
|
|
_spec.AddField(paynotifytask.FieldType, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.DataID(); ok {
|
|
_spec.SetField(paynotifytask.FieldDataID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedDataID(); ok {
|
|
_spec.AddField(paynotifytask.FieldDataID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.NotifyStatus(); ok {
|
|
_spec.SetField(paynotifytask.FieldNotifyStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedNotifyStatus(); ok {
|
|
_spec.AddField(paynotifytask.FieldNotifyStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.NextNotifyTime(); ok {
|
|
_spec.SetField(paynotifytask.FieldNextNotifyTime, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.NextNotifyTimeCleared() {
|
|
_spec.ClearField(paynotifytask.FieldNextNotifyTime, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.LastExecuteTime(); ok {
|
|
_spec.SetField(paynotifytask.FieldLastExecuteTime, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.LastExecuteTimeCleared() {
|
|
_spec.ClearField(paynotifytask.FieldLastExecuteTime, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.RetryCount(); ok {
|
|
_spec.SetField(paynotifytask.FieldRetryCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedRetryCount(); ok {
|
|
_spec.AddField(paynotifytask.FieldRetryCount, field.TypeUint32, value)
|
|
}
|
|
if _u.mutation.RetryCountCleared() {
|
|
_spec.ClearField(paynotifytask.FieldRetryCount, field.TypeUint32)
|
|
}
|
|
if value, ok := _u.mutation.MaxRetryCount(); ok {
|
|
_spec.SetField(paynotifytask.FieldMaxRetryCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedMaxRetryCount(); ok {
|
|
_spec.AddField(paynotifytask.FieldMaxRetryCount, field.TypeUint32, value)
|
|
}
|
|
if _u.mutation.MaxRetryCountCleared() {
|
|
_spec.ClearField(paynotifytask.FieldMaxRetryCount, field.TypeUint32)
|
|
}
|
|
if value, ok := _u.mutation.NotifyURL(); ok {
|
|
_spec.SetField(paynotifytask.FieldNotifyURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NotifyURLCleared() {
|
|
_spec.ClearField(paynotifytask.FieldNotifyURL, field.TypeString)
|
|
}
|
|
if _u.mutation.AppCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.AppTable,
|
|
Columns: []string{paynotifytask.AppColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.AppIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.AppTable,
|
|
Columns: []string{paynotifytask.AppColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(app.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.OrderCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.OrderTable,
|
|
Columns: []string{paynotifytask.OrderColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.OrderIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.OrderTable,
|
|
Columns: []string{paynotifytask.OrderColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(payorder.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.NotifyLogCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: paynotifytask.NotifyLogTable,
|
|
Columns: []string{paynotifytask.NotifyLogColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifylog.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedNotifyLogIDs(); len(nodes) > 0 && !_u.mutation.NotifyLogCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: paynotifytask.NotifyLogTable,
|
|
Columns: []string{paynotifytask.NotifyLogColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifylog.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.NotifyLogIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: paynotifytask.NotifyLogTable,
|
|
Columns: []string{paynotifytask.NotifyLogColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifylog.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{paynotifytask.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// PayNotifyTaskUpdateOne is the builder for updating a single PayNotifyTask entity.
|
|
type PayNotifyTaskUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *PayNotifyTaskMutation
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetUpdatedAt(v time.Time) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetStatus(v uint8) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableStatus(v *uint8) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *PayNotifyTaskUpdateOne) AddStatus(v int8) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearStatus() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetDeletedAt(v time.Time) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableDeletedAt(v *time.Time) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearDeletedAt() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetType sets the "type" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetType(v uint8) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ResetType()
|
|
_u.mutation.SetType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableType sets the "type" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableType(v *uint8) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddType adds value to the "type" field.
|
|
func (_u *PayNotifyTaskUpdateOne) AddType(v int8) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.AddType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetDataID sets the "data_id" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetDataID(v uint64) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ResetDataID()
|
|
_u.mutation.SetDataID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDataID sets the "data_id" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableDataID(v *uint64) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetDataID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddDataID adds value to the "data_id" field.
|
|
func (_u *PayNotifyTaskUpdateOne) AddDataID(v int64) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.AddDataID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOrderID sets the "order_id" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetOrderID(v uint64) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.SetOrderID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderID sets the "order_id" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableOrderID(v *uint64) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetOrderID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetAppID sets the "app_id" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetAppID(v uint64) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.SetAppID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAppID sets the "app_id" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableAppID(v *uint64) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetAppID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyStatus sets the "notify_status" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNotifyStatus(v uint8) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ResetNotifyStatus()
|
|
_u.mutation.SetNotifyStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyStatus sets the "notify_status" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableNotifyStatus(v *uint8) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetNotifyStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddNotifyStatus adds value to the "notify_status" field.
|
|
func (_u *PayNotifyTaskUpdateOne) AddNotifyStatus(v int8) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.AddNotifyStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNextNotifyTime sets the "next_notify_time" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNextNotifyTime(v time.Time) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.SetNextNotifyTime(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNextNotifyTime sets the "next_notify_time" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableNextNotifyTime(v *time.Time) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetNextNotifyTime(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNextNotifyTime clears the value of the "next_notify_time" field.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearNextNotifyTime() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearNextNotifyTime()
|
|
return _u
|
|
}
|
|
|
|
// SetLastExecuteTime sets the "last_execute_time" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetLastExecuteTime(v time.Time) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.SetLastExecuteTime(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableLastExecuteTime sets the "last_execute_time" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableLastExecuteTime(v *time.Time) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetLastExecuteTime(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearLastExecuteTime clears the value of the "last_execute_time" field.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearLastExecuteTime() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearLastExecuteTime()
|
|
return _u
|
|
}
|
|
|
|
// SetRetryCount sets the "retry_count" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetRetryCount(v uint32) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ResetRetryCount()
|
|
_u.mutation.SetRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableRetryCount(v *uint32) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetRetryCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddRetryCount adds value to the "retry_count" field.
|
|
func (_u *PayNotifyTaskUpdateOne) AddRetryCount(v int32) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.AddRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearRetryCount clears the value of the "retry_count" field.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearRetryCount() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearRetryCount()
|
|
return _u
|
|
}
|
|
|
|
// SetMaxRetryCount sets the "max_retry_count" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetMaxRetryCount(v uint32) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ResetMaxRetryCount()
|
|
_u.mutation.SetMaxRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaxRetryCount sets the "max_retry_count" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableMaxRetryCount(v *uint32) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetMaxRetryCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddMaxRetryCount adds value to the "max_retry_count" field.
|
|
func (_u *PayNotifyTaskUpdateOne) AddMaxRetryCount(v int32) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.AddMaxRetryCount(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearMaxRetryCount clears the value of the "max_retry_count" field.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearMaxRetryCount() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearMaxRetryCount()
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyURL sets the "notify_url" field.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNotifyURL(v string) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.SetNotifyURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyURL sets the "notify_url" field if the given value is not nil.
|
|
func (_u *PayNotifyTaskUpdateOne) SetNillableNotifyURL(v *string) *PayNotifyTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetNotifyURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyURL clears the value of the "notify_url" field.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearNotifyURL() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearNotifyURL()
|
|
return _u
|
|
}
|
|
|
|
// SetApp sets the "app" edge to the App entity.
|
|
func (_u *PayNotifyTaskUpdateOne) SetApp(v *App) *PayNotifyTaskUpdateOne {
|
|
return _u.SetAppID(v.ID)
|
|
}
|
|
|
|
// SetOrder sets the "order" edge to the PayOrder entity.
|
|
func (_u *PayNotifyTaskUpdateOne) SetOrder(v *PayOrder) *PayNotifyTaskUpdateOne {
|
|
return _u.SetOrderID(v.ID)
|
|
}
|
|
|
|
// AddNotifyLogIDs adds the "notify_log" edge to the PayNotifyLog entity by IDs.
|
|
func (_u *PayNotifyTaskUpdateOne) AddNotifyLogIDs(ids ...uint64) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.AddNotifyLogIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddNotifyLog adds the "notify_log" edges to the PayNotifyLog entity.
|
|
func (_u *PayNotifyTaskUpdateOne) AddNotifyLog(v ...*PayNotifyLog) *PayNotifyTaskUpdateOne {
|
|
ids := make([]uint64, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddNotifyLogIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the PayNotifyTaskMutation object of the builder.
|
|
func (_u *PayNotifyTaskUpdateOne) Mutation() *PayNotifyTaskMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearApp clears the "app" edge to the App entity.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearApp() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearApp()
|
|
return _u
|
|
}
|
|
|
|
// ClearOrder clears the "order" edge to the PayOrder entity.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearOrder() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearOrder()
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyLog clears all "notify_log" edges to the PayNotifyLog entity.
|
|
func (_u *PayNotifyTaskUpdateOne) ClearNotifyLog() *PayNotifyTaskUpdateOne {
|
|
_u.mutation.ClearNotifyLog()
|
|
return _u
|
|
}
|
|
|
|
// RemoveNotifyLogIDs removes the "notify_log" edge to PayNotifyLog entities by IDs.
|
|
func (_u *PayNotifyTaskUpdateOne) RemoveNotifyLogIDs(ids ...uint64) *PayNotifyTaskUpdateOne {
|
|
_u.mutation.RemoveNotifyLogIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveNotifyLog removes "notify_log" edges to PayNotifyLog entities.
|
|
func (_u *PayNotifyTaskUpdateOne) RemoveNotifyLog(v ...*PayNotifyLog) *PayNotifyTaskUpdateOne {
|
|
ids := make([]uint64, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveNotifyLogIDs(ids...)
|
|
}
|
|
|
|
// Where appends a list predicates to the PayNotifyTaskUpdate builder.
|
|
func (_u *PayNotifyTaskUpdateOne) Where(ps ...predicate.PayNotifyTask) *PayNotifyTaskUpdateOne {
|
|
_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 *PayNotifyTaskUpdateOne) Select(field string, fields ...string) *PayNotifyTaskUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated PayNotifyTask entity.
|
|
func (_u *PayNotifyTaskUpdateOne) Save(ctx context.Context) (*PayNotifyTask, error) {
|
|
_u.defaults()
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *PayNotifyTaskUpdateOne) SaveX(ctx context.Context) *PayNotifyTask {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *PayNotifyTaskUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *PayNotifyTaskUpdateOne) 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 *PayNotifyTaskUpdateOne) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := paynotifytask.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *PayNotifyTaskUpdateOne) check() error {
|
|
if _u.mutation.AppCleared() && len(_u.mutation.AppIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayNotifyTask.app"`)
|
|
}
|
|
if _u.mutation.OrderCleared() && len(_u.mutation.OrderIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayNotifyTask.order"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *PayNotifyTaskUpdateOne) sqlSave(ctx context.Context) (_node *PayNotifyTask, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(paynotifytask.Table, paynotifytask.Columns, sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "PayNotifyTask.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, paynotifytask.FieldID)
|
|
for _, f := range fields {
|
|
if !paynotifytask.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != paynotifytask.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(paynotifytask.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(paynotifytask.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(paynotifytask.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(paynotifytask.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(paynotifytask.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(paynotifytask.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.GetType(); ok {
|
|
_spec.SetField(paynotifytask.FieldType, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedType(); ok {
|
|
_spec.AddField(paynotifytask.FieldType, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.DataID(); ok {
|
|
_spec.SetField(paynotifytask.FieldDataID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedDataID(); ok {
|
|
_spec.AddField(paynotifytask.FieldDataID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.NotifyStatus(); ok {
|
|
_spec.SetField(paynotifytask.FieldNotifyStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedNotifyStatus(); ok {
|
|
_spec.AddField(paynotifytask.FieldNotifyStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.NextNotifyTime(); ok {
|
|
_spec.SetField(paynotifytask.FieldNextNotifyTime, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.NextNotifyTimeCleared() {
|
|
_spec.ClearField(paynotifytask.FieldNextNotifyTime, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.LastExecuteTime(); ok {
|
|
_spec.SetField(paynotifytask.FieldLastExecuteTime, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.LastExecuteTimeCleared() {
|
|
_spec.ClearField(paynotifytask.FieldLastExecuteTime, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.RetryCount(); ok {
|
|
_spec.SetField(paynotifytask.FieldRetryCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedRetryCount(); ok {
|
|
_spec.AddField(paynotifytask.FieldRetryCount, field.TypeUint32, value)
|
|
}
|
|
if _u.mutation.RetryCountCleared() {
|
|
_spec.ClearField(paynotifytask.FieldRetryCount, field.TypeUint32)
|
|
}
|
|
if value, ok := _u.mutation.MaxRetryCount(); ok {
|
|
_spec.SetField(paynotifytask.FieldMaxRetryCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedMaxRetryCount(); ok {
|
|
_spec.AddField(paynotifytask.FieldMaxRetryCount, field.TypeUint32, value)
|
|
}
|
|
if _u.mutation.MaxRetryCountCleared() {
|
|
_spec.ClearField(paynotifytask.FieldMaxRetryCount, field.TypeUint32)
|
|
}
|
|
if value, ok := _u.mutation.NotifyURL(); ok {
|
|
_spec.SetField(paynotifytask.FieldNotifyURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NotifyURLCleared() {
|
|
_spec.ClearField(paynotifytask.FieldNotifyURL, field.TypeString)
|
|
}
|
|
if _u.mutation.AppCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.AppTable,
|
|
Columns: []string{paynotifytask.AppColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.AppIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.AppTable,
|
|
Columns: []string{paynotifytask.AppColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(app.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.OrderCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.OrderTable,
|
|
Columns: []string{paynotifytask.OrderColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.OrderIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifytask.OrderTable,
|
|
Columns: []string{paynotifytask.OrderColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(payorder.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.NotifyLogCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: paynotifytask.NotifyLogTable,
|
|
Columns: []string{paynotifytask.NotifyLogColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifylog.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedNotifyLogIDs(); len(nodes) > 0 && !_u.mutation.NotifyLogCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: paynotifytask.NotifyLogTable,
|
|
Columns: []string{paynotifytask.NotifyLogColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifylog.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.NotifyLogIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: paynotifytask.NotifyLogTable,
|
|
Columns: []string{paynotifytask.NotifyLogColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifylog.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
_node = &PayNotifyTask{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{paynotifytask.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|