1195 lines
35 KiB
Go
1195 lines
35 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"mingyang-admin-pay/rpc/ent/paychannel"
|
|
"mingyang-admin-pay/rpc/ent/payorder"
|
|
"mingyang-admin-pay/rpc/ent/payrefund"
|
|
"mingyang-admin-pay/rpc/ent/predicate"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// PayRefundUpdate is the builder for updating PayRefund entities.
|
|
type PayRefundUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *PayRefundMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the PayRefundUpdate builder.
|
|
func (_u *PayRefundUpdate) Where(ps ...predicate.PayRefund) *PayRefundUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *PayRefundUpdate) SetUpdatedAt(v time.Time) *PayRefundUpdate {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *PayRefundUpdate) SetStatus(v uint8) *PayRefundUpdate {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableStatus(v *uint8) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *PayRefundUpdate) AddStatus(v int8) *PayRefundUpdate {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *PayRefundUpdate) ClearStatus() *PayRefundUpdate {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *PayRefundUpdate) SetDeletedAt(v time.Time) *PayRefundUpdate {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableDeletedAt(v *time.Time) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *PayRefundUpdate) ClearDeletedAt() *PayRefundUpdate {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelID sets the "channel_id" field.
|
|
func (_u *PayRefundUpdate) SetChannelID(v uint64) *PayRefundUpdate {
|
|
_u.mutation.SetChannelID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelID sets the "channel_id" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableChannelID(v *uint64) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetChannelID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *PayRefundUpdate) SetUserID(v uint64) *PayRefundUpdate {
|
|
_u.mutation.ResetUserID()
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableUserID(v *uint64) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUserID adds value to the "user_id" field.
|
|
func (_u *PayRefundUpdate) AddUserID(v int64) *PayRefundUpdate {
|
|
_u.mutation.AddUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOrderID sets the "order_id" field.
|
|
func (_u *PayRefundUpdate) SetOrderID(v uint64) *PayRefundUpdate {
|
|
_u.mutation.SetOrderID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderID sets the "order_id" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableOrderID(v *uint64) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetOrderID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyURL sets the "notify_url" field.
|
|
func (_u *PayRefundUpdate) SetNotifyURL(v string) *PayRefundUpdate {
|
|
_u.mutation.SetNotifyURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyURL sets the "notify_url" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableNotifyURL(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetNotifyURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyURL clears the value of the "notify_url" field.
|
|
func (_u *PayRefundUpdate) ClearNotifyURL() *PayRefundUpdate {
|
|
_u.mutation.ClearNotifyURL()
|
|
return _u
|
|
}
|
|
|
|
// SetRefundStatus sets the "refund_status" field.
|
|
func (_u *PayRefundUpdate) SetRefundStatus(v uint8) *PayRefundUpdate {
|
|
_u.mutation.ResetRefundStatus()
|
|
_u.mutation.SetRefundStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundStatus sets the "refund_status" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableRefundStatus(v *uint8) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetRefundStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddRefundStatus adds value to the "refund_status" field.
|
|
func (_u *PayRefundUpdate) AddRefundStatus(v int8) *PayRefundUpdate {
|
|
_u.mutation.AddRefundStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetRefundAmount sets the "refund_amount" field.
|
|
func (_u *PayRefundUpdate) SetRefundAmount(v uint64) *PayRefundUpdate {
|
|
_u.mutation.ResetRefundAmount()
|
|
_u.mutation.SetRefundAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundAmount sets the "refund_amount" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableRefundAmount(v *uint64) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetRefundAmount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddRefundAmount adds value to the "refund_amount" field.
|
|
func (_u *PayRefundUpdate) AddRefundAmount(v int64) *PayRefundUpdate {
|
|
_u.mutation.AddRefundAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetPayAmount sets the "pay_amount" field.
|
|
func (_u *PayRefundUpdate) SetPayAmount(v uint64) *PayRefundUpdate {
|
|
_u.mutation.ResetPayAmount()
|
|
_u.mutation.SetPayAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePayAmount sets the "pay_amount" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillablePayAmount(v *uint64) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetPayAmount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddPayAmount adds value to the "pay_amount" field.
|
|
func (_u *PayRefundUpdate) AddPayAmount(v int64) *PayRefundUpdate {
|
|
_u.mutation.AddPayAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetRefundNo sets the "refund_no" field.
|
|
func (_u *PayRefundUpdate) SetRefundNo(v string) *PayRefundUpdate {
|
|
_u.mutation.SetRefundNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundNo sets the "refund_no" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableRefundNo(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetRefundNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetRefundReason sets the "refund_reason" field.
|
|
func (_u *PayRefundUpdate) SetRefundReason(v string) *PayRefundUpdate {
|
|
_u.mutation.SetRefundReason(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundReason sets the "refund_reason" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableRefundReason(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetRefundReason(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUserIP sets the "user_ip" field.
|
|
func (_u *PayRefundUpdate) SetUserIP(v string) *PayRefundUpdate {
|
|
_u.mutation.SetUserIP(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserIP sets the "user_ip" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableUserIP(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetUserIP(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearUserIP clears the value of the "user_ip" field.
|
|
func (_u *PayRefundUpdate) ClearUserIP() *PayRefundUpdate {
|
|
_u.mutation.ClearUserIP()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelRefundNo sets the "channel_refund_no" field.
|
|
func (_u *PayRefundUpdate) SetChannelRefundNo(v string) *PayRefundUpdate {
|
|
_u.mutation.SetChannelRefundNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelRefundNo sets the "channel_refund_no" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableChannelRefundNo(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetChannelRefundNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetRefundTime sets the "refund_time" field.
|
|
func (_u *PayRefundUpdate) SetRefundTime(v time.Time) *PayRefundUpdate {
|
|
_u.mutation.SetRefundTime(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundTime sets the "refund_time" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableRefundTime(v *time.Time) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetRefundTime(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetChannelErrorCode sets the "channel_error_code" field.
|
|
func (_u *PayRefundUpdate) SetChannelErrorCode(v string) *PayRefundUpdate {
|
|
_u.mutation.SetChannelErrorCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelErrorCode sets the "channel_error_code" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableChannelErrorCode(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetChannelErrorCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearChannelErrorCode clears the value of the "channel_error_code" field.
|
|
func (_u *PayRefundUpdate) ClearChannelErrorCode() *PayRefundUpdate {
|
|
_u.mutation.ClearChannelErrorCode()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelErrorMsg sets the "channel_error_msg" field.
|
|
func (_u *PayRefundUpdate) SetChannelErrorMsg(v string) *PayRefundUpdate {
|
|
_u.mutation.SetChannelErrorMsg(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelErrorMsg sets the "channel_error_msg" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableChannelErrorMsg(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetChannelErrorMsg(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearChannelErrorMsg clears the value of the "channel_error_msg" field.
|
|
func (_u *PayRefundUpdate) ClearChannelErrorMsg() *PayRefundUpdate {
|
|
_u.mutation.ClearChannelErrorMsg()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelNotifyData sets the "channel_notify_data" field.
|
|
func (_u *PayRefundUpdate) SetChannelNotifyData(v string) *PayRefundUpdate {
|
|
_u.mutation.SetChannelNotifyData(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelNotifyData sets the "channel_notify_data" field if the given value is not nil.
|
|
func (_u *PayRefundUpdate) SetNillableChannelNotifyData(v *string) *PayRefundUpdate {
|
|
if v != nil {
|
|
_u.SetChannelNotifyData(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearChannelNotifyData clears the value of the "channel_notify_data" field.
|
|
func (_u *PayRefundUpdate) ClearChannelNotifyData() *PayRefundUpdate {
|
|
_u.mutation.ClearChannelNotifyData()
|
|
return _u
|
|
}
|
|
|
|
// SetOrder sets the "order" edge to the PayOrder entity.
|
|
func (_u *PayRefundUpdate) SetOrder(v *PayOrder) *PayRefundUpdate {
|
|
return _u.SetOrderID(v.ID)
|
|
}
|
|
|
|
// SetChannel sets the "channel" edge to the PayChannel entity.
|
|
func (_u *PayRefundUpdate) SetChannel(v *PayChannel) *PayRefundUpdate {
|
|
return _u.SetChannelID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the PayRefundMutation object of the builder.
|
|
func (_u *PayRefundUpdate) Mutation() *PayRefundMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearOrder clears the "order" edge to the PayOrder entity.
|
|
func (_u *PayRefundUpdate) ClearOrder() *PayRefundUpdate {
|
|
_u.mutation.ClearOrder()
|
|
return _u
|
|
}
|
|
|
|
// ClearChannel clears the "channel" edge to the PayChannel entity.
|
|
func (_u *PayRefundUpdate) ClearChannel() *PayRefundUpdate {
|
|
_u.mutation.ClearChannel()
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *PayRefundUpdate) 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 *PayRefundUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *PayRefundUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *PayRefundUpdate) 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 *PayRefundUpdate) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := payrefund.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *PayRefundUpdate) check() error {
|
|
if _u.mutation.OrderCleared() && len(_u.mutation.OrderIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayRefund.order"`)
|
|
}
|
|
if _u.mutation.ChannelCleared() && len(_u.mutation.ChannelIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayRefund.channel"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *PayRefundUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(payrefund.Table, payrefund.Columns, sqlgraph.NewFieldSpec(payrefund.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(payrefund.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(payrefund.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(payrefund.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(payrefund.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(payrefund.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(payrefund.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.UserID(); ok {
|
|
_spec.SetField(payrefund.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUserID(); ok {
|
|
_spec.AddField(payrefund.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.NotifyURL(); ok {
|
|
_spec.SetField(payrefund.FieldNotifyURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NotifyURLCleared() {
|
|
_spec.ClearField(payrefund.FieldNotifyURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RefundStatus(); ok {
|
|
_spec.SetField(payrefund.FieldRefundStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedRefundStatus(); ok {
|
|
_spec.AddField(payrefund.FieldRefundStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundAmount(); ok {
|
|
_spec.SetField(payrefund.FieldRefundAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedRefundAmount(); ok {
|
|
_spec.AddField(payrefund.FieldRefundAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.PayAmount(); ok {
|
|
_spec.SetField(payrefund.FieldPayAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedPayAmount(); ok {
|
|
_spec.AddField(payrefund.FieldPayAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundNo(); ok {
|
|
_spec.SetField(payrefund.FieldRefundNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundReason(); ok {
|
|
_spec.SetField(payrefund.FieldRefundReason, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.UserIP(); ok {
|
|
_spec.SetField(payrefund.FieldUserIP, field.TypeString, value)
|
|
}
|
|
if _u.mutation.UserIPCleared() {
|
|
_spec.ClearField(payrefund.FieldUserIP, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ChannelRefundNo(); ok {
|
|
_spec.SetField(payrefund.FieldChannelRefundNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundTime(); ok {
|
|
_spec.SetField(payrefund.FieldRefundTime, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.ChannelErrorCode(); ok {
|
|
_spec.SetField(payrefund.FieldChannelErrorCode, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ChannelErrorCodeCleared() {
|
|
_spec.ClearField(payrefund.FieldChannelErrorCode, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ChannelErrorMsg(); ok {
|
|
_spec.SetField(payrefund.FieldChannelErrorMsg, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ChannelErrorMsgCleared() {
|
|
_spec.ClearField(payrefund.FieldChannelErrorMsg, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ChannelNotifyData(); ok {
|
|
_spec.SetField(payrefund.FieldChannelNotifyData, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ChannelNotifyDataCleared() {
|
|
_spec.ClearField(payrefund.FieldChannelNotifyData, field.TypeString)
|
|
}
|
|
if _u.mutation.OrderCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: payrefund.OrderTable,
|
|
Columns: []string{payrefund.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: payrefund.OrderTable,
|
|
Columns: []string{payrefund.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.ChannelCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: payrefund.ChannelTable,
|
|
Columns: []string{payrefund.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.ChannelIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: payrefund.ChannelTable,
|
|
Columns: []string{payrefund.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 _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{payrefund.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// PayRefundUpdateOne is the builder for updating a single PayRefund entity.
|
|
type PayRefundUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *PayRefundMutation
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *PayRefundUpdateOne) SetUpdatedAt(v time.Time) *PayRefundUpdateOne {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *PayRefundUpdateOne) SetStatus(v uint8) *PayRefundUpdateOne {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableStatus(v *uint8) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *PayRefundUpdateOne) AddStatus(v int8) *PayRefundUpdateOne {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *PayRefundUpdateOne) ClearStatus() *PayRefundUpdateOne {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *PayRefundUpdateOne) SetDeletedAt(v time.Time) *PayRefundUpdateOne {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableDeletedAt(v *time.Time) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *PayRefundUpdateOne) ClearDeletedAt() *PayRefundUpdateOne {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelID sets the "channel_id" field.
|
|
func (_u *PayRefundUpdateOne) SetChannelID(v uint64) *PayRefundUpdateOne {
|
|
_u.mutation.SetChannelID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelID sets the "channel_id" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableChannelID(v *uint64) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetChannelID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *PayRefundUpdateOne) SetUserID(v uint64) *PayRefundUpdateOne {
|
|
_u.mutation.ResetUserID()
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableUserID(v *uint64) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUserID adds value to the "user_id" field.
|
|
func (_u *PayRefundUpdateOne) AddUserID(v int64) *PayRefundUpdateOne {
|
|
_u.mutation.AddUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOrderID sets the "order_id" field.
|
|
func (_u *PayRefundUpdateOne) SetOrderID(v uint64) *PayRefundUpdateOne {
|
|
_u.mutation.SetOrderID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderID sets the "order_id" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableOrderID(v *uint64) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetOrderID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyURL sets the "notify_url" field.
|
|
func (_u *PayRefundUpdateOne) SetNotifyURL(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetNotifyURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyURL sets the "notify_url" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableNotifyURL(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetNotifyURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyURL clears the value of the "notify_url" field.
|
|
func (_u *PayRefundUpdateOne) ClearNotifyURL() *PayRefundUpdateOne {
|
|
_u.mutation.ClearNotifyURL()
|
|
return _u
|
|
}
|
|
|
|
// SetRefundStatus sets the "refund_status" field.
|
|
func (_u *PayRefundUpdateOne) SetRefundStatus(v uint8) *PayRefundUpdateOne {
|
|
_u.mutation.ResetRefundStatus()
|
|
_u.mutation.SetRefundStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundStatus sets the "refund_status" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableRefundStatus(v *uint8) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetRefundStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddRefundStatus adds value to the "refund_status" field.
|
|
func (_u *PayRefundUpdateOne) AddRefundStatus(v int8) *PayRefundUpdateOne {
|
|
_u.mutation.AddRefundStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetRefundAmount sets the "refund_amount" field.
|
|
func (_u *PayRefundUpdateOne) SetRefundAmount(v uint64) *PayRefundUpdateOne {
|
|
_u.mutation.ResetRefundAmount()
|
|
_u.mutation.SetRefundAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundAmount sets the "refund_amount" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableRefundAmount(v *uint64) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetRefundAmount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddRefundAmount adds value to the "refund_amount" field.
|
|
func (_u *PayRefundUpdateOne) AddRefundAmount(v int64) *PayRefundUpdateOne {
|
|
_u.mutation.AddRefundAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetPayAmount sets the "pay_amount" field.
|
|
func (_u *PayRefundUpdateOne) SetPayAmount(v uint64) *PayRefundUpdateOne {
|
|
_u.mutation.ResetPayAmount()
|
|
_u.mutation.SetPayAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePayAmount sets the "pay_amount" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillablePayAmount(v *uint64) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetPayAmount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddPayAmount adds value to the "pay_amount" field.
|
|
func (_u *PayRefundUpdateOne) AddPayAmount(v int64) *PayRefundUpdateOne {
|
|
_u.mutation.AddPayAmount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetRefundNo sets the "refund_no" field.
|
|
func (_u *PayRefundUpdateOne) SetRefundNo(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetRefundNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundNo sets the "refund_no" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableRefundNo(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetRefundNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetRefundReason sets the "refund_reason" field.
|
|
func (_u *PayRefundUpdateOne) SetRefundReason(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetRefundReason(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundReason sets the "refund_reason" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableRefundReason(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetRefundReason(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUserIP sets the "user_ip" field.
|
|
func (_u *PayRefundUpdateOne) SetUserIP(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetUserIP(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserIP sets the "user_ip" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableUserIP(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetUserIP(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearUserIP clears the value of the "user_ip" field.
|
|
func (_u *PayRefundUpdateOne) ClearUserIP() *PayRefundUpdateOne {
|
|
_u.mutation.ClearUserIP()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelRefundNo sets the "channel_refund_no" field.
|
|
func (_u *PayRefundUpdateOne) SetChannelRefundNo(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetChannelRefundNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelRefundNo sets the "channel_refund_no" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableChannelRefundNo(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetChannelRefundNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetRefundTime sets the "refund_time" field.
|
|
func (_u *PayRefundUpdateOne) SetRefundTime(v time.Time) *PayRefundUpdateOne {
|
|
_u.mutation.SetRefundTime(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefundTime sets the "refund_time" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableRefundTime(v *time.Time) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetRefundTime(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetChannelErrorCode sets the "channel_error_code" field.
|
|
func (_u *PayRefundUpdateOne) SetChannelErrorCode(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetChannelErrorCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelErrorCode sets the "channel_error_code" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableChannelErrorCode(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetChannelErrorCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearChannelErrorCode clears the value of the "channel_error_code" field.
|
|
func (_u *PayRefundUpdateOne) ClearChannelErrorCode() *PayRefundUpdateOne {
|
|
_u.mutation.ClearChannelErrorCode()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelErrorMsg sets the "channel_error_msg" field.
|
|
func (_u *PayRefundUpdateOne) SetChannelErrorMsg(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetChannelErrorMsg(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelErrorMsg sets the "channel_error_msg" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableChannelErrorMsg(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetChannelErrorMsg(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearChannelErrorMsg clears the value of the "channel_error_msg" field.
|
|
func (_u *PayRefundUpdateOne) ClearChannelErrorMsg() *PayRefundUpdateOne {
|
|
_u.mutation.ClearChannelErrorMsg()
|
|
return _u
|
|
}
|
|
|
|
// SetChannelNotifyData sets the "channel_notify_data" field.
|
|
func (_u *PayRefundUpdateOne) SetChannelNotifyData(v string) *PayRefundUpdateOne {
|
|
_u.mutation.SetChannelNotifyData(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableChannelNotifyData sets the "channel_notify_data" field if the given value is not nil.
|
|
func (_u *PayRefundUpdateOne) SetNillableChannelNotifyData(v *string) *PayRefundUpdateOne {
|
|
if v != nil {
|
|
_u.SetChannelNotifyData(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearChannelNotifyData clears the value of the "channel_notify_data" field.
|
|
func (_u *PayRefundUpdateOne) ClearChannelNotifyData() *PayRefundUpdateOne {
|
|
_u.mutation.ClearChannelNotifyData()
|
|
return _u
|
|
}
|
|
|
|
// SetOrder sets the "order" edge to the PayOrder entity.
|
|
func (_u *PayRefundUpdateOne) SetOrder(v *PayOrder) *PayRefundUpdateOne {
|
|
return _u.SetOrderID(v.ID)
|
|
}
|
|
|
|
// SetChannel sets the "channel" edge to the PayChannel entity.
|
|
func (_u *PayRefundUpdateOne) SetChannel(v *PayChannel) *PayRefundUpdateOne {
|
|
return _u.SetChannelID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the PayRefundMutation object of the builder.
|
|
func (_u *PayRefundUpdateOne) Mutation() *PayRefundMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearOrder clears the "order" edge to the PayOrder entity.
|
|
func (_u *PayRefundUpdateOne) ClearOrder() *PayRefundUpdateOne {
|
|
_u.mutation.ClearOrder()
|
|
return _u
|
|
}
|
|
|
|
// ClearChannel clears the "channel" edge to the PayChannel entity.
|
|
func (_u *PayRefundUpdateOne) ClearChannel() *PayRefundUpdateOne {
|
|
_u.mutation.ClearChannel()
|
|
return _u
|
|
}
|
|
|
|
// Where appends a list predicates to the PayRefundUpdate builder.
|
|
func (_u *PayRefundUpdateOne) Where(ps ...predicate.PayRefund) *PayRefundUpdateOne {
|
|
_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 *PayRefundUpdateOne) Select(field string, fields ...string) *PayRefundUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated PayRefund entity.
|
|
func (_u *PayRefundUpdateOne) Save(ctx context.Context) (*PayRefund, error) {
|
|
_u.defaults()
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *PayRefundUpdateOne) SaveX(ctx context.Context) *PayRefund {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *PayRefundUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *PayRefundUpdateOne) 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 *PayRefundUpdateOne) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := payrefund.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *PayRefundUpdateOne) check() error {
|
|
if _u.mutation.OrderCleared() && len(_u.mutation.OrderIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayRefund.order"`)
|
|
}
|
|
if _u.mutation.ChannelCleared() && len(_u.mutation.ChannelIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayRefund.channel"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *PayRefundUpdateOne) sqlSave(ctx context.Context) (_node *PayRefund, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(payrefund.Table, payrefund.Columns, sqlgraph.NewFieldSpec(payrefund.FieldID, field.TypeUint64))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "PayRefund.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, payrefund.FieldID)
|
|
for _, f := range fields {
|
|
if !payrefund.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != payrefund.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(payrefund.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(payrefund.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(payrefund.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(payrefund.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(payrefund.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(payrefund.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.UserID(); ok {
|
|
_spec.SetField(payrefund.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUserID(); ok {
|
|
_spec.AddField(payrefund.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.NotifyURL(); ok {
|
|
_spec.SetField(payrefund.FieldNotifyURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NotifyURLCleared() {
|
|
_spec.ClearField(payrefund.FieldNotifyURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RefundStatus(); ok {
|
|
_spec.SetField(payrefund.FieldRefundStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedRefundStatus(); ok {
|
|
_spec.AddField(payrefund.FieldRefundStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundAmount(); ok {
|
|
_spec.SetField(payrefund.FieldRefundAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedRefundAmount(); ok {
|
|
_spec.AddField(payrefund.FieldRefundAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.PayAmount(); ok {
|
|
_spec.SetField(payrefund.FieldPayAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedPayAmount(); ok {
|
|
_spec.AddField(payrefund.FieldPayAmount, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundNo(); ok {
|
|
_spec.SetField(payrefund.FieldRefundNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundReason(); ok {
|
|
_spec.SetField(payrefund.FieldRefundReason, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.UserIP(); ok {
|
|
_spec.SetField(payrefund.FieldUserIP, field.TypeString, value)
|
|
}
|
|
if _u.mutation.UserIPCleared() {
|
|
_spec.ClearField(payrefund.FieldUserIP, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ChannelRefundNo(); ok {
|
|
_spec.SetField(payrefund.FieldChannelRefundNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.RefundTime(); ok {
|
|
_spec.SetField(payrefund.FieldRefundTime, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.ChannelErrorCode(); ok {
|
|
_spec.SetField(payrefund.FieldChannelErrorCode, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ChannelErrorCodeCleared() {
|
|
_spec.ClearField(payrefund.FieldChannelErrorCode, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ChannelErrorMsg(); ok {
|
|
_spec.SetField(payrefund.FieldChannelErrorMsg, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ChannelErrorMsgCleared() {
|
|
_spec.ClearField(payrefund.FieldChannelErrorMsg, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ChannelNotifyData(); ok {
|
|
_spec.SetField(payrefund.FieldChannelNotifyData, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ChannelNotifyDataCleared() {
|
|
_spec.ClearField(payrefund.FieldChannelNotifyData, field.TypeString)
|
|
}
|
|
if _u.mutation.OrderCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: payrefund.OrderTable,
|
|
Columns: []string{payrefund.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: payrefund.OrderTable,
|
|
Columns: []string{payrefund.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.ChannelCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: payrefund.ChannelTable,
|
|
Columns: []string{payrefund.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.ChannelIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: payrefund.ChannelTable,
|
|
Columns: []string{payrefund.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)
|
|
}
|
|
_node = &PayRefund{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{payrefund.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|