mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-21 15:09:21 +00:00
Replace iframe-based external payment with native implementation: Backend (Go): - 5 new Ent schemas: PaymentOrder, PaymentAuditLog, PaymentChannel, SubscriptionPlan, PaymentProviderInstance - 5 SQL migrations (090-094) - Payment provider interface + registry + load balancer - 4 provider implementations (EasyPay, Alipay, WxPay, Stripe) - PaymentService (order lifecycle, fulfillment, refund 3-phase) - PaymentConfigService (settings, instance/channel/plan CRUD) - 31 API endpoints (9 user + 4 webhook + 18 admin) - Wire DI integration Frontend (Vue3): - Payment types, API modules, store, router changes - Sidebar: payment_enabled controls visibility, new menu items - User pages: PaymentView (replace iframe), QR payment, Stripe, result page, order list - Admin pages: Order management (4 tabs), provider instance mgmt - Settings: new payment tab, removed old purchase iframe config - i18n: full payment namespace (en + zh) Docs: - PAYMENT_FRONTEND_MIGRATION_PLAN.md - PAYMENT_BACKEND_MIGRATION_PLAN.md - PAYMENT_IMPLEMENTATION_ROADMAP.md
1167 lines
36 KiB
Go
1167 lines
36 KiB
Go
// 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/paymentchannel"
|
|
)
|
|
|
|
// PaymentChannelCreate is the builder for creating a PaymentChannel entity.
|
|
type PaymentChannelCreate struct {
|
|
config
|
|
mutation *PaymentChannelMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetGroupID sets the "group_id" field.
|
|
func (_c *PaymentChannelCreate) SetGroupID(v int64) *PaymentChannelCreate {
|
|
_c.mutation.SetGroupID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableGroupID sets the "group_id" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableGroupID(v *int64) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetGroupID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (_c *PaymentChannelCreate) SetName(v string) *PaymentChannelCreate {
|
|
_c.mutation.SetName(v)
|
|
return _c
|
|
}
|
|
|
|
// SetPlatform sets the "platform" field.
|
|
func (_c *PaymentChannelCreate) SetPlatform(v string) *PaymentChannelCreate {
|
|
_c.mutation.SetPlatform(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillablePlatform sets the "platform" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillablePlatform(v *string) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetPlatform(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetRateMultiplier sets the "rate_multiplier" field.
|
|
func (_c *PaymentChannelCreate) SetRateMultiplier(v float64) *PaymentChannelCreate {
|
|
_c.mutation.SetRateMultiplier(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableRateMultiplier sets the "rate_multiplier" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableRateMultiplier(v *float64) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetRateMultiplier(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (_c *PaymentChannelCreate) SetDescription(v string) *PaymentChannelCreate {
|
|
_c.mutation.SetDescription(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableDescription sets the "description" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableDescription(v *string) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetDescription(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetModels sets the "models" field.
|
|
func (_c *PaymentChannelCreate) SetModels(v string) *PaymentChannelCreate {
|
|
_c.mutation.SetModels(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableModels sets the "models" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableModels(v *string) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetModels(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetFeatures sets the "features" field.
|
|
func (_c *PaymentChannelCreate) SetFeatures(v string) *PaymentChannelCreate {
|
|
_c.mutation.SetFeatures(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableFeatures sets the "features" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableFeatures(v *string) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetFeatures(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetSortOrder sets the "sort_order" field.
|
|
func (_c *PaymentChannelCreate) SetSortOrder(v int) *PaymentChannelCreate {
|
|
_c.mutation.SetSortOrder(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableSortOrder sets the "sort_order" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableSortOrder(v *int) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetSortOrder(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetEnabled sets the "enabled" field.
|
|
func (_c *PaymentChannelCreate) SetEnabled(v bool) *PaymentChannelCreate {
|
|
_c.mutation.SetEnabled(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableEnabled sets the "enabled" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableEnabled(v *bool) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetEnabled(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *PaymentChannelCreate) SetCreatedAt(v time.Time) *PaymentChannelCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableCreatedAt(v *time.Time) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_c *PaymentChannelCreate) SetUpdatedAt(v time.Time) *PaymentChannelCreate {
|
|
_c.mutation.SetUpdatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_c *PaymentChannelCreate) SetNillableUpdatedAt(v *time.Time) *PaymentChannelCreate {
|
|
if v != nil {
|
|
_c.SetUpdatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// Mutation returns the PaymentChannelMutation object of the builder.
|
|
func (_c *PaymentChannelCreate) Mutation() *PaymentChannelMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the PaymentChannel in the database.
|
|
func (_c *PaymentChannelCreate) Save(ctx context.Context) (*PaymentChannel, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *PaymentChannelCreate) SaveX(ctx context.Context) *PaymentChannel {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *PaymentChannelCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *PaymentChannelCreate) 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 *PaymentChannelCreate) defaults() {
|
|
if _, ok := _c.mutation.Platform(); !ok {
|
|
v := paymentchannel.DefaultPlatform
|
|
_c.mutation.SetPlatform(v)
|
|
}
|
|
if _, ok := _c.mutation.RateMultiplier(); !ok {
|
|
v := paymentchannel.DefaultRateMultiplier
|
|
_c.mutation.SetRateMultiplier(v)
|
|
}
|
|
if _, ok := _c.mutation.Description(); !ok {
|
|
v := paymentchannel.DefaultDescription
|
|
_c.mutation.SetDescription(v)
|
|
}
|
|
if _, ok := _c.mutation.Models(); !ok {
|
|
v := paymentchannel.DefaultModels
|
|
_c.mutation.SetModels(v)
|
|
}
|
|
if _, ok := _c.mutation.Features(); !ok {
|
|
v := paymentchannel.DefaultFeatures
|
|
_c.mutation.SetFeatures(v)
|
|
}
|
|
if _, ok := _c.mutation.SortOrder(); !ok {
|
|
v := paymentchannel.DefaultSortOrder
|
|
_c.mutation.SetSortOrder(v)
|
|
}
|
|
if _, ok := _c.mutation.Enabled(); !ok {
|
|
v := paymentchannel.DefaultEnabled
|
|
_c.mutation.SetEnabled(v)
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := paymentchannel.DefaultCreatedAt()
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
v := paymentchannel.DefaultUpdatedAt()
|
|
_c.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *PaymentChannelCreate) check() error {
|
|
if _, ok := _c.mutation.Name(); !ok {
|
|
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "PaymentChannel.name"`)}
|
|
}
|
|
if v, ok := _c.mutation.Name(); ok {
|
|
if err := paymentchannel.NameValidator(v); err != nil {
|
|
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "PaymentChannel.name": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.Platform(); !ok {
|
|
return &ValidationError{Name: "platform", err: errors.New(`ent: missing required field "PaymentChannel.platform"`)}
|
|
}
|
|
if v, ok := _c.mutation.Platform(); ok {
|
|
if err := paymentchannel.PlatformValidator(v); err != nil {
|
|
return &ValidationError{Name: "platform", err: fmt.Errorf(`ent: validator failed for field "PaymentChannel.platform": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.RateMultiplier(); !ok {
|
|
return &ValidationError{Name: "rate_multiplier", err: errors.New(`ent: missing required field "PaymentChannel.rate_multiplier"`)}
|
|
}
|
|
if _, ok := _c.mutation.Description(); !ok {
|
|
return &ValidationError{Name: "description", err: errors.New(`ent: missing required field "PaymentChannel.description"`)}
|
|
}
|
|
if _, ok := _c.mutation.Models(); !ok {
|
|
return &ValidationError{Name: "models", err: errors.New(`ent: missing required field "PaymentChannel.models"`)}
|
|
}
|
|
if _, ok := _c.mutation.Features(); !ok {
|
|
return &ValidationError{Name: "features", err: errors.New(`ent: missing required field "PaymentChannel.features"`)}
|
|
}
|
|
if _, ok := _c.mutation.SortOrder(); !ok {
|
|
return &ValidationError{Name: "sort_order", err: errors.New(`ent: missing required field "PaymentChannel.sort_order"`)}
|
|
}
|
|
if _, ok := _c.mutation.Enabled(); !ok {
|
|
return &ValidationError{Name: "enabled", err: errors.New(`ent: missing required field "PaymentChannel.enabled"`)}
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "PaymentChannel.created_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "PaymentChannel.updated_at"`)}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *PaymentChannelCreate) sqlSave(ctx context.Context) (*PaymentChannel, 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 *PaymentChannelCreate) createSpec() (*PaymentChannel, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &PaymentChannel{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(paymentchannel.Table, sqlgraph.NewFieldSpec(paymentchannel.FieldID, field.TypeInt64))
|
|
)
|
|
_spec.OnConflict = _c.conflict
|
|
if value, ok := _c.mutation.GroupID(); ok {
|
|
_spec.SetField(paymentchannel.FieldGroupID, field.TypeInt64, value)
|
|
_node.GroupID = &value
|
|
}
|
|
if value, ok := _c.mutation.Name(); ok {
|
|
_spec.SetField(paymentchannel.FieldName, field.TypeString, value)
|
|
_node.Name = value
|
|
}
|
|
if value, ok := _c.mutation.Platform(); ok {
|
|
_spec.SetField(paymentchannel.FieldPlatform, field.TypeString, value)
|
|
_node.Platform = value
|
|
}
|
|
if value, ok := _c.mutation.RateMultiplier(); ok {
|
|
_spec.SetField(paymentchannel.FieldRateMultiplier, field.TypeFloat64, value)
|
|
_node.RateMultiplier = value
|
|
}
|
|
if value, ok := _c.mutation.Description(); ok {
|
|
_spec.SetField(paymentchannel.FieldDescription, field.TypeString, value)
|
|
_node.Description = value
|
|
}
|
|
if value, ok := _c.mutation.Models(); ok {
|
|
_spec.SetField(paymentchannel.FieldModels, field.TypeString, value)
|
|
_node.Models = value
|
|
}
|
|
if value, ok := _c.mutation.Features(); ok {
|
|
_spec.SetField(paymentchannel.FieldFeatures, field.TypeString, value)
|
|
_node.Features = value
|
|
}
|
|
if value, ok := _c.mutation.SortOrder(); ok {
|
|
_spec.SetField(paymentchannel.FieldSortOrder, field.TypeInt, value)
|
|
_node.SortOrder = value
|
|
}
|
|
if value, ok := _c.mutation.Enabled(); ok {
|
|
_spec.SetField(paymentchannel.FieldEnabled, field.TypeBool, value)
|
|
_node.Enabled = value
|
|
}
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(paymentchannel.FieldCreatedAt, field.TypeTime, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(paymentchannel.FieldUpdatedAt, field.TypeTime, value)
|
|
_node.UpdatedAt = value
|
|
}
|
|
return _node, _spec
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.PaymentChannel.Create().
|
|
// SetGroupID(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.PaymentChannelUpsert) {
|
|
// SetGroupID(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *PaymentChannelCreate) OnConflict(opts ...sql.ConflictOption) *PaymentChannelUpsertOne {
|
|
_c.conflict = opts
|
|
return &PaymentChannelUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.PaymentChannel.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *PaymentChannelCreate) OnConflictColumns(columns ...string) *PaymentChannelUpsertOne {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &PaymentChannelUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// PaymentChannelUpsertOne is the builder for "upsert"-ing
|
|
// one PaymentChannel node.
|
|
PaymentChannelUpsertOne struct {
|
|
create *PaymentChannelCreate
|
|
}
|
|
|
|
// PaymentChannelUpsert is the "OnConflict" setter.
|
|
PaymentChannelUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetGroupID sets the "group_id" field.
|
|
func (u *PaymentChannelUpsert) SetGroupID(v int64) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldGroupID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateGroupID sets the "group_id" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateGroupID() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldGroupID)
|
|
return u
|
|
}
|
|
|
|
// AddGroupID adds v to the "group_id" field.
|
|
func (u *PaymentChannelUpsert) AddGroupID(v int64) *PaymentChannelUpsert {
|
|
u.Add(paymentchannel.FieldGroupID, v)
|
|
return u
|
|
}
|
|
|
|
// ClearGroupID clears the value of the "group_id" field.
|
|
func (u *PaymentChannelUpsert) ClearGroupID() *PaymentChannelUpsert {
|
|
u.SetNull(paymentchannel.FieldGroupID)
|
|
return u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *PaymentChannelUpsert) SetName(v string) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldName, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateName() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldName)
|
|
return u
|
|
}
|
|
|
|
// SetPlatform sets the "platform" field.
|
|
func (u *PaymentChannelUpsert) SetPlatform(v string) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldPlatform, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePlatform sets the "platform" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdatePlatform() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldPlatform)
|
|
return u
|
|
}
|
|
|
|
// SetRateMultiplier sets the "rate_multiplier" field.
|
|
func (u *PaymentChannelUpsert) SetRateMultiplier(v float64) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldRateMultiplier, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateRateMultiplier() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldRateMultiplier)
|
|
return u
|
|
}
|
|
|
|
// AddRateMultiplier adds v to the "rate_multiplier" field.
|
|
func (u *PaymentChannelUpsert) AddRateMultiplier(v float64) *PaymentChannelUpsert {
|
|
u.Add(paymentchannel.FieldRateMultiplier, v)
|
|
return u
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *PaymentChannelUpsert) SetDescription(v string) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldDescription, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateDescription() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldDescription)
|
|
return u
|
|
}
|
|
|
|
// SetModels sets the "models" field.
|
|
func (u *PaymentChannelUpsert) SetModels(v string) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldModels, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateModels sets the "models" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateModels() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldModels)
|
|
return u
|
|
}
|
|
|
|
// SetFeatures sets the "features" field.
|
|
func (u *PaymentChannelUpsert) SetFeatures(v string) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldFeatures, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateFeatures sets the "features" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateFeatures() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldFeatures)
|
|
return u
|
|
}
|
|
|
|
// SetSortOrder sets the "sort_order" field.
|
|
func (u *PaymentChannelUpsert) SetSortOrder(v int) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldSortOrder, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSortOrder sets the "sort_order" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateSortOrder() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldSortOrder)
|
|
return u
|
|
}
|
|
|
|
// AddSortOrder adds v to the "sort_order" field.
|
|
func (u *PaymentChannelUpsert) AddSortOrder(v int) *PaymentChannelUpsert {
|
|
u.Add(paymentchannel.FieldSortOrder, v)
|
|
return u
|
|
}
|
|
|
|
// SetEnabled sets the "enabled" field.
|
|
func (u *PaymentChannelUpsert) SetEnabled(v bool) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldEnabled, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateEnabled() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.FieldEnabled)
|
|
return u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *PaymentChannelUpsert) SetUpdatedAt(v time.Time) *PaymentChannelUpsert {
|
|
u.Set(paymentchannel.FieldUpdatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsert) UpdateUpdatedAt() *PaymentChannelUpsert {
|
|
u.SetExcluded(paymentchannel.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.PaymentChannel.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *PaymentChannelUpsertOne) UpdateNewValues() *PaymentChannelUpsertOne {
|
|
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(paymentchannel.FieldCreatedAt)
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.PaymentChannel.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *PaymentChannelUpsertOne) Ignore() *PaymentChannelUpsertOne {
|
|
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 *PaymentChannelUpsertOne) DoNothing() *PaymentChannelUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the PaymentChannelCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *PaymentChannelUpsertOne) Update(set func(*PaymentChannelUpsert)) *PaymentChannelUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&PaymentChannelUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetGroupID sets the "group_id" field.
|
|
func (u *PaymentChannelUpsertOne) SetGroupID(v int64) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetGroupID(v)
|
|
})
|
|
}
|
|
|
|
// AddGroupID adds v to the "group_id" field.
|
|
func (u *PaymentChannelUpsertOne) AddGroupID(v int64) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.AddGroupID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateGroupID sets the "group_id" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateGroupID() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateGroupID()
|
|
})
|
|
}
|
|
|
|
// ClearGroupID clears the value of the "group_id" field.
|
|
func (u *PaymentChannelUpsertOne) ClearGroupID() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.ClearGroupID()
|
|
})
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *PaymentChannelUpsertOne) SetName(v string) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateName() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetPlatform sets the "platform" field.
|
|
func (u *PaymentChannelUpsertOne) SetPlatform(v string) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetPlatform(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePlatform sets the "platform" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdatePlatform() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdatePlatform()
|
|
})
|
|
}
|
|
|
|
// SetRateMultiplier sets the "rate_multiplier" field.
|
|
func (u *PaymentChannelUpsertOne) SetRateMultiplier(v float64) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetRateMultiplier(v)
|
|
})
|
|
}
|
|
|
|
// AddRateMultiplier adds v to the "rate_multiplier" field.
|
|
func (u *PaymentChannelUpsertOne) AddRateMultiplier(v float64) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.AddRateMultiplier(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateRateMultiplier() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateRateMultiplier()
|
|
})
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *PaymentChannelUpsertOne) SetDescription(v string) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetDescription(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateDescription() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateDescription()
|
|
})
|
|
}
|
|
|
|
// SetModels sets the "models" field.
|
|
func (u *PaymentChannelUpsertOne) SetModels(v string) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetModels(v)
|
|
})
|
|
}
|
|
|
|
// UpdateModels sets the "models" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateModels() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateModels()
|
|
})
|
|
}
|
|
|
|
// SetFeatures sets the "features" field.
|
|
func (u *PaymentChannelUpsertOne) SetFeatures(v string) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetFeatures(v)
|
|
})
|
|
}
|
|
|
|
// UpdateFeatures sets the "features" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateFeatures() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateFeatures()
|
|
})
|
|
}
|
|
|
|
// SetSortOrder sets the "sort_order" field.
|
|
func (u *PaymentChannelUpsertOne) SetSortOrder(v int) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetSortOrder(v)
|
|
})
|
|
}
|
|
|
|
// AddSortOrder adds v to the "sort_order" field.
|
|
func (u *PaymentChannelUpsertOne) AddSortOrder(v int) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.AddSortOrder(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSortOrder sets the "sort_order" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateSortOrder() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateSortOrder()
|
|
})
|
|
}
|
|
|
|
// SetEnabled sets the "enabled" field.
|
|
func (u *PaymentChannelUpsertOne) SetEnabled(v bool) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetEnabled(v)
|
|
})
|
|
}
|
|
|
|
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateEnabled() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateEnabled()
|
|
})
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *PaymentChannelUpsertOne) SetUpdatedAt(v time.Time) *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertOne) UpdateUpdatedAt() *PaymentChannelUpsertOne {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *PaymentChannelUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for PaymentChannelCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *PaymentChannelUpsertOne) 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 *PaymentChannelUpsertOne) 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 *PaymentChannelUpsertOne) IDX(ctx context.Context) int64 {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// PaymentChannelCreateBulk is the builder for creating many PaymentChannel entities in bulk.
|
|
type PaymentChannelCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*PaymentChannelCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the PaymentChannel entities in the database.
|
|
func (_c *PaymentChannelCreateBulk) Save(ctx context.Context) ([]*PaymentChannel, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*PaymentChannel, 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.(*PaymentChannelMutation)
|
|
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 *PaymentChannelCreateBulk) SaveX(ctx context.Context) []*PaymentChannel {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *PaymentChannelCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *PaymentChannelCreateBulk) 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.PaymentChannel.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.PaymentChannelUpsert) {
|
|
// SetGroupID(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *PaymentChannelCreateBulk) OnConflict(opts ...sql.ConflictOption) *PaymentChannelUpsertBulk {
|
|
_c.conflict = opts
|
|
return &PaymentChannelUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.PaymentChannel.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *PaymentChannelCreateBulk) OnConflictColumns(columns ...string) *PaymentChannelUpsertBulk {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &PaymentChannelUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// PaymentChannelUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of PaymentChannel nodes.
|
|
type PaymentChannelUpsertBulk struct {
|
|
create *PaymentChannelCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.PaymentChannel.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *PaymentChannelUpsertBulk) UpdateNewValues() *PaymentChannelUpsertBulk {
|
|
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(paymentchannel.FieldCreatedAt)
|
|
}
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.PaymentChannel.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *PaymentChannelUpsertBulk) Ignore() *PaymentChannelUpsertBulk {
|
|
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 *PaymentChannelUpsertBulk) DoNothing() *PaymentChannelUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the PaymentChannelCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *PaymentChannelUpsertBulk) Update(set func(*PaymentChannelUpsert)) *PaymentChannelUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&PaymentChannelUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetGroupID sets the "group_id" field.
|
|
func (u *PaymentChannelUpsertBulk) SetGroupID(v int64) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetGroupID(v)
|
|
})
|
|
}
|
|
|
|
// AddGroupID adds v to the "group_id" field.
|
|
func (u *PaymentChannelUpsertBulk) AddGroupID(v int64) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.AddGroupID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateGroupID sets the "group_id" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateGroupID() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateGroupID()
|
|
})
|
|
}
|
|
|
|
// ClearGroupID clears the value of the "group_id" field.
|
|
func (u *PaymentChannelUpsertBulk) ClearGroupID() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.ClearGroupID()
|
|
})
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *PaymentChannelUpsertBulk) SetName(v string) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateName() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetPlatform sets the "platform" field.
|
|
func (u *PaymentChannelUpsertBulk) SetPlatform(v string) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetPlatform(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePlatform sets the "platform" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdatePlatform() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdatePlatform()
|
|
})
|
|
}
|
|
|
|
// SetRateMultiplier sets the "rate_multiplier" field.
|
|
func (u *PaymentChannelUpsertBulk) SetRateMultiplier(v float64) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetRateMultiplier(v)
|
|
})
|
|
}
|
|
|
|
// AddRateMultiplier adds v to the "rate_multiplier" field.
|
|
func (u *PaymentChannelUpsertBulk) AddRateMultiplier(v float64) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.AddRateMultiplier(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRateMultiplier sets the "rate_multiplier" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateRateMultiplier() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateRateMultiplier()
|
|
})
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *PaymentChannelUpsertBulk) SetDescription(v string) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetDescription(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateDescription() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateDescription()
|
|
})
|
|
}
|
|
|
|
// SetModels sets the "models" field.
|
|
func (u *PaymentChannelUpsertBulk) SetModels(v string) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetModels(v)
|
|
})
|
|
}
|
|
|
|
// UpdateModels sets the "models" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateModels() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateModels()
|
|
})
|
|
}
|
|
|
|
// SetFeatures sets the "features" field.
|
|
func (u *PaymentChannelUpsertBulk) SetFeatures(v string) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetFeatures(v)
|
|
})
|
|
}
|
|
|
|
// UpdateFeatures sets the "features" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateFeatures() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateFeatures()
|
|
})
|
|
}
|
|
|
|
// SetSortOrder sets the "sort_order" field.
|
|
func (u *PaymentChannelUpsertBulk) SetSortOrder(v int) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetSortOrder(v)
|
|
})
|
|
}
|
|
|
|
// AddSortOrder adds v to the "sort_order" field.
|
|
func (u *PaymentChannelUpsertBulk) AddSortOrder(v int) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.AddSortOrder(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSortOrder sets the "sort_order" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateSortOrder() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateSortOrder()
|
|
})
|
|
}
|
|
|
|
// SetEnabled sets the "enabled" field.
|
|
func (u *PaymentChannelUpsertBulk) SetEnabled(v bool) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetEnabled(v)
|
|
})
|
|
}
|
|
|
|
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateEnabled() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateEnabled()
|
|
})
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *PaymentChannelUpsertBulk) SetUpdatedAt(v time.Time) *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *PaymentChannelUpsertBulk) UpdateUpdatedAt() *PaymentChannelUpsertBulk {
|
|
return u.Update(func(s *PaymentChannelUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *PaymentChannelUpsertBulk) 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 PaymentChannelCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for PaymentChannelCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *PaymentChannelUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|