// Code generated by ent, DO NOT EDIT.

package ent

import (
	"context"
	"errors"
	"fmt"
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/Wei-Shaw/sub2api/ent/paymentorder"
	"github.com/Wei-Shaw/sub2api/ent/user"
)

// PaymentOrderCreate is the builder for creating a PaymentOrder entity.
type PaymentOrderCreate struct {
	config
	mutation *PaymentOrderMutation
	hooks    []Hook
	conflict []sql.ConflictOption
}

// SetUserID sets the "user_id" field.
func (_c *PaymentOrderCreate) SetUserID(v int64) *PaymentOrderCreate {
	_c.mutation.SetUserID(v)
	return _c
}

// SetUserEmail sets the "user_email" field.
func (_c *PaymentOrderCreate) SetUserEmail(v string) *PaymentOrderCreate {
	_c.mutation.SetUserEmail(v)
	return _c
}

// SetUserName sets the "user_name" field.
func (_c *PaymentOrderCreate) SetUserName(v string) *PaymentOrderCreate {
	_c.mutation.SetUserName(v)
	return _c
}

// SetUserNotes sets the "user_notes" field.
func (_c *PaymentOrderCreate) SetUserNotes(v string) *PaymentOrderCreate {
	_c.mutation.SetUserNotes(v)
	return _c
}

// SetNillableUserNotes sets the "user_notes" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableUserNotes(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetUserNotes(*v)
	}
	return _c
}

// SetAmount sets the "amount" field.
func (_c *PaymentOrderCreate) SetAmount(v float64) *PaymentOrderCreate {
	_c.mutation.SetAmount(v)
	return _c
}

// SetPayAmount sets the "pay_amount" field.
func (_c *PaymentOrderCreate) SetPayAmount(v float64) *PaymentOrderCreate {
	_c.mutation.SetPayAmount(v)
	return _c
}

// SetFeeRate sets the "fee_rate" field.
func (_c *PaymentOrderCreate) SetFeeRate(v float64) *PaymentOrderCreate {
	_c.mutation.SetFeeRate(v)
	return _c
}

// SetNillableFeeRate sets the "fee_rate" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableFeeRate(v *float64) *PaymentOrderCreate {
	if v != nil {
		_c.SetFeeRate(*v)
	}
	return _c
}

// SetRechargeCode sets the "recharge_code" field.
func (_c *PaymentOrderCreate) SetRechargeCode(v string) *PaymentOrderCreate {
	_c.mutation.SetRechargeCode(v)
	return _c
}

// SetOutTradeNo sets the "out_trade_no" field.
func (_c *PaymentOrderCreate) SetOutTradeNo(v string) *PaymentOrderCreate {
	_c.mutation.SetOutTradeNo(v)
	return _c
}

// SetNillableOutTradeNo sets the "out_trade_no" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableOutTradeNo(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetOutTradeNo(*v)
	}
	return _c
}

// SetPaymentType sets the "payment_type" field.
func (_c *PaymentOrderCreate) SetPaymentType(v string) *PaymentOrderCreate {
	_c.mutation.SetPaymentType(v)
	return _c
}

// SetPaymentTradeNo sets the "payment_trade_no" field.
func (_c *PaymentOrderCreate) SetPaymentTradeNo(v string) *PaymentOrderCreate {
	_c.mutation.SetPaymentTradeNo(v)
	return _c
}

// SetPayURL sets the "pay_url" field.
func (_c *PaymentOrderCreate) SetPayURL(v string) *PaymentOrderCreate {
	_c.mutation.SetPayURL(v)
	return _c
}

// SetNillablePayURL sets the "pay_url" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillablePayURL(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetPayURL(*v)
	}
	return _c
}

// SetQrCode sets the "qr_code" field.
func (_c *PaymentOrderCreate) SetQrCode(v string) *PaymentOrderCreate {
	_c.mutation.SetQrCode(v)
	return _c
}

// SetNillableQrCode sets the "qr_code" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableQrCode(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetQrCode(*v)
	}
	return _c
}

// SetQrCodeImg sets the "qr_code_img" field.
func (_c *PaymentOrderCreate) SetQrCodeImg(v string) *PaymentOrderCreate {
	_c.mutation.SetQrCodeImg(v)
	return _c
}

// SetNillableQrCodeImg sets the "qr_code_img" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableQrCodeImg(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetQrCodeImg(*v)
	}
	return _c
}

// SetOrderType sets the "order_type" field.
func (_c *PaymentOrderCreate) SetOrderType(v string) *PaymentOrderCreate {
	_c.mutation.SetOrderType(v)
	return _c
}

// SetNillableOrderType sets the "order_type" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableOrderType(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetOrderType(*v)
	}
	return _c
}

// SetPlanID sets the "plan_id" field.
func (_c *PaymentOrderCreate) SetPlanID(v int64) *PaymentOrderCreate {
	_c.mutation.SetPlanID(v)
	return _c
}

// SetNillablePlanID sets the "plan_id" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillablePlanID(v *int64) *PaymentOrderCreate {
	if v != nil {
		_c.SetPlanID(*v)
	}
	return _c
}

// SetSubscriptionGroupID sets the "subscription_group_id" field.
func (_c *PaymentOrderCreate) SetSubscriptionGroupID(v int64) *PaymentOrderCreate {
	_c.mutation.SetSubscriptionGroupID(v)
	return _c
}

// SetNillableSubscriptionGroupID sets the "subscription_group_id" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableSubscriptionGroupID(v *int64) *PaymentOrderCreate {
	if v != nil {
		_c.SetSubscriptionGroupID(*v)
	}
	return _c
}

// SetSubscriptionDays sets the "subscription_days" field.
func (_c *PaymentOrderCreate) SetSubscriptionDays(v int) *PaymentOrderCreate {
	_c.mutation.SetSubscriptionDays(v)
	return _c
}

// SetNillableSubscriptionDays sets the "subscription_days" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableSubscriptionDays(v *int) *PaymentOrderCreate {
	if v != nil {
		_c.SetSubscriptionDays(*v)
	}
	return _c
}

// SetProviderInstanceID sets the "provider_instance_id" field.
func (_c *PaymentOrderCreate) SetProviderInstanceID(v string) *PaymentOrderCreate {
	_c.mutation.SetProviderInstanceID(v)
	return _c
}

// SetNillableProviderInstanceID sets the "provider_instance_id" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableProviderInstanceID(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetProviderInstanceID(*v)
	}
	return _c
}

// SetStatus sets the "status" field.
func (_c *PaymentOrderCreate) SetStatus(v string) *PaymentOrderCreate {
	_c.mutation.SetStatus(v)
	return _c
}

// SetNillableStatus sets the "status" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableStatus(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetStatus(*v)
	}
	return _c
}

// SetRefundAmount sets the "refund_amount" field.
func (_c *PaymentOrderCreate) SetRefundAmount(v float64) *PaymentOrderCreate {
	_c.mutation.SetRefundAmount(v)
	return _c
}

// SetNillableRefundAmount sets the "refund_amount" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableRefundAmount(v *float64) *PaymentOrderCreate {
	if v != nil {
		_c.SetRefundAmount(*v)
	}
	return _c
}

// SetRefundReason sets the "refund_reason" field.
func (_c *PaymentOrderCreate) SetRefundReason(v string) *PaymentOrderCreate {
	_c.mutation.SetRefundReason(v)
	return _c
}

// SetNillableRefundReason sets the "refund_reason" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableRefundReason(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetRefundReason(*v)
	}
	return _c
}

// SetRefundAt sets the "refund_at" field.
func (_c *PaymentOrderCreate) SetRefundAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetRefundAt(v)
	return _c
}

// SetNillableRefundAt sets the "refund_at" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableRefundAt(v *time.Time) *PaymentOrderCreate {
	if v != nil {
		_c.SetRefundAt(*v)
	}
	return _c
}

// SetForceRefund sets the "force_refund" field.
func (_c *PaymentOrderCreate) SetForceRefund(v bool) *PaymentOrderCreate {
	_c.mutation.SetForceRefund(v)
	return _c
}

// SetNillableForceRefund sets the "force_refund" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableForceRefund(v *bool) *PaymentOrderCreate {
	if v != nil {
		_c.SetForceRefund(*v)
	}
	return _c
}

// SetRefundRequestedAt sets the "refund_requested_at" field.
func (_c *PaymentOrderCreate) SetRefundRequestedAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetRefundRequestedAt(v)
	return _c
}

// SetNillableRefundRequestedAt sets the "refund_requested_at" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableRefundRequestedAt(v *time.Time) *PaymentOrderCreate {
	if v != nil {
		_c.SetRefundRequestedAt(*v)
	}
	return _c
}

// SetRefundRequestReason sets the "refund_request_reason" field.
func (_c *PaymentOrderCreate) SetRefundRequestReason(v string) *PaymentOrderCreate {
	_c.mutation.SetRefundRequestReason(v)
	return _c
}

// SetNillableRefundRequestReason sets the "refund_request_reason" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableRefundRequestReason(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetRefundRequestReason(*v)
	}
	return _c
}

// SetRefundRequestedBy sets the "refund_requested_by" field.
func (_c *PaymentOrderCreate) SetRefundRequestedBy(v string) *PaymentOrderCreate {
	_c.mutation.SetRefundRequestedBy(v)
	return _c
}

// SetNillableRefundRequestedBy sets the "refund_requested_by" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableRefundRequestedBy(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetRefundRequestedBy(*v)
	}
	return _c
}

// SetExpiresAt sets the "expires_at" field.
func (_c *PaymentOrderCreate) SetExpiresAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetExpiresAt(v)
	return _c
}

// SetPaidAt sets the "paid_at" field.
func (_c *PaymentOrderCreate) SetPaidAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetPaidAt(v)
	return _c
}

// SetNillablePaidAt sets the "paid_at" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillablePaidAt(v *time.Time) *PaymentOrderCreate {
	if v != nil {
		_c.SetPaidAt(*v)
	}
	return _c
}

// SetCompletedAt sets the "completed_at" field.
func (_c *PaymentOrderCreate) SetCompletedAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetCompletedAt(v)
	return _c
}

// SetNillableCompletedAt sets the "completed_at" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableCompletedAt(v *time.Time) *PaymentOrderCreate {
	if v != nil {
		_c.SetCompletedAt(*v)
	}
	return _c
}

// SetFailedAt sets the "failed_at" field.
func (_c *PaymentOrderCreate) SetFailedAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetFailedAt(v)
	return _c
}

// SetNillableFailedAt sets the "failed_at" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableFailedAt(v *time.Time) *PaymentOrderCreate {
	if v != nil {
		_c.SetFailedAt(*v)
	}
	return _c
}

// SetFailedReason sets the "failed_reason" field.
func (_c *PaymentOrderCreate) SetFailedReason(v string) *PaymentOrderCreate {
	_c.mutation.SetFailedReason(v)
	return _c
}

// SetNillableFailedReason sets the "failed_reason" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableFailedReason(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetFailedReason(*v)
	}
	return _c
}

// SetClientIP sets the "client_ip" field.
func (_c *PaymentOrderCreate) SetClientIP(v string) *PaymentOrderCreate {
	_c.mutation.SetClientIP(v)
	return _c
}

// SetSrcHost sets the "src_host" field.
func (_c *PaymentOrderCreate) SetSrcHost(v string) *PaymentOrderCreate {
	_c.mutation.SetSrcHost(v)
	return _c
}

// SetSrcURL sets the "src_url" field.
func (_c *PaymentOrderCreate) SetSrcURL(v string) *PaymentOrderCreate {
	_c.mutation.SetSrcURL(v)
	return _c
}

// SetNillableSrcURL sets the "src_url" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableSrcURL(v *string) *PaymentOrderCreate {
	if v != nil {
		_c.SetSrcURL(*v)
	}
	return _c
}

// SetCreatedAt sets the "created_at" field.
func (_c *PaymentOrderCreate) SetCreatedAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetCreatedAt(v)
	return _c
}

// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableCreatedAt(v *time.Time) *PaymentOrderCreate {
	if v != nil {
		_c.SetCreatedAt(*v)
	}
	return _c
}

// SetUpdatedAt sets the "updated_at" field.
func (_c *PaymentOrderCreate) SetUpdatedAt(v time.Time) *PaymentOrderCreate {
	_c.mutation.SetUpdatedAt(v)
	return _c
}

// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableUpdatedAt(v *time.Time) *PaymentOrderCreate {
	if v != nil {
		_c.SetUpdatedAt(*v)
	}
	return _c
}

// SetUser sets the "user" edge to the User entity.
func (_c *PaymentOrderCreate) SetUser(v *User) *PaymentOrderCreate {
	return _c.SetUserID(v.ID)
}

// Mutation returns the PaymentOrderMutation object of the builder.
func (_c *PaymentOrderCreate) Mutation() *PaymentOrderMutation {
	return _c.mutation
}

// Save creates the PaymentOrder in the database.
func (_c *PaymentOrderCreate) Save(ctx context.Context) (*PaymentOrder, error) {
	_c.defaults()
	return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}

// SaveX calls Save and panics if Save returns an error.
func (_c *PaymentOrderCreate) SaveX(ctx context.Context) *PaymentOrder {
	v, err := _c.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Exec executes the query.
func (_c *PaymentOrderCreate) Exec(ctx context.Context) error {
	_, err := _c.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (_c *PaymentOrderCreate) ExecX(ctx context.Context) {
	if err := _c.Exec(ctx); err != nil {
		panic(err)
	}
}

// defaults sets the default values of the builder before save.
func (_c *PaymentOrderCreate) defaults() {
	if _, ok := _c.mutation.FeeRate(); !ok {
		v := paymentorder.DefaultFeeRate
		_c.mutation.SetFeeRate(v)
	}
	if _, ok := _c.mutation.OutTradeNo(); !ok {
		v := paymentorder.DefaultOutTradeNo
		_c.mutation.SetOutTradeNo(v)
	}
	if _, ok := _c.mutation.OrderType(); !ok {
		v := paymentorder.DefaultOrderType
		_c.mutation.SetOrderType(v)
	}
	if _, ok := _c.mutation.Status(); !ok {
		v := paymentorder.DefaultStatus
		_c.mutation.SetStatus(v)
	}
	if _, ok := _c.mutation.RefundAmount(); !ok {
		v := paymentorder.DefaultRefundAmount
		_c.mutation.SetRefundAmount(v)
	}
	if _, ok := _c.mutation.ForceRefund(); !ok {
		v := paymentorder.DefaultForceRefund
		_c.mutation.SetForceRefund(v)
	}
	if _, ok := _c.mutation.CreatedAt(); !ok {
		v := paymentorder.DefaultCreatedAt()
		_c.mutation.SetCreatedAt(v)
	}
	if _, ok := _c.mutation.UpdatedAt(); !ok {
		v := paymentorder.DefaultUpdatedAt()
		_c.mutation.SetUpdatedAt(v)
	}
}

// check runs all checks and user-defined validators on the builder.
func (_c *PaymentOrderCreate) check() error {
	if _, ok := _c.mutation.UserID(); !ok {
		return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "PaymentOrder.user_id"`)}
	}
	if _, ok := _c.mutation.UserEmail(); !ok {
		return &ValidationError{Name: "user_email", err: errors.New(`ent: missing required field "PaymentOrder.user_email"`)}
	}
	if v, ok := _c.mutation.UserEmail(); ok {
		if err := paymentorder.UserEmailValidator(v); err != nil {
			return &ValidationError{Name: "user_email", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.user_email": %w`, err)}
		}
	}
	if _, ok := _c.mutation.UserName(); !ok {
		return &ValidationError{Name: "user_name", err: errors.New(`ent: missing required field "PaymentOrder.user_name"`)}
	}
	if v, ok := _c.mutation.UserName(); ok {
		if err := paymentorder.UserNameValidator(v); err != nil {
			return &ValidationError{Name: "user_name", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.user_name": %w`, err)}
		}
	}
	if _, ok := _c.mutation.Amount(); !ok {
		return &ValidationError{Name: "amount", err: errors.New(`ent: missing required field "PaymentOrder.amount"`)}
	}
	if _, ok := _c.mutation.PayAmount(); !ok {
		return &ValidationError{Name: "pay_amount", err: errors.New(`ent: missing required field "PaymentOrder.pay_amount"`)}
	}
	if _, ok := _c.mutation.FeeRate(); !ok {
		return &ValidationError{Name: "fee_rate", err: errors.New(`ent: missing required field "PaymentOrder.fee_rate"`)}
	}
	if _, ok := _c.mutation.RechargeCode(); !ok {
		return &ValidationError{Name: "recharge_code", err: errors.New(`ent: missing required field "PaymentOrder.recharge_code"`)}
	}
	if v, ok := _c.mutation.RechargeCode(); ok {
		if err := paymentorder.RechargeCodeValidator(v); err != nil {
			return &ValidationError{Name: "recharge_code", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.recharge_code": %w`, err)}
		}
	}
	if _, ok := _c.mutation.OutTradeNo(); !ok {
		return &ValidationError{Name: "out_trade_no", err: errors.New(`ent: missing required field "PaymentOrder.out_trade_no"`)}
	}
	if v, ok := _c.mutation.OutTradeNo(); ok {
		if err := paymentorder.OutTradeNoValidator(v); err != nil {
			return &ValidationError{Name: "out_trade_no", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.out_trade_no": %w`, err)}
		}
	}
	if _, ok := _c.mutation.PaymentType(); !ok {
		return &ValidationError{Name: "payment_type", err: errors.New(`ent: missing required field "PaymentOrder.payment_type"`)}
	}
	if v, ok := _c.mutation.PaymentType(); ok {
		if err := paymentorder.PaymentTypeValidator(v); err != nil {
			return &ValidationError{Name: "payment_type", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.payment_type": %w`, err)}
		}
	}
	if _, ok := _c.mutation.PaymentTradeNo(); !ok {
		return &ValidationError{Name: "payment_trade_no", err: errors.New(`ent: missing required field "PaymentOrder.payment_trade_no"`)}
	}
	if v, ok := _c.mutation.PaymentTradeNo(); ok {
		if err := paymentorder.PaymentTradeNoValidator(v); err != nil {
			return &ValidationError{Name: "payment_trade_no", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.payment_trade_no": %w`, err)}
		}
	}
	if _, ok := _c.mutation.OrderType(); !ok {
		return &ValidationError{Name: "order_type", err: errors.New(`ent: missing required field "PaymentOrder.order_type"`)}
	}
	if v, ok := _c.mutation.OrderType(); ok {
		if err := paymentorder.OrderTypeValidator(v); err != nil {
			return &ValidationError{Name: "order_type", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.order_type": %w`, err)}
		}
	}
	if v, ok := _c.mutation.ProviderInstanceID(); ok {
		if err := paymentorder.ProviderInstanceIDValidator(v); err != nil {
			return &ValidationError{Name: "provider_instance_id", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.provider_instance_id": %w`, err)}
		}
	}
	if _, ok := _c.mutation.Status(); !ok {
		return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "PaymentOrder.status"`)}
	}
	if v, ok := _c.mutation.Status(); ok {
		if err := paymentorder.StatusValidator(v); err != nil {
			return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.status": %w`, err)}
		}
	}
	if _, ok := _c.mutation.RefundAmount(); !ok {
		return &ValidationError{Name: "refund_amount", err: errors.New(`ent: missing required field "PaymentOrder.refund_amount"`)}
	}
	if _, ok := _c.mutation.ForceRefund(); !ok {
		return &ValidationError{Name: "force_refund", err: errors.New(`ent: missing required field "PaymentOrder.force_refund"`)}
	}
	if v, ok := _c.mutation.RefundRequestedBy(); ok {
		if err := paymentorder.RefundRequestedByValidator(v); err != nil {
			return &ValidationError{Name: "refund_requested_by", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.refund_requested_by": %w`, err)}
		}
	}
	if _, ok := _c.mutation.ExpiresAt(); !ok {
		return &ValidationError{Name: "expires_at", err: errors.New(`ent: missing required field "PaymentOrder.expires_at"`)}
	}
	if _, ok := _c.mutation.ClientIP(); !ok {
		return &ValidationError{Name: "client_ip", err: errors.New(`ent: missing required field "PaymentOrder.client_ip"`)}
	}
	if v, ok := _c.mutation.ClientIP(); ok {
		if err := paymentorder.ClientIPValidator(v); err != nil {
			return &ValidationError{Name: "client_ip", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.client_ip": %w`, err)}
		}
	}
	if _, ok := _c.mutation.SrcHost(); !ok {
		return &ValidationError{Name: "src_host", err: errors.New(`ent: missing required field "PaymentOrder.src_host"`)}
	}
	if v, ok := _c.mutation.SrcHost(); ok {
		if err := paymentorder.SrcHostValidator(v); err != nil {
			return &ValidationError{Name: "src_host", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.src_host": %w`, err)}
		}
	}
	if _, ok := _c.mutation.CreatedAt(); !ok {
		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "PaymentOrder.created_at"`)}
	}
	if _, ok := _c.mutation.UpdatedAt(); !ok {
		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "PaymentOrder.updated_at"`)}
	}
	if len(_c.mutation.UserIDs()) == 0 {
		return &ValidationError{Name: "user", err: errors.New(`ent: missing required edge "PaymentOrder.user"`)}
	}
	return nil
}

func (_c *PaymentOrderCreate) sqlSave(ctx context.Context) (*PaymentOrder, error) {
	if err := _c.check(); err != nil {
		return nil, err
	}
	_node, _spec := _c.createSpec()
	if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
		if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return nil, err
	}
	id := _spec.ID.Value.(int64)
	_node.ID = int64(id)
	_c.mutation.id = &_node.ID
	_c.mutation.done = true
	return _node, nil
}

func (_c *PaymentOrderCreate) createSpec() (*PaymentOrder, *sqlgraph.CreateSpec) {
	var (
		_node = &PaymentOrder{config: _c.config}
		_spec = sqlgraph.NewCreateSpec(paymentorder.Table, sqlgraph.NewFieldSpec(paymentorder.FieldID, field.TypeInt64))
	)
	_spec.OnConflict = _c.conflict
	if value, ok := _c.mutation.UserEmail(); ok {
		_spec.SetField(paymentorder.FieldUserEmail, field.TypeString, value)
		_node.UserEmail = value
	}
	if value, ok := _c.mutation.UserName(); ok {
		_spec.SetField(paymentorder.FieldUserName, field.TypeString, value)
		_node.UserName = value
	}
	if value, ok := _c.mutation.UserNotes(); ok {
		_spec.SetField(paymentorder.FieldUserNotes, field.TypeString, value)
		_node.UserNotes = &value
	}
	if value, ok := _c.mutation.Amount(); ok {
		_spec.SetField(paymentorder.FieldAmount, field.TypeFloat64, value)
		_node.Amount = value
	}
	if value, ok := _c.mutation.PayAmount(); ok {
		_spec.SetField(paymentorder.FieldPayAmount, field.TypeFloat64, value)
		_node.PayAmount = value
	}
	if value, ok := _c.mutation.FeeRate(); ok {
		_spec.SetField(paymentorder.FieldFeeRate, field.TypeFloat64, value)
		_node.FeeRate = value
	}
	if value, ok := _c.mutation.RechargeCode(); ok {
		_spec.SetField(paymentorder.FieldRechargeCode, field.TypeString, value)
		_node.RechargeCode = value
	}
	if value, ok := _c.mutation.OutTradeNo(); ok {
		_spec.SetField(paymentorder.FieldOutTradeNo, field.TypeString, value)
		_node.OutTradeNo = value
	}
	if value, ok := _c.mutation.PaymentType(); ok {
		_spec.SetField(paymentorder.FieldPaymentType, field.TypeString, value)
		_node.PaymentType = value
	}
	if value, ok := _c.mutation.PaymentTradeNo(); ok {
		_spec.SetField(paymentorder.FieldPaymentTradeNo, field.TypeString, value)
		_node.PaymentTradeNo = value
	}
	if value, ok := _c.mutation.PayURL(); ok {
		_spec.SetField(paymentorder.FieldPayURL, field.TypeString, value)
		_node.PayURL = &value
	}
	if value, ok := _c.mutation.QrCode(); ok {
		_spec.SetField(paymentorder.FieldQrCode, field.TypeString, value)
		_node.QrCode = &value
	}
	if value, ok := _c.mutation.QrCodeImg(); ok {
		_spec.SetField(paymentorder.FieldQrCodeImg, field.TypeString, value)
		_node.QrCodeImg = &value
	}
	if value, ok := _c.mutation.OrderType(); ok {
		_spec.SetField(paymentorder.FieldOrderType, field.TypeString, value)
		_node.OrderType = value
	}
	if value, ok := _c.mutation.PlanID(); ok {
		_spec.SetField(paymentorder.FieldPlanID, field.TypeInt64, value)
		_node.PlanID = &value
	}
	if value, ok := _c.mutation.SubscriptionGroupID(); ok {
		_spec.SetField(paymentorder.FieldSubscriptionGroupID, field.TypeInt64, value)
		_node.SubscriptionGroupID = &value
	}
	if value, ok := _c.mutation.SubscriptionDays(); ok {
		_spec.SetField(paymentorder.FieldSubscriptionDays, field.TypeInt, value)
		_node.SubscriptionDays = &value
	}
	if value, ok := _c.mutation.ProviderInstanceID(); ok {
		_spec.SetField(paymentorder.FieldProviderInstanceID, field.TypeString, value)
		_node.ProviderInstanceID = &value
	}
	if value, ok := _c.mutation.Status(); ok {
		_spec.SetField(paymentorder.FieldStatus, field.TypeString, value)
		_node.Status = value
	}
	if value, ok := _c.mutation.RefundAmount(); ok {
		_spec.SetField(paymentorder.FieldRefundAmount, field.TypeFloat64, value)
		_node.RefundAmount = value
	}
	if value, ok := _c.mutation.RefundReason(); ok {
		_spec.SetField(paymentorder.FieldRefundReason, field.TypeString, value)
		_node.RefundReason = &value
	}
	if value, ok := _c.mutation.RefundAt(); ok {
		_spec.SetField(paymentorder.FieldRefundAt, field.TypeTime, value)
		_node.RefundAt = &value
	}
	if value, ok := _c.mutation.ForceRefund(); ok {
		_spec.SetField(paymentorder.FieldForceRefund, field.TypeBool, value)
		_node.ForceRefund = value
	}
	if value, ok := _c.mutation.RefundRequestedAt(); ok {
		_spec.SetField(paymentorder.FieldRefundRequestedAt, field.TypeTime, value)
		_node.RefundRequestedAt = &value
	}
	if value, ok := _c.mutation.RefundRequestReason(); ok {
		_spec.SetField(paymentorder.FieldRefundRequestReason, field.TypeString, value)
		_node.RefundRequestReason = &value
	}
	if value, ok := _c.mutation.RefundRequestedBy(); ok {
		_spec.SetField(paymentorder.FieldRefundRequestedBy, field.TypeString, value)
		_node.RefundRequestedBy = &value
	}
	if value, ok := _c.mutation.ExpiresAt(); ok {
		_spec.SetField(paymentorder.FieldExpiresAt, field.TypeTime, value)
		_node.ExpiresAt = value
	}
	if value, ok := _c.mutation.PaidAt(); ok {
		_spec.SetField(paymentorder.FieldPaidAt, field.TypeTime, value)
		_node.PaidAt = &value
	}
	if value, ok := _c.mutation.CompletedAt(); ok {
		_spec.SetField(paymentorder.FieldCompletedAt, field.TypeTime, value)
		_node.CompletedAt = &value
	}
	if value, ok := _c.mutation.FailedAt(); ok {
		_spec.SetField(paymentorder.FieldFailedAt, field.TypeTime, value)
		_node.FailedAt = &value
	}
	if value, ok := _c.mutation.FailedReason(); ok {
		_spec.SetField(paymentorder.FieldFailedReason, field.TypeString, value)
		_node.FailedReason = &value
	}
	if value, ok := _c.mutation.ClientIP(); ok {
		_spec.SetField(paymentorder.FieldClientIP, field.TypeString, value)
		_node.ClientIP = value
	}
	if value, ok := _c.mutation.SrcHost(); ok {
		_spec.SetField(paymentorder.FieldSrcHost, field.TypeString, value)
		_node.SrcHost = value
	}
	if value, ok := _c.mutation.SrcURL(); ok {
		_spec.SetField(paymentorder.FieldSrcURL, field.TypeString, value)
		_node.SrcURL = &value
	}
	if value, ok := _c.mutation.CreatedAt(); ok {
		_spec.SetField(paymentorder.FieldCreatedAt, field.TypeTime, value)
		_node.CreatedAt = value
	}
	if value, ok := _c.mutation.UpdatedAt(); ok {
		_spec.SetField(paymentorder.FieldUpdatedAt, field.TypeTime, value)
		_node.UpdatedAt = value
	}
	if nodes := _c.mutation.UserIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: true,
			Table:   paymentorder.UserTable,
			Columns: []string{paymentorder.UserColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_node.UserID = nodes[0]
		_spec.Edges = append(_spec.Edges, edge)
	}
	return _node, _spec
}

// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
//	client.PaymentOrder.Create().
//		SetUserID(v).
//		OnConflict(
//			// Update the row with the new values
//			// the was proposed for insertion.
//			sql.ResolveWithNewValues(),
//		).
//		// Override some of the fields with custom
//		// update values.
//		Update(func(u *ent.PaymentOrderUpsert) {
//			SetUserID(v+v).
//		}).
//		Exec(ctx)
func (_c *PaymentOrderCreate) OnConflict(opts ...sql.ConflictOption) *PaymentOrderUpsertOne {
	_c.conflict = opts
	return &PaymentOrderUpsertOne{
		create: _c,
	}
}

// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
//	client.PaymentOrder.Create().
//		OnConflict(sql.ConflictColumns(columns...)).
//		Exec(ctx)
func (_c *PaymentOrderCreate) OnConflictColumns(columns ...string) *PaymentOrderUpsertOne {
	_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
	return &PaymentOrderUpsertOne{
		create: _c,
	}
}

type (
	// PaymentOrderUpsertOne is the builder for "upsert"-ing
	//  one PaymentOrder node.
	PaymentOrderUpsertOne struct {
		create *PaymentOrderCreate
	}

	// PaymentOrderUpsert is the "OnConflict" setter.
	PaymentOrderUpsert struct {
		*sql.UpdateSet
	}
)

// SetUserID sets the "user_id" field.
func (u *PaymentOrderUpsert) SetUserID(v int64) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldUserID, v)
	return u
}

// UpdateUserID sets the "user_id" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateUserID() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldUserID)
	return u
}

// SetUserEmail sets the "user_email" field.
func (u *PaymentOrderUpsert) SetUserEmail(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldUserEmail, v)
	return u
}

// UpdateUserEmail sets the "user_email" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateUserEmail() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldUserEmail)
	return u
}

// SetUserName sets the "user_name" field.
func (u *PaymentOrderUpsert) SetUserName(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldUserName, v)
	return u
}

// UpdateUserName sets the "user_name" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateUserName() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldUserName)
	return u
}

// SetUserNotes sets the "user_notes" field.
func (u *PaymentOrderUpsert) SetUserNotes(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldUserNotes, v)
	return u
}

// UpdateUserNotes sets the "user_notes" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateUserNotes() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldUserNotes)
	return u
}

// ClearUserNotes clears the value of the "user_notes" field.
func (u *PaymentOrderUpsert) ClearUserNotes() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldUserNotes)
	return u
}

// SetAmount sets the "amount" field.
func (u *PaymentOrderUpsert) SetAmount(v float64) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldAmount, v)
	return u
}

// UpdateAmount sets the "amount" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateAmount() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldAmount)
	return u
}

// AddAmount adds v to the "amount" field.
func (u *PaymentOrderUpsert) AddAmount(v float64) *PaymentOrderUpsert {
	u.Add(paymentorder.FieldAmount, v)
	return u
}

// SetPayAmount sets the "pay_amount" field.
func (u *PaymentOrderUpsert) SetPayAmount(v float64) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldPayAmount, v)
	return u
}

// UpdatePayAmount sets the "pay_amount" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdatePayAmount() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldPayAmount)
	return u
}

// AddPayAmount adds v to the "pay_amount" field.
func (u *PaymentOrderUpsert) AddPayAmount(v float64) *PaymentOrderUpsert {
	u.Add(paymentorder.FieldPayAmount, v)
	return u
}

// SetFeeRate sets the "fee_rate" field.
func (u *PaymentOrderUpsert) SetFeeRate(v float64) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldFeeRate, v)
	return u
}

// UpdateFeeRate sets the "fee_rate" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateFeeRate() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldFeeRate)
	return u
}

// AddFeeRate adds v to the "fee_rate" field.
func (u *PaymentOrderUpsert) AddFeeRate(v float64) *PaymentOrderUpsert {
	u.Add(paymentorder.FieldFeeRate, v)
	return u
}

// SetRechargeCode sets the "recharge_code" field.
func (u *PaymentOrderUpsert) SetRechargeCode(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldRechargeCode, v)
	return u
}

// UpdateRechargeCode sets the "recharge_code" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateRechargeCode() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldRechargeCode)
	return u
}

// SetOutTradeNo sets the "out_trade_no" field.
func (u *PaymentOrderUpsert) SetOutTradeNo(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldOutTradeNo, v)
	return u
}

// UpdateOutTradeNo sets the "out_trade_no" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateOutTradeNo() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldOutTradeNo)
	return u
}

// SetPaymentType sets the "payment_type" field.
func (u *PaymentOrderUpsert) SetPaymentType(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldPaymentType, v)
	return u
}

// UpdatePaymentType sets the "payment_type" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdatePaymentType() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldPaymentType)
	return u
}

// SetPaymentTradeNo sets the "payment_trade_no" field.
func (u *PaymentOrderUpsert) SetPaymentTradeNo(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldPaymentTradeNo, v)
	return u
}

// UpdatePaymentTradeNo sets the "payment_trade_no" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdatePaymentTradeNo() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldPaymentTradeNo)
	return u
}

// SetPayURL sets the "pay_url" field.
func (u *PaymentOrderUpsert) SetPayURL(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldPayURL, v)
	return u
}

// UpdatePayURL sets the "pay_url" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdatePayURL() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldPayURL)
	return u
}

// ClearPayURL clears the value of the "pay_url" field.
func (u *PaymentOrderUpsert) ClearPayURL() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldPayURL)
	return u
}

// SetQrCode sets the "qr_code" field.
func (u *PaymentOrderUpsert) SetQrCode(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldQrCode, v)
	return u
}

// UpdateQrCode sets the "qr_code" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateQrCode() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldQrCode)
	return u
}

// ClearQrCode clears the value of the "qr_code" field.
func (u *PaymentOrderUpsert) ClearQrCode() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldQrCode)
	return u
}

// SetQrCodeImg sets the "qr_code_img" field.
func (u *PaymentOrderUpsert) SetQrCodeImg(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldQrCodeImg, v)
	return u
}

// UpdateQrCodeImg sets the "qr_code_img" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateQrCodeImg() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldQrCodeImg)
	return u
}

// ClearQrCodeImg clears the value of the "qr_code_img" field.
func (u *PaymentOrderUpsert) ClearQrCodeImg() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldQrCodeImg)
	return u
}

// SetOrderType sets the "order_type" field.
func (u *PaymentOrderUpsert) SetOrderType(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldOrderType, v)
	return u
}

// UpdateOrderType sets the "order_type" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateOrderType() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldOrderType)
	return u
}

// SetPlanID sets the "plan_id" field.
func (u *PaymentOrderUpsert) SetPlanID(v int64) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldPlanID, v)
	return u
}

// UpdatePlanID sets the "plan_id" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdatePlanID() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldPlanID)
	return u
}

// AddPlanID adds v to the "plan_id" field.
func (u *PaymentOrderUpsert) AddPlanID(v int64) *PaymentOrderUpsert {
	u.Add(paymentorder.FieldPlanID, v)
	return u
}

// ClearPlanID clears the value of the "plan_id" field.
func (u *PaymentOrderUpsert) ClearPlanID() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldPlanID)
	return u
}

// SetSubscriptionGroupID sets the "subscription_group_id" field.
func (u *PaymentOrderUpsert) SetSubscriptionGroupID(v int64) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldSubscriptionGroupID, v)
	return u
}

// UpdateSubscriptionGroupID sets the "subscription_group_id" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateSubscriptionGroupID() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldSubscriptionGroupID)
	return u
}

// AddSubscriptionGroupID adds v to the "subscription_group_id" field.
func (u *PaymentOrderUpsert) AddSubscriptionGroupID(v int64) *PaymentOrderUpsert {
	u.Add(paymentorder.FieldSubscriptionGroupID, v)
	return u
}

// ClearSubscriptionGroupID clears the value of the "subscription_group_id" field.
func (u *PaymentOrderUpsert) ClearSubscriptionGroupID() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldSubscriptionGroupID)
	return u
}

// SetSubscriptionDays sets the "subscription_days" field.
func (u *PaymentOrderUpsert) SetSubscriptionDays(v int) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldSubscriptionDays, v)
	return u
}

// UpdateSubscriptionDays sets the "subscription_days" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateSubscriptionDays() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldSubscriptionDays)
	return u
}

// AddSubscriptionDays adds v to the "subscription_days" field.
func (u *PaymentOrderUpsert) AddSubscriptionDays(v int) *PaymentOrderUpsert {
	u.Add(paymentorder.FieldSubscriptionDays, v)
	return u
}

// ClearSubscriptionDays clears the value of the "subscription_days" field.
func (u *PaymentOrderUpsert) ClearSubscriptionDays() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldSubscriptionDays)
	return u
}

// SetProviderInstanceID sets the "provider_instance_id" field.
func (u *PaymentOrderUpsert) SetProviderInstanceID(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldProviderInstanceID, v)
	return u
}

// UpdateProviderInstanceID sets the "provider_instance_id" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateProviderInstanceID() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldProviderInstanceID)
	return u
}

// ClearProviderInstanceID clears the value of the "provider_instance_id" field.
func (u *PaymentOrderUpsert) ClearProviderInstanceID() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldProviderInstanceID)
	return u
}

// SetStatus sets the "status" field.
func (u *PaymentOrderUpsert) SetStatus(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldStatus, v)
	return u
}

// UpdateStatus sets the "status" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateStatus() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldStatus)
	return u
}

// SetRefundAmount sets the "refund_amount" field.
func (u *PaymentOrderUpsert) SetRefundAmount(v float64) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldRefundAmount, v)
	return u
}

// UpdateRefundAmount sets the "refund_amount" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateRefundAmount() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldRefundAmount)
	return u
}

// AddRefundAmount adds v to the "refund_amount" field.
func (u *PaymentOrderUpsert) AddRefundAmount(v float64) *PaymentOrderUpsert {
	u.Add(paymentorder.FieldRefundAmount, v)
	return u
}

// SetRefundReason sets the "refund_reason" field.
func (u *PaymentOrderUpsert) SetRefundReason(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldRefundReason, v)
	return u
}

// UpdateRefundReason sets the "refund_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateRefundReason() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldRefundReason)
	return u
}

// ClearRefundReason clears the value of the "refund_reason" field.
func (u *PaymentOrderUpsert) ClearRefundReason() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldRefundReason)
	return u
}

// SetRefundAt sets the "refund_at" field.
func (u *PaymentOrderUpsert) SetRefundAt(v time.Time) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldRefundAt, v)
	return u
}

// UpdateRefundAt sets the "refund_at" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateRefundAt() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldRefundAt)
	return u
}

// ClearRefundAt clears the value of the "refund_at" field.
func (u *PaymentOrderUpsert) ClearRefundAt() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldRefundAt)
	return u
}

// SetForceRefund sets the "force_refund" field.
func (u *PaymentOrderUpsert) SetForceRefund(v bool) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldForceRefund, v)
	return u
}

// UpdateForceRefund sets the "force_refund" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateForceRefund() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldForceRefund)
	return u
}

// SetRefundRequestedAt sets the "refund_requested_at" field.
func (u *PaymentOrderUpsert) SetRefundRequestedAt(v time.Time) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldRefundRequestedAt, v)
	return u
}

// UpdateRefundRequestedAt sets the "refund_requested_at" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateRefundRequestedAt() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldRefundRequestedAt)
	return u
}

// ClearRefundRequestedAt clears the value of the "refund_requested_at" field.
func (u *PaymentOrderUpsert) ClearRefundRequestedAt() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldRefundRequestedAt)
	return u
}

// SetRefundRequestReason sets the "refund_request_reason" field.
func (u *PaymentOrderUpsert) SetRefundRequestReason(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldRefundRequestReason, v)
	return u
}

// UpdateRefundRequestReason sets the "refund_request_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateRefundRequestReason() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldRefundRequestReason)
	return u
}

// ClearRefundRequestReason clears the value of the "refund_request_reason" field.
func (u *PaymentOrderUpsert) ClearRefundRequestReason() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldRefundRequestReason)
	return u
}

// SetRefundRequestedBy sets the "refund_requested_by" field.
func (u *PaymentOrderUpsert) SetRefundRequestedBy(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldRefundRequestedBy, v)
	return u
}

// UpdateRefundRequestedBy sets the "refund_requested_by" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateRefundRequestedBy() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldRefundRequestedBy)
	return u
}

// ClearRefundRequestedBy clears the value of the "refund_requested_by" field.
func (u *PaymentOrderUpsert) ClearRefundRequestedBy() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldRefundRequestedBy)
	return u
}

// SetExpiresAt sets the "expires_at" field.
func (u *PaymentOrderUpsert) SetExpiresAt(v time.Time) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldExpiresAt, v)
	return u
}

// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateExpiresAt() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldExpiresAt)
	return u
}

// SetPaidAt sets the "paid_at" field.
func (u *PaymentOrderUpsert) SetPaidAt(v time.Time) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldPaidAt, v)
	return u
}

// UpdatePaidAt sets the "paid_at" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdatePaidAt() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldPaidAt)
	return u
}

// ClearPaidAt clears the value of the "paid_at" field.
func (u *PaymentOrderUpsert) ClearPaidAt() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldPaidAt)
	return u
}

// SetCompletedAt sets the "completed_at" field.
func (u *PaymentOrderUpsert) SetCompletedAt(v time.Time) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldCompletedAt, v)
	return u
}

// UpdateCompletedAt sets the "completed_at" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateCompletedAt() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldCompletedAt)
	return u
}

// ClearCompletedAt clears the value of the "completed_at" field.
func (u *PaymentOrderUpsert) ClearCompletedAt() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldCompletedAt)
	return u
}

// SetFailedAt sets the "failed_at" field.
func (u *PaymentOrderUpsert) SetFailedAt(v time.Time) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldFailedAt, v)
	return u
}

// UpdateFailedAt sets the "failed_at" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateFailedAt() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldFailedAt)
	return u
}

// ClearFailedAt clears the value of the "failed_at" field.
func (u *PaymentOrderUpsert) ClearFailedAt() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldFailedAt)
	return u
}

// SetFailedReason sets the "failed_reason" field.
func (u *PaymentOrderUpsert) SetFailedReason(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldFailedReason, v)
	return u
}

// UpdateFailedReason sets the "failed_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateFailedReason() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldFailedReason)
	return u
}

// ClearFailedReason clears the value of the "failed_reason" field.
func (u *PaymentOrderUpsert) ClearFailedReason() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldFailedReason)
	return u
}

// SetClientIP sets the "client_ip" field.
func (u *PaymentOrderUpsert) SetClientIP(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldClientIP, v)
	return u
}

// UpdateClientIP sets the "client_ip" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateClientIP() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldClientIP)
	return u
}

// SetSrcHost sets the "src_host" field.
func (u *PaymentOrderUpsert) SetSrcHost(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldSrcHost, v)
	return u
}

// UpdateSrcHost sets the "src_host" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateSrcHost() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldSrcHost)
	return u
}

// SetSrcURL sets the "src_url" field.
func (u *PaymentOrderUpsert) SetSrcURL(v string) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldSrcURL, v)
	return u
}

// UpdateSrcURL sets the "src_url" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateSrcURL() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldSrcURL)
	return u
}

// ClearSrcURL clears the value of the "src_url" field.
func (u *PaymentOrderUpsert) ClearSrcURL() *PaymentOrderUpsert {
	u.SetNull(paymentorder.FieldSrcURL)
	return u
}

// SetUpdatedAt sets the "updated_at" field.
func (u *PaymentOrderUpsert) SetUpdatedAt(v time.Time) *PaymentOrderUpsert {
	u.Set(paymentorder.FieldUpdatedAt, v)
	return u
}

// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateUpdatedAt() *PaymentOrderUpsert {
	u.SetExcluded(paymentorder.FieldUpdatedAt)
	return u
}

// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
//	client.PaymentOrder.Create().
//		OnConflict(
//			sql.ResolveWithNewValues(),
//		).
//		Exec(ctx)
func (u *PaymentOrderUpsertOne) UpdateNewValues() *PaymentOrderUpsertOne {
	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
		if _, exists := u.create.mutation.CreatedAt(); exists {
			s.SetIgnore(paymentorder.FieldCreatedAt)
		}
	}))
	return u
}

// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
//	client.PaymentOrder.Create().
//	    OnConflict(sql.ResolveWithIgnore()).
//	    Exec(ctx)
func (u *PaymentOrderUpsertOne) Ignore() *PaymentOrderUpsertOne {
	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
	return u
}

// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func (u *PaymentOrderUpsertOne) DoNothing() *PaymentOrderUpsertOne {
	u.create.conflict = append(u.create.conflict, sql.DoNothing())
	return u
}

// Update allows overriding fields `UPDATE` values. See the PaymentOrderCreate.OnConflict
// documentation for more info.
func (u *PaymentOrderUpsertOne) Update(set func(*PaymentOrderUpsert)) *PaymentOrderUpsertOne {
	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
		set(&PaymentOrderUpsert{UpdateSet: update})
	}))
	return u
}

// SetUserID sets the "user_id" field.
func (u *PaymentOrderUpsertOne) SetUserID(v int64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserID(v)
	})
}

// UpdateUserID sets the "user_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateUserID() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserID()
	})
}

// SetUserEmail sets the "user_email" field.
func (u *PaymentOrderUpsertOne) SetUserEmail(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserEmail(v)
	})
}

// UpdateUserEmail sets the "user_email" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateUserEmail() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserEmail()
	})
}

// SetUserName sets the "user_name" field.
func (u *PaymentOrderUpsertOne) SetUserName(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserName(v)
	})
}

// UpdateUserName sets the "user_name" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateUserName() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserName()
	})
}

// SetUserNotes sets the "user_notes" field.
func (u *PaymentOrderUpsertOne) SetUserNotes(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserNotes(v)
	})
}

// UpdateUserNotes sets the "user_notes" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateUserNotes() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserNotes()
	})
}

// ClearUserNotes clears the value of the "user_notes" field.
func (u *PaymentOrderUpsertOne) ClearUserNotes() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearUserNotes()
	})
}

// SetAmount sets the "amount" field.
func (u *PaymentOrderUpsertOne) SetAmount(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetAmount(v)
	})
}

// AddAmount adds v to the "amount" field.
func (u *PaymentOrderUpsertOne) AddAmount(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddAmount(v)
	})
}

// UpdateAmount sets the "amount" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateAmount() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateAmount()
	})
}

// SetPayAmount sets the "pay_amount" field.
func (u *PaymentOrderUpsertOne) SetPayAmount(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPayAmount(v)
	})
}

// AddPayAmount adds v to the "pay_amount" field.
func (u *PaymentOrderUpsertOne) AddPayAmount(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddPayAmount(v)
	})
}

// UpdatePayAmount sets the "pay_amount" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdatePayAmount() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePayAmount()
	})
}

// SetFeeRate sets the "fee_rate" field.
func (u *PaymentOrderUpsertOne) SetFeeRate(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetFeeRate(v)
	})
}

// AddFeeRate adds v to the "fee_rate" field.
func (u *PaymentOrderUpsertOne) AddFeeRate(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddFeeRate(v)
	})
}

// UpdateFeeRate sets the "fee_rate" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateFeeRate() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateFeeRate()
	})
}

// SetRechargeCode sets the "recharge_code" field.
func (u *PaymentOrderUpsertOne) SetRechargeCode(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRechargeCode(v)
	})
}

// UpdateRechargeCode sets the "recharge_code" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateRechargeCode() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRechargeCode()
	})
}

// SetOutTradeNo sets the "out_trade_no" field.
func (u *PaymentOrderUpsertOne) SetOutTradeNo(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetOutTradeNo(v)
	})
}

// UpdateOutTradeNo sets the "out_trade_no" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateOutTradeNo() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateOutTradeNo()
	})
}

// SetPaymentType sets the "payment_type" field.
func (u *PaymentOrderUpsertOne) SetPaymentType(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPaymentType(v)
	})
}

// UpdatePaymentType sets the "payment_type" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdatePaymentType() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePaymentType()
	})
}

// SetPaymentTradeNo sets the "payment_trade_no" field.
func (u *PaymentOrderUpsertOne) SetPaymentTradeNo(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPaymentTradeNo(v)
	})
}

// UpdatePaymentTradeNo sets the "payment_trade_no" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdatePaymentTradeNo() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePaymentTradeNo()
	})
}

// SetPayURL sets the "pay_url" field.
func (u *PaymentOrderUpsertOne) SetPayURL(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPayURL(v)
	})
}

// UpdatePayURL sets the "pay_url" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdatePayURL() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePayURL()
	})
}

// ClearPayURL clears the value of the "pay_url" field.
func (u *PaymentOrderUpsertOne) ClearPayURL() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearPayURL()
	})
}

// SetQrCode sets the "qr_code" field.
func (u *PaymentOrderUpsertOne) SetQrCode(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetQrCode(v)
	})
}

// UpdateQrCode sets the "qr_code" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateQrCode() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateQrCode()
	})
}

// ClearQrCode clears the value of the "qr_code" field.
func (u *PaymentOrderUpsertOne) ClearQrCode() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearQrCode()
	})
}

// SetQrCodeImg sets the "qr_code_img" field.
func (u *PaymentOrderUpsertOne) SetQrCodeImg(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetQrCodeImg(v)
	})
}

// UpdateQrCodeImg sets the "qr_code_img" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateQrCodeImg() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateQrCodeImg()
	})
}

// ClearQrCodeImg clears the value of the "qr_code_img" field.
func (u *PaymentOrderUpsertOne) ClearQrCodeImg() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearQrCodeImg()
	})
}

// SetOrderType sets the "order_type" field.
func (u *PaymentOrderUpsertOne) SetOrderType(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetOrderType(v)
	})
}

// UpdateOrderType sets the "order_type" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateOrderType() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateOrderType()
	})
}

// SetPlanID sets the "plan_id" field.
func (u *PaymentOrderUpsertOne) SetPlanID(v int64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPlanID(v)
	})
}

// AddPlanID adds v to the "plan_id" field.
func (u *PaymentOrderUpsertOne) AddPlanID(v int64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddPlanID(v)
	})
}

// UpdatePlanID sets the "plan_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdatePlanID() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePlanID()
	})
}

// ClearPlanID clears the value of the "plan_id" field.
func (u *PaymentOrderUpsertOne) ClearPlanID() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearPlanID()
	})
}

// SetSubscriptionGroupID sets the "subscription_group_id" field.
func (u *PaymentOrderUpsertOne) SetSubscriptionGroupID(v int64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSubscriptionGroupID(v)
	})
}

// AddSubscriptionGroupID adds v to the "subscription_group_id" field.
func (u *PaymentOrderUpsertOne) AddSubscriptionGroupID(v int64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddSubscriptionGroupID(v)
	})
}

// UpdateSubscriptionGroupID sets the "subscription_group_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateSubscriptionGroupID() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSubscriptionGroupID()
	})
}

// ClearSubscriptionGroupID clears the value of the "subscription_group_id" field.
func (u *PaymentOrderUpsertOne) ClearSubscriptionGroupID() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearSubscriptionGroupID()
	})
}

// SetSubscriptionDays sets the "subscription_days" field.
func (u *PaymentOrderUpsertOne) SetSubscriptionDays(v int) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSubscriptionDays(v)
	})
}

// AddSubscriptionDays adds v to the "subscription_days" field.
func (u *PaymentOrderUpsertOne) AddSubscriptionDays(v int) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddSubscriptionDays(v)
	})
}

// UpdateSubscriptionDays sets the "subscription_days" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateSubscriptionDays() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSubscriptionDays()
	})
}

// ClearSubscriptionDays clears the value of the "subscription_days" field.
func (u *PaymentOrderUpsertOne) ClearSubscriptionDays() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearSubscriptionDays()
	})
}

// SetProviderInstanceID sets the "provider_instance_id" field.
func (u *PaymentOrderUpsertOne) SetProviderInstanceID(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetProviderInstanceID(v)
	})
}

// UpdateProviderInstanceID sets the "provider_instance_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateProviderInstanceID() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateProviderInstanceID()
	})
}

// ClearProviderInstanceID clears the value of the "provider_instance_id" field.
func (u *PaymentOrderUpsertOne) ClearProviderInstanceID() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearProviderInstanceID()
	})
}

// SetStatus sets the "status" field.
func (u *PaymentOrderUpsertOne) SetStatus(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetStatus(v)
	})
}

// UpdateStatus sets the "status" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateStatus() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateStatus()
	})
}

// SetRefundAmount sets the "refund_amount" field.
func (u *PaymentOrderUpsertOne) SetRefundAmount(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundAmount(v)
	})
}

// AddRefundAmount adds v to the "refund_amount" field.
func (u *PaymentOrderUpsertOne) AddRefundAmount(v float64) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddRefundAmount(v)
	})
}

// UpdateRefundAmount sets the "refund_amount" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateRefundAmount() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundAmount()
	})
}

// SetRefundReason sets the "refund_reason" field.
func (u *PaymentOrderUpsertOne) SetRefundReason(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundReason(v)
	})
}

// UpdateRefundReason sets the "refund_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateRefundReason() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundReason()
	})
}

// ClearRefundReason clears the value of the "refund_reason" field.
func (u *PaymentOrderUpsertOne) ClearRefundReason() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundReason()
	})
}

// SetRefundAt sets the "refund_at" field.
func (u *PaymentOrderUpsertOne) SetRefundAt(v time.Time) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundAt(v)
	})
}

// UpdateRefundAt sets the "refund_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateRefundAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundAt()
	})
}

// ClearRefundAt clears the value of the "refund_at" field.
func (u *PaymentOrderUpsertOne) ClearRefundAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundAt()
	})
}

// SetForceRefund sets the "force_refund" field.
func (u *PaymentOrderUpsertOne) SetForceRefund(v bool) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetForceRefund(v)
	})
}

// UpdateForceRefund sets the "force_refund" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateForceRefund() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateForceRefund()
	})
}

// SetRefundRequestedAt sets the "refund_requested_at" field.
func (u *PaymentOrderUpsertOne) SetRefundRequestedAt(v time.Time) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundRequestedAt(v)
	})
}

// UpdateRefundRequestedAt sets the "refund_requested_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateRefundRequestedAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundRequestedAt()
	})
}

// ClearRefundRequestedAt clears the value of the "refund_requested_at" field.
func (u *PaymentOrderUpsertOne) ClearRefundRequestedAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundRequestedAt()
	})
}

// SetRefundRequestReason sets the "refund_request_reason" field.
func (u *PaymentOrderUpsertOne) SetRefundRequestReason(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundRequestReason(v)
	})
}

// UpdateRefundRequestReason sets the "refund_request_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateRefundRequestReason() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundRequestReason()
	})
}

// ClearRefundRequestReason clears the value of the "refund_request_reason" field.
func (u *PaymentOrderUpsertOne) ClearRefundRequestReason() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundRequestReason()
	})
}

// SetRefundRequestedBy sets the "refund_requested_by" field.
func (u *PaymentOrderUpsertOne) SetRefundRequestedBy(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundRequestedBy(v)
	})
}

// UpdateRefundRequestedBy sets the "refund_requested_by" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateRefundRequestedBy() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundRequestedBy()
	})
}

// ClearRefundRequestedBy clears the value of the "refund_requested_by" field.
func (u *PaymentOrderUpsertOne) ClearRefundRequestedBy() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundRequestedBy()
	})
}

// SetExpiresAt sets the "expires_at" field.
func (u *PaymentOrderUpsertOne) SetExpiresAt(v time.Time) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetExpiresAt(v)
	})
}

// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateExpiresAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateExpiresAt()
	})
}

// SetPaidAt sets the "paid_at" field.
func (u *PaymentOrderUpsertOne) SetPaidAt(v time.Time) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPaidAt(v)
	})
}

// UpdatePaidAt sets the "paid_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdatePaidAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePaidAt()
	})
}

// ClearPaidAt clears the value of the "paid_at" field.
func (u *PaymentOrderUpsertOne) ClearPaidAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearPaidAt()
	})
}

// SetCompletedAt sets the "completed_at" field.
func (u *PaymentOrderUpsertOne) SetCompletedAt(v time.Time) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetCompletedAt(v)
	})
}

// UpdateCompletedAt sets the "completed_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateCompletedAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateCompletedAt()
	})
}

// ClearCompletedAt clears the value of the "completed_at" field.
func (u *PaymentOrderUpsertOne) ClearCompletedAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearCompletedAt()
	})
}

// SetFailedAt sets the "failed_at" field.
func (u *PaymentOrderUpsertOne) SetFailedAt(v time.Time) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetFailedAt(v)
	})
}

// UpdateFailedAt sets the "failed_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateFailedAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateFailedAt()
	})
}

// ClearFailedAt clears the value of the "failed_at" field.
func (u *PaymentOrderUpsertOne) ClearFailedAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearFailedAt()
	})
}

// SetFailedReason sets the "failed_reason" field.
func (u *PaymentOrderUpsertOne) SetFailedReason(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetFailedReason(v)
	})
}

// UpdateFailedReason sets the "failed_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateFailedReason() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateFailedReason()
	})
}

// ClearFailedReason clears the value of the "failed_reason" field.
func (u *PaymentOrderUpsertOne) ClearFailedReason() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearFailedReason()
	})
}

// SetClientIP sets the "client_ip" field.
func (u *PaymentOrderUpsertOne) SetClientIP(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetClientIP(v)
	})
}

// UpdateClientIP sets the "client_ip" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateClientIP() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateClientIP()
	})
}

// SetSrcHost sets the "src_host" field.
func (u *PaymentOrderUpsertOne) SetSrcHost(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSrcHost(v)
	})
}

// UpdateSrcHost sets the "src_host" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateSrcHost() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSrcHost()
	})
}

// SetSrcURL sets the "src_url" field.
func (u *PaymentOrderUpsertOne) SetSrcURL(v string) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSrcURL(v)
	})
}

// UpdateSrcURL sets the "src_url" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateSrcURL() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSrcURL()
	})
}

// ClearSrcURL clears the value of the "src_url" field.
func (u *PaymentOrderUpsertOne) ClearSrcURL() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearSrcURL()
	})
}

// SetUpdatedAt sets the "updated_at" field.
func (u *PaymentOrderUpsertOne) SetUpdatedAt(v time.Time) *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUpdatedAt(v)
	})
}

// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateUpdatedAt() *PaymentOrderUpsertOne {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUpdatedAt()
	})
}

// Exec executes the query.
func (u *PaymentOrderUpsertOne) Exec(ctx context.Context) error {
	if len(u.create.conflict) == 0 {
		return errors.New("ent: missing options for PaymentOrderCreate.OnConflict")
	}
	return u.create.Exec(ctx)
}

// ExecX is like Exec, but panics if an error occurs.
func (u *PaymentOrderUpsertOne) ExecX(ctx context.Context) {
	if err := u.create.Exec(ctx); err != nil {
		panic(err)
	}
}

// Exec executes the UPSERT query and returns the inserted/updated ID.
func (u *PaymentOrderUpsertOne) ID(ctx context.Context) (id int64, err error) {
	node, err := u.create.Save(ctx)
	if err != nil {
		return id, err
	}
	return node.ID, nil
}

// IDX is like ID, but panics if an error occurs.
func (u *PaymentOrderUpsertOne) IDX(ctx context.Context) int64 {
	id, err := u.ID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}

// PaymentOrderCreateBulk is the builder for creating many PaymentOrder entities in bulk.
type PaymentOrderCreateBulk struct {
	config
	err      error
	builders []*PaymentOrderCreate
	conflict []sql.ConflictOption
}

// Save creates the PaymentOrder entities in the database.
func (_c *PaymentOrderCreateBulk) Save(ctx context.Context) ([]*PaymentOrder, error) {
	if _c.err != nil {
		return nil, _c.err
	}
	specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
	nodes := make([]*PaymentOrder, len(_c.builders))
	mutators := make([]Mutator, len(_c.builders))
	for i := range _c.builders {
		func(i int, root context.Context) {
			builder := _c.builders[i]
			builder.defaults()
			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
				mutation, ok := m.(*PaymentOrderMutation)
				if !ok {
					return nil, fmt.Errorf("unexpected mutation type %T", m)
				}
				if err := builder.check(); err != nil {
					return nil, err
				}
				builder.mutation = mutation
				var err error
				nodes[i], specs[i] = builder.createSpec()
				if i < len(mutators)-1 {
					_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
				} else {
					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
					spec.OnConflict = _c.conflict
					// Invoke the actual operation on the latest mutation in the chain.
					if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
						if sqlgraph.IsConstraintError(err) {
							err = &ConstraintError{msg: err.Error(), wrap: err}
						}
					}
				}
				if err != nil {
					return nil, err
				}
				mutation.id = &nodes[i].ID
				if specs[i].ID.Value != nil {
					id := specs[i].ID.Value.(int64)
					nodes[i].ID = int64(id)
				}
				mutation.done = true
				return nodes[i], nil
			})
			for i := len(builder.hooks) - 1; i >= 0; i-- {
				mut = builder.hooks[i](mut)
			}
			mutators[i] = mut
		}(i, ctx)
	}
	if len(mutators) > 0 {
		if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
			return nil, err
		}
	}
	return nodes, nil
}

// SaveX is like Save, but panics if an error occurs.
func (_c *PaymentOrderCreateBulk) SaveX(ctx context.Context) []*PaymentOrder {
	v, err := _c.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Exec executes the query.
func (_c *PaymentOrderCreateBulk) Exec(ctx context.Context) error {
	_, err := _c.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (_c *PaymentOrderCreateBulk) ExecX(ctx context.Context) {
	if err := _c.Exec(ctx); err != nil {
		panic(err)
	}
}

// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
//	client.PaymentOrder.CreateBulk(builders...).
//		OnConflict(
//			// Update the row with the new values
//			// the was proposed for insertion.
//			sql.ResolveWithNewValues(),
//		).
//		// Override some of the fields with custom
//		// update values.
//		Update(func(u *ent.PaymentOrderUpsert) {
//			SetUserID(v+v).
//		}).
//		Exec(ctx)
func (_c *PaymentOrderCreateBulk) OnConflict(opts ...sql.ConflictOption) *PaymentOrderUpsertBulk {
	_c.conflict = opts
	return &PaymentOrderUpsertBulk{
		create: _c,
	}
}

// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
//	client.PaymentOrder.Create().
//		OnConflict(sql.ConflictColumns(columns...)).
//		Exec(ctx)
func (_c *PaymentOrderCreateBulk) OnConflictColumns(columns ...string) *PaymentOrderUpsertBulk {
	_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
	return &PaymentOrderUpsertBulk{
		create: _c,
	}
}

// PaymentOrderUpsertBulk is the builder for "upsert"-ing
// a bulk of PaymentOrder nodes.
type PaymentOrderUpsertBulk struct {
	create *PaymentOrderCreateBulk
}

// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
//	client.PaymentOrder.Create().
//		OnConflict(
//			sql.ResolveWithNewValues(),
//		).
//		Exec(ctx)
func (u *PaymentOrderUpsertBulk) UpdateNewValues() *PaymentOrderUpsertBulk {
	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
		for _, b := range u.create.builders {
			if _, exists := b.mutation.CreatedAt(); exists {
				s.SetIgnore(paymentorder.FieldCreatedAt)
			}
		}
	}))
	return u
}

// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
//	client.PaymentOrder.Create().
//		OnConflict(sql.ResolveWithIgnore()).
//		Exec(ctx)
func (u *PaymentOrderUpsertBulk) Ignore() *PaymentOrderUpsertBulk {
	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
	return u
}

// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func (u *PaymentOrderUpsertBulk) DoNothing() *PaymentOrderUpsertBulk {
	u.create.conflict = append(u.create.conflict, sql.DoNothing())
	return u
}

// Update allows overriding fields `UPDATE` values. See the PaymentOrderCreateBulk.OnConflict
// documentation for more info.
func (u *PaymentOrderUpsertBulk) Update(set func(*PaymentOrderUpsert)) *PaymentOrderUpsertBulk {
	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
		set(&PaymentOrderUpsert{UpdateSet: update})
	}))
	return u
}

// SetUserID sets the "user_id" field.
func (u *PaymentOrderUpsertBulk) SetUserID(v int64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserID(v)
	})
}

// UpdateUserID sets the "user_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateUserID() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserID()
	})
}

// SetUserEmail sets the "user_email" field.
func (u *PaymentOrderUpsertBulk) SetUserEmail(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserEmail(v)
	})
}

// UpdateUserEmail sets the "user_email" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateUserEmail() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserEmail()
	})
}

// SetUserName sets the "user_name" field.
func (u *PaymentOrderUpsertBulk) SetUserName(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserName(v)
	})
}

// UpdateUserName sets the "user_name" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateUserName() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserName()
	})
}

// SetUserNotes sets the "user_notes" field.
func (u *PaymentOrderUpsertBulk) SetUserNotes(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUserNotes(v)
	})
}

// UpdateUserNotes sets the "user_notes" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateUserNotes() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUserNotes()
	})
}

// ClearUserNotes clears the value of the "user_notes" field.
func (u *PaymentOrderUpsertBulk) ClearUserNotes() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearUserNotes()
	})
}

// SetAmount sets the "amount" field.
func (u *PaymentOrderUpsertBulk) SetAmount(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetAmount(v)
	})
}

// AddAmount adds v to the "amount" field.
func (u *PaymentOrderUpsertBulk) AddAmount(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddAmount(v)
	})
}

// UpdateAmount sets the "amount" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateAmount() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateAmount()
	})
}

// SetPayAmount sets the "pay_amount" field.
func (u *PaymentOrderUpsertBulk) SetPayAmount(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPayAmount(v)
	})
}

// AddPayAmount adds v to the "pay_amount" field.
func (u *PaymentOrderUpsertBulk) AddPayAmount(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddPayAmount(v)
	})
}

// UpdatePayAmount sets the "pay_amount" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdatePayAmount() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePayAmount()
	})
}

// SetFeeRate sets the "fee_rate" field.
func (u *PaymentOrderUpsertBulk) SetFeeRate(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetFeeRate(v)
	})
}

// AddFeeRate adds v to the "fee_rate" field.
func (u *PaymentOrderUpsertBulk) AddFeeRate(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddFeeRate(v)
	})
}

// UpdateFeeRate sets the "fee_rate" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateFeeRate() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateFeeRate()
	})
}

// SetRechargeCode sets the "recharge_code" field.
func (u *PaymentOrderUpsertBulk) SetRechargeCode(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRechargeCode(v)
	})
}

// UpdateRechargeCode sets the "recharge_code" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateRechargeCode() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRechargeCode()
	})
}

// SetOutTradeNo sets the "out_trade_no" field.
func (u *PaymentOrderUpsertBulk) SetOutTradeNo(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetOutTradeNo(v)
	})
}

// UpdateOutTradeNo sets the "out_trade_no" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateOutTradeNo() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateOutTradeNo()
	})
}

// SetPaymentType sets the "payment_type" field.
func (u *PaymentOrderUpsertBulk) SetPaymentType(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPaymentType(v)
	})
}

// UpdatePaymentType sets the "payment_type" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdatePaymentType() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePaymentType()
	})
}

// SetPaymentTradeNo sets the "payment_trade_no" field.
func (u *PaymentOrderUpsertBulk) SetPaymentTradeNo(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPaymentTradeNo(v)
	})
}

// UpdatePaymentTradeNo sets the "payment_trade_no" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdatePaymentTradeNo() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePaymentTradeNo()
	})
}

// SetPayURL sets the "pay_url" field.
func (u *PaymentOrderUpsertBulk) SetPayURL(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPayURL(v)
	})
}

// UpdatePayURL sets the "pay_url" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdatePayURL() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePayURL()
	})
}

// ClearPayURL clears the value of the "pay_url" field.
func (u *PaymentOrderUpsertBulk) ClearPayURL() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearPayURL()
	})
}

// SetQrCode sets the "qr_code" field.
func (u *PaymentOrderUpsertBulk) SetQrCode(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetQrCode(v)
	})
}

// UpdateQrCode sets the "qr_code" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateQrCode() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateQrCode()
	})
}

// ClearQrCode clears the value of the "qr_code" field.
func (u *PaymentOrderUpsertBulk) ClearQrCode() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearQrCode()
	})
}

// SetQrCodeImg sets the "qr_code_img" field.
func (u *PaymentOrderUpsertBulk) SetQrCodeImg(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetQrCodeImg(v)
	})
}

// UpdateQrCodeImg sets the "qr_code_img" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateQrCodeImg() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateQrCodeImg()
	})
}

// ClearQrCodeImg clears the value of the "qr_code_img" field.
func (u *PaymentOrderUpsertBulk) ClearQrCodeImg() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearQrCodeImg()
	})
}

// SetOrderType sets the "order_type" field.
func (u *PaymentOrderUpsertBulk) SetOrderType(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetOrderType(v)
	})
}

// UpdateOrderType sets the "order_type" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateOrderType() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateOrderType()
	})
}

// SetPlanID sets the "plan_id" field.
func (u *PaymentOrderUpsertBulk) SetPlanID(v int64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPlanID(v)
	})
}

// AddPlanID adds v to the "plan_id" field.
func (u *PaymentOrderUpsertBulk) AddPlanID(v int64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddPlanID(v)
	})
}

// UpdatePlanID sets the "plan_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdatePlanID() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePlanID()
	})
}

// ClearPlanID clears the value of the "plan_id" field.
func (u *PaymentOrderUpsertBulk) ClearPlanID() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearPlanID()
	})
}

// SetSubscriptionGroupID sets the "subscription_group_id" field.
func (u *PaymentOrderUpsertBulk) SetSubscriptionGroupID(v int64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSubscriptionGroupID(v)
	})
}

// AddSubscriptionGroupID adds v to the "subscription_group_id" field.
func (u *PaymentOrderUpsertBulk) AddSubscriptionGroupID(v int64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddSubscriptionGroupID(v)
	})
}

// UpdateSubscriptionGroupID sets the "subscription_group_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateSubscriptionGroupID() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSubscriptionGroupID()
	})
}

// ClearSubscriptionGroupID clears the value of the "subscription_group_id" field.
func (u *PaymentOrderUpsertBulk) ClearSubscriptionGroupID() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearSubscriptionGroupID()
	})
}

// SetSubscriptionDays sets the "subscription_days" field.
func (u *PaymentOrderUpsertBulk) SetSubscriptionDays(v int) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSubscriptionDays(v)
	})
}

// AddSubscriptionDays adds v to the "subscription_days" field.
func (u *PaymentOrderUpsertBulk) AddSubscriptionDays(v int) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddSubscriptionDays(v)
	})
}

// UpdateSubscriptionDays sets the "subscription_days" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateSubscriptionDays() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSubscriptionDays()
	})
}

// ClearSubscriptionDays clears the value of the "subscription_days" field.
func (u *PaymentOrderUpsertBulk) ClearSubscriptionDays() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearSubscriptionDays()
	})
}

// SetProviderInstanceID sets the "provider_instance_id" field.
func (u *PaymentOrderUpsertBulk) SetProviderInstanceID(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetProviderInstanceID(v)
	})
}

// UpdateProviderInstanceID sets the "provider_instance_id" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateProviderInstanceID() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateProviderInstanceID()
	})
}

// ClearProviderInstanceID clears the value of the "provider_instance_id" field.
func (u *PaymentOrderUpsertBulk) ClearProviderInstanceID() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearProviderInstanceID()
	})
}

// SetStatus sets the "status" field.
func (u *PaymentOrderUpsertBulk) SetStatus(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetStatus(v)
	})
}

// UpdateStatus sets the "status" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateStatus() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateStatus()
	})
}

// SetRefundAmount sets the "refund_amount" field.
func (u *PaymentOrderUpsertBulk) SetRefundAmount(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundAmount(v)
	})
}

// AddRefundAmount adds v to the "refund_amount" field.
func (u *PaymentOrderUpsertBulk) AddRefundAmount(v float64) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.AddRefundAmount(v)
	})
}

// UpdateRefundAmount sets the "refund_amount" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateRefundAmount() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundAmount()
	})
}

// SetRefundReason sets the "refund_reason" field.
func (u *PaymentOrderUpsertBulk) SetRefundReason(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundReason(v)
	})
}

// UpdateRefundReason sets the "refund_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateRefundReason() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundReason()
	})
}

// ClearRefundReason clears the value of the "refund_reason" field.
func (u *PaymentOrderUpsertBulk) ClearRefundReason() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundReason()
	})
}

// SetRefundAt sets the "refund_at" field.
func (u *PaymentOrderUpsertBulk) SetRefundAt(v time.Time) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundAt(v)
	})
}

// UpdateRefundAt sets the "refund_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateRefundAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundAt()
	})
}

// ClearRefundAt clears the value of the "refund_at" field.
func (u *PaymentOrderUpsertBulk) ClearRefundAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundAt()
	})
}

// SetForceRefund sets the "force_refund" field.
func (u *PaymentOrderUpsertBulk) SetForceRefund(v bool) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetForceRefund(v)
	})
}

// UpdateForceRefund sets the "force_refund" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateForceRefund() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateForceRefund()
	})
}

// SetRefundRequestedAt sets the "refund_requested_at" field.
func (u *PaymentOrderUpsertBulk) SetRefundRequestedAt(v time.Time) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundRequestedAt(v)
	})
}

// UpdateRefundRequestedAt sets the "refund_requested_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateRefundRequestedAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundRequestedAt()
	})
}

// ClearRefundRequestedAt clears the value of the "refund_requested_at" field.
func (u *PaymentOrderUpsertBulk) ClearRefundRequestedAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundRequestedAt()
	})
}

// SetRefundRequestReason sets the "refund_request_reason" field.
func (u *PaymentOrderUpsertBulk) SetRefundRequestReason(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundRequestReason(v)
	})
}

// UpdateRefundRequestReason sets the "refund_request_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateRefundRequestReason() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundRequestReason()
	})
}

// ClearRefundRequestReason clears the value of the "refund_request_reason" field.
func (u *PaymentOrderUpsertBulk) ClearRefundRequestReason() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundRequestReason()
	})
}

// SetRefundRequestedBy sets the "refund_requested_by" field.
func (u *PaymentOrderUpsertBulk) SetRefundRequestedBy(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetRefundRequestedBy(v)
	})
}

// UpdateRefundRequestedBy sets the "refund_requested_by" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateRefundRequestedBy() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateRefundRequestedBy()
	})
}

// ClearRefundRequestedBy clears the value of the "refund_requested_by" field.
func (u *PaymentOrderUpsertBulk) ClearRefundRequestedBy() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearRefundRequestedBy()
	})
}

// SetExpiresAt sets the "expires_at" field.
func (u *PaymentOrderUpsertBulk) SetExpiresAt(v time.Time) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetExpiresAt(v)
	})
}

// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateExpiresAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateExpiresAt()
	})
}

// SetPaidAt sets the "paid_at" field.
func (u *PaymentOrderUpsertBulk) SetPaidAt(v time.Time) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetPaidAt(v)
	})
}

// UpdatePaidAt sets the "paid_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdatePaidAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdatePaidAt()
	})
}

// ClearPaidAt clears the value of the "paid_at" field.
func (u *PaymentOrderUpsertBulk) ClearPaidAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearPaidAt()
	})
}

// SetCompletedAt sets the "completed_at" field.
func (u *PaymentOrderUpsertBulk) SetCompletedAt(v time.Time) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetCompletedAt(v)
	})
}

// UpdateCompletedAt sets the "completed_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateCompletedAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateCompletedAt()
	})
}

// ClearCompletedAt clears the value of the "completed_at" field.
func (u *PaymentOrderUpsertBulk) ClearCompletedAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearCompletedAt()
	})
}

// SetFailedAt sets the "failed_at" field.
func (u *PaymentOrderUpsertBulk) SetFailedAt(v time.Time) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetFailedAt(v)
	})
}

// UpdateFailedAt sets the "failed_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateFailedAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateFailedAt()
	})
}

// ClearFailedAt clears the value of the "failed_at" field.
func (u *PaymentOrderUpsertBulk) ClearFailedAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearFailedAt()
	})
}

// SetFailedReason sets the "failed_reason" field.
func (u *PaymentOrderUpsertBulk) SetFailedReason(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetFailedReason(v)
	})
}

// UpdateFailedReason sets the "failed_reason" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateFailedReason() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateFailedReason()
	})
}

// ClearFailedReason clears the value of the "failed_reason" field.
func (u *PaymentOrderUpsertBulk) ClearFailedReason() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearFailedReason()
	})
}

// SetClientIP sets the "client_ip" field.
func (u *PaymentOrderUpsertBulk) SetClientIP(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetClientIP(v)
	})
}

// UpdateClientIP sets the "client_ip" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateClientIP() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateClientIP()
	})
}

// SetSrcHost sets the "src_host" field.
func (u *PaymentOrderUpsertBulk) SetSrcHost(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSrcHost(v)
	})
}

// UpdateSrcHost sets the "src_host" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateSrcHost() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSrcHost()
	})
}

// SetSrcURL sets the "src_url" field.
func (u *PaymentOrderUpsertBulk) SetSrcURL(v string) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetSrcURL(v)
	})
}

// UpdateSrcURL sets the "src_url" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateSrcURL() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateSrcURL()
	})
}

// ClearSrcURL clears the value of the "src_url" field.
func (u *PaymentOrderUpsertBulk) ClearSrcURL() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.ClearSrcURL()
	})
}

// SetUpdatedAt sets the "updated_at" field.
func (u *PaymentOrderUpsertBulk) SetUpdatedAt(v time.Time) *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.SetUpdatedAt(v)
	})
}

// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateUpdatedAt() *PaymentOrderUpsertBulk {
	return u.Update(func(s *PaymentOrderUpsert) {
		s.UpdateUpdatedAt()
	})
}

// Exec executes the query.
func (u *PaymentOrderUpsertBulk) Exec(ctx context.Context) error {
	if u.create.err != nil {
		return u.create.err
	}
	for i, b := range u.create.builders {
		if len(b.conflict) != 0 {
			return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the PaymentOrderCreateBulk instead", i)
		}
	}
	if len(u.create.conflict) == 0 {
		return errors.New("ent: missing options for PaymentOrderCreateBulk.OnConflict")
	}
	return u.create.Exec(ctx)
}

// ExecX is like Exec, but panics if an error occurs.
func (u *PaymentOrderUpsertBulk) ExecX(ctx context.Context) {
	if err := u.create.Exec(ctx); err != nil {
		panic(err)
	}
}
