// Code generated by ent, DO NOT EDIT.

package ent

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

	"entgo.io/ent/dialect"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/google/uuid"
	"github.com/lightsparkdev/spark/common/keys"
	"github.com/lightsparkdev/spark/so/ent/depositaddress"
	"github.com/lightsparkdev/spark/so/ent/schema/schematype"
	"github.com/lightsparkdev/spark/so/ent/signingkeyshare"
	"github.com/lightsparkdev/spark/so/ent/tree"
	"github.com/lightsparkdev/spark/so/ent/utxo"
	"github.com/lightsparkdev/spark/so/ent/utxoswap"
)

// DepositAddressCreate is the builder for creating a DepositAddress entity.
type DepositAddressCreate struct {
	config
	mutation *DepositAddressMutation
	hooks    []Hook
	conflict []sql.ConflictOption
}

// SetCreateTime sets the "create_time" field.
func (dac *DepositAddressCreate) SetCreateTime(t time.Time) *DepositAddressCreate {
	dac.mutation.SetCreateTime(t)
	return dac
}

// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableCreateTime(t *time.Time) *DepositAddressCreate {
	if t != nil {
		dac.SetCreateTime(*t)
	}
	return dac
}

// SetUpdateTime sets the "update_time" field.
func (dac *DepositAddressCreate) SetUpdateTime(t time.Time) *DepositAddressCreate {
	dac.mutation.SetUpdateTime(t)
	return dac
}

// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableUpdateTime(t *time.Time) *DepositAddressCreate {
	if t != nil {
		dac.SetUpdateTime(*t)
	}
	return dac
}

// SetAddress sets the "address" field.
func (dac *DepositAddressCreate) SetAddress(s string) *DepositAddressCreate {
	dac.mutation.SetAddress(s)
	return dac
}

// SetNetwork sets the "network" field.
func (dac *DepositAddressCreate) SetNetwork(s schematype.Network) *DepositAddressCreate {
	dac.mutation.SetNetwork(s)
	return dac
}

// SetNillableNetwork sets the "network" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableNetwork(s *schematype.Network) *DepositAddressCreate {
	if s != nil {
		dac.SetNetwork(*s)
	}
	return dac
}

// SetOwnerIdentityPubkey sets the "owner_identity_pubkey" field.
func (dac *DepositAddressCreate) SetOwnerIdentityPubkey(k keys.Public) *DepositAddressCreate {
	dac.mutation.SetOwnerIdentityPubkey(k)
	return dac
}

// SetOwnerSigningPubkey sets the "owner_signing_pubkey" field.
func (dac *DepositAddressCreate) SetOwnerSigningPubkey(k keys.Public) *DepositAddressCreate {
	dac.mutation.SetOwnerSigningPubkey(k)
	return dac
}

// SetConfirmationHeight sets the "confirmation_height" field.
func (dac *DepositAddressCreate) SetConfirmationHeight(i int64) *DepositAddressCreate {
	dac.mutation.SetConfirmationHeight(i)
	return dac
}

// SetNillableConfirmationHeight sets the "confirmation_height" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableConfirmationHeight(i *int64) *DepositAddressCreate {
	if i != nil {
		dac.SetConfirmationHeight(*i)
	}
	return dac
}

// SetConfirmationTxid sets the "confirmation_txid" field.
func (dac *DepositAddressCreate) SetConfirmationTxid(s string) *DepositAddressCreate {
	dac.mutation.SetConfirmationTxid(s)
	return dac
}

// SetNillableConfirmationTxid sets the "confirmation_txid" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableConfirmationTxid(s *string) *DepositAddressCreate {
	if s != nil {
		dac.SetConfirmationTxid(*s)
	}
	return dac
}

// SetAddressSignatures sets the "address_signatures" field.
func (dac *DepositAddressCreate) SetAddressSignatures(m map[string][]uint8) *DepositAddressCreate {
	dac.mutation.SetAddressSignatures(m)
	return dac
}

// SetPossessionSignature sets the "possession_signature" field.
func (dac *DepositAddressCreate) SetPossessionSignature(b []byte) *DepositAddressCreate {
	dac.mutation.SetPossessionSignature(b)
	return dac
}

// SetNodeID sets the "node_id" field.
func (dac *DepositAddressCreate) SetNodeID(u uuid.UUID) *DepositAddressCreate {
	dac.mutation.SetNodeID(u)
	return dac
}

// SetNillableNodeID sets the "node_id" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableNodeID(u *uuid.UUID) *DepositAddressCreate {
	if u != nil {
		dac.SetNodeID(*u)
	}
	return dac
}

// SetIsStatic sets the "is_static" field.
func (dac *DepositAddressCreate) SetIsStatic(b bool) *DepositAddressCreate {
	dac.mutation.SetIsStatic(b)
	return dac
}

// SetNillableIsStatic sets the "is_static" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableIsStatic(b *bool) *DepositAddressCreate {
	if b != nil {
		dac.SetIsStatic(*b)
	}
	return dac
}

// SetIsDefault sets the "is_default" field.
func (dac *DepositAddressCreate) SetIsDefault(b bool) *DepositAddressCreate {
	dac.mutation.SetIsDefault(b)
	return dac
}

// SetNillableIsDefault sets the "is_default" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableIsDefault(b *bool) *DepositAddressCreate {
	if b != nil {
		dac.SetIsDefault(*b)
	}
	return dac
}

// SetID sets the "id" field.
func (dac *DepositAddressCreate) SetID(u uuid.UUID) *DepositAddressCreate {
	dac.mutation.SetID(u)
	return dac
}

// SetNillableID sets the "id" field if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableID(u *uuid.UUID) *DepositAddressCreate {
	if u != nil {
		dac.SetID(*u)
	}
	return dac
}

// SetSigningKeyshareID sets the "signing_keyshare" edge to the SigningKeyshare entity by ID.
func (dac *DepositAddressCreate) SetSigningKeyshareID(id uuid.UUID) *DepositAddressCreate {
	dac.mutation.SetSigningKeyshareID(id)
	return dac
}

// SetSigningKeyshare sets the "signing_keyshare" edge to the SigningKeyshare entity.
func (dac *DepositAddressCreate) SetSigningKeyshare(s *SigningKeyshare) *DepositAddressCreate {
	return dac.SetSigningKeyshareID(s.ID)
}

// AddUtxoIDs adds the "utxo" edge to the Utxo entity by IDs.
func (dac *DepositAddressCreate) AddUtxoIDs(ids ...uuid.UUID) *DepositAddressCreate {
	dac.mutation.AddUtxoIDs(ids...)
	return dac
}

// AddUtxo adds the "utxo" edges to the Utxo entity.
func (dac *DepositAddressCreate) AddUtxo(u ...*Utxo) *DepositAddressCreate {
	ids := make([]uuid.UUID, len(u))
	for i := range u {
		ids[i] = u[i].ID
	}
	return dac.AddUtxoIDs(ids...)
}

// AddUtxoswapIDs adds the "utxoswaps" edge to the UtxoSwap entity by IDs.
func (dac *DepositAddressCreate) AddUtxoswapIDs(ids ...uuid.UUID) *DepositAddressCreate {
	dac.mutation.AddUtxoswapIDs(ids...)
	return dac
}

// AddUtxoswaps adds the "utxoswaps" edges to the UtxoSwap entity.
func (dac *DepositAddressCreate) AddUtxoswaps(u ...*UtxoSwap) *DepositAddressCreate {
	ids := make([]uuid.UUID, len(u))
	for i := range u {
		ids[i] = u[i].ID
	}
	return dac.AddUtxoswapIDs(ids...)
}

// SetTreeID sets the "tree" edge to the Tree entity by ID.
func (dac *DepositAddressCreate) SetTreeID(id uuid.UUID) *DepositAddressCreate {
	dac.mutation.SetTreeID(id)
	return dac
}

// SetNillableTreeID sets the "tree" edge to the Tree entity by ID if the given value is not nil.
func (dac *DepositAddressCreate) SetNillableTreeID(id *uuid.UUID) *DepositAddressCreate {
	if id != nil {
		dac = dac.SetTreeID(*id)
	}
	return dac
}

// SetTree sets the "tree" edge to the Tree entity.
func (dac *DepositAddressCreate) SetTree(t *Tree) *DepositAddressCreate {
	return dac.SetTreeID(t.ID)
}

// Mutation returns the DepositAddressMutation object of the builder.
func (dac *DepositAddressCreate) Mutation() *DepositAddressMutation {
	return dac.mutation
}

// Save creates the DepositAddress in the database.
func (dac *DepositAddressCreate) Save(ctx context.Context) (*DepositAddress, error) {
	if err := dac.defaults(); err != nil {
		return nil, err
	}
	return withHooks(ctx, dac.sqlSave, dac.mutation, dac.hooks)
}

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

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

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

// defaults sets the default values of the builder before save.
func (dac *DepositAddressCreate) defaults() error {
	if _, ok := dac.mutation.CreateTime(); !ok {
		if depositaddress.DefaultCreateTime == nil {
			return fmt.Errorf("ent: uninitialized depositaddress.DefaultCreateTime (forgotten import ent/runtime?)")
		}
		v := depositaddress.DefaultCreateTime()
		dac.mutation.SetCreateTime(v)
	}
	if _, ok := dac.mutation.UpdateTime(); !ok {
		if depositaddress.DefaultUpdateTime == nil {
			return fmt.Errorf("ent: uninitialized depositaddress.DefaultUpdateTime (forgotten import ent/runtime?)")
		}
		v := depositaddress.DefaultUpdateTime()
		dac.mutation.SetUpdateTime(v)
	}
	if _, ok := dac.mutation.IsStatic(); !ok {
		v := depositaddress.DefaultIsStatic
		dac.mutation.SetIsStatic(v)
	}
	if _, ok := dac.mutation.IsDefault(); !ok {
		v := depositaddress.DefaultIsDefault
		dac.mutation.SetIsDefault(v)
	}
	if _, ok := dac.mutation.ID(); !ok {
		if depositaddress.DefaultID == nil {
			return fmt.Errorf("ent: uninitialized depositaddress.DefaultID (forgotten import ent/runtime?)")
		}
		v := depositaddress.DefaultID()
		dac.mutation.SetID(v)
	}
	return nil
}

// check runs all checks and user-defined validators on the builder.
func (dac *DepositAddressCreate) check() error {
	if _, ok := dac.mutation.CreateTime(); !ok {
		return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "DepositAddress.create_time"`)}
	}
	if _, ok := dac.mutation.UpdateTime(); !ok {
		return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "DepositAddress.update_time"`)}
	}
	if _, ok := dac.mutation.Address(); !ok {
		return &ValidationError{Name: "address", err: errors.New(`ent: missing required field "DepositAddress.address"`)}
	}
	if v, ok := dac.mutation.Address(); ok {
		if err := depositaddress.AddressValidator(v); err != nil {
			return &ValidationError{Name: "address", err: fmt.Errorf(`ent: validator failed for field "DepositAddress.address": %w`, err)}
		}
	}
	if v, ok := dac.mutation.Network(); ok {
		if err := depositaddress.NetworkValidator(v); err != nil {
			return &ValidationError{Name: "network", err: fmt.Errorf(`ent: validator failed for field "DepositAddress.network": %w`, err)}
		}
	}
	if _, ok := dac.mutation.OwnerIdentityPubkey(); !ok {
		return &ValidationError{Name: "owner_identity_pubkey", err: errors.New(`ent: missing required field "DepositAddress.owner_identity_pubkey"`)}
	}
	if _, ok := dac.mutation.OwnerSigningPubkey(); !ok {
		return &ValidationError{Name: "owner_signing_pubkey", err: errors.New(`ent: missing required field "DepositAddress.owner_signing_pubkey"`)}
	}
	if _, ok := dac.mutation.IsStatic(); !ok {
		return &ValidationError{Name: "is_static", err: errors.New(`ent: missing required field "DepositAddress.is_static"`)}
	}
	if _, ok := dac.mutation.IsDefault(); !ok {
		return &ValidationError{Name: "is_default", err: errors.New(`ent: missing required field "DepositAddress.is_default"`)}
	}
	if len(dac.mutation.SigningKeyshareIDs()) == 0 {
		return &ValidationError{Name: "signing_keyshare", err: errors.New(`ent: missing required edge "DepositAddress.signing_keyshare"`)}
	}
	return nil
}

func (dac *DepositAddressCreate) sqlSave(ctx context.Context) (*DepositAddress, error) {
	if err := dac.check(); err != nil {
		return nil, err
	}
	_node, _spec := dac.createSpec()
	if err := sqlgraph.CreateNode(ctx, dac.driver, _spec); err != nil {
		if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return nil, err
	}
	if _spec.ID.Value != nil {
		if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
			_node.ID = *id
		} else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
			return nil, err
		}
	}
	dac.mutation.id = &_node.ID
	dac.mutation.done = true
	return _node, nil
}

func (dac *DepositAddressCreate) createSpec() (*DepositAddress, *sqlgraph.CreateSpec) {
	var (
		_node = &DepositAddress{config: dac.config}
		_spec = sqlgraph.NewCreateSpec(depositaddress.Table, sqlgraph.NewFieldSpec(depositaddress.FieldID, field.TypeUUID))
	)
	_spec.OnConflict = dac.conflict
	if id, ok := dac.mutation.ID(); ok {
		_node.ID = id
		_spec.ID.Value = &id
	}
	if value, ok := dac.mutation.CreateTime(); ok {
		_spec.SetField(depositaddress.FieldCreateTime, field.TypeTime, value)
		_node.CreateTime = value
	}
	if value, ok := dac.mutation.UpdateTime(); ok {
		_spec.SetField(depositaddress.FieldUpdateTime, field.TypeTime, value)
		_node.UpdateTime = value
	}
	if value, ok := dac.mutation.Address(); ok {
		_spec.SetField(depositaddress.FieldAddress, field.TypeString, value)
		_node.Address = value
	}
	if value, ok := dac.mutation.Network(); ok {
		_spec.SetField(depositaddress.FieldNetwork, field.TypeEnum, value)
		_node.Network = value
	}
	if value, ok := dac.mutation.OwnerIdentityPubkey(); ok {
		_spec.SetField(depositaddress.FieldOwnerIdentityPubkey, field.TypeBytes, value)
		_node.OwnerIdentityPubkey = value
	}
	if value, ok := dac.mutation.OwnerSigningPubkey(); ok {
		_spec.SetField(depositaddress.FieldOwnerSigningPubkey, field.TypeBytes, value)
		_node.OwnerSigningPubkey = value
	}
	if value, ok := dac.mutation.ConfirmationHeight(); ok {
		_spec.SetField(depositaddress.FieldConfirmationHeight, field.TypeInt64, value)
		_node.ConfirmationHeight = value
	}
	if value, ok := dac.mutation.ConfirmationTxid(); ok {
		_spec.SetField(depositaddress.FieldConfirmationTxid, field.TypeString, value)
		_node.ConfirmationTxid = value
	}
	if value, ok := dac.mutation.AddressSignatures(); ok {
		_spec.SetField(depositaddress.FieldAddressSignatures, field.TypeJSON, value)
		_node.AddressSignatures = value
	}
	if value, ok := dac.mutation.PossessionSignature(); ok {
		_spec.SetField(depositaddress.FieldPossessionSignature, field.TypeBytes, value)
		_node.PossessionSignature = value
	}
	if value, ok := dac.mutation.NodeID(); ok {
		_spec.SetField(depositaddress.FieldNodeID, field.TypeUUID, value)
		_node.NodeID = value
	}
	if value, ok := dac.mutation.IsStatic(); ok {
		_spec.SetField(depositaddress.FieldIsStatic, field.TypeBool, value)
		_node.IsStatic = value
	}
	if value, ok := dac.mutation.IsDefault(); ok {
		_spec.SetField(depositaddress.FieldIsDefault, field.TypeBool, value)
		_node.IsDefault = value
	}
	if nodes := dac.mutation.SigningKeyshareIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: false,
			Table:   depositaddress.SigningKeyshareTable,
			Columns: []string{depositaddress.SigningKeyshareColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(signingkeyshare.FieldID, field.TypeUUID),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_node.deposit_address_signing_keyshare = &nodes[0]
		_spec.Edges = append(_spec.Edges, edge)
	}
	if nodes := dac.mutation.UtxoIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   depositaddress.UtxoTable,
			Columns: []string{depositaddress.UtxoColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(utxo.FieldID, field.TypeUUID),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges = append(_spec.Edges, edge)
	}
	if nodes := dac.mutation.UtxoswapsIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   depositaddress.UtxoswapsTable,
			Columns: []string{depositaddress.UtxoswapsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(utxoswap.FieldID, field.TypeUUID),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges = append(_spec.Edges, edge)
	}
	if nodes := dac.mutation.TreeIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   depositaddress.TreeTable,
			Columns: []string{depositaddress.TreeColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(tree.FieldID, field.TypeUUID),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_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.DepositAddress.Create().
//		SetCreateTime(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.DepositAddressUpsert) {
//			SetCreateTime(v+v).
//		}).
//		Exec(ctx)
func (dac *DepositAddressCreate) OnConflict(opts ...sql.ConflictOption) *DepositAddressUpsertOne {
	dac.conflict = opts
	return &DepositAddressUpsertOne{
		create: dac,
	}
}

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

type (
	// DepositAddressUpsertOne is the builder for "upsert"-ing
	//  one DepositAddress node.
	DepositAddressUpsertOne struct {
		create *DepositAddressCreate
	}

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

// SetUpdateTime sets the "update_time" field.
func (u *DepositAddressUpsert) SetUpdateTime(v time.Time) *DepositAddressUpsert {
	u.Set(depositaddress.FieldUpdateTime, v)
	return u
}

// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdateUpdateTime() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldUpdateTime)
	return u
}

// SetConfirmationHeight sets the "confirmation_height" field.
func (u *DepositAddressUpsert) SetConfirmationHeight(v int64) *DepositAddressUpsert {
	u.Set(depositaddress.FieldConfirmationHeight, v)
	return u
}

// UpdateConfirmationHeight sets the "confirmation_height" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdateConfirmationHeight() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldConfirmationHeight)
	return u
}

// AddConfirmationHeight adds v to the "confirmation_height" field.
func (u *DepositAddressUpsert) AddConfirmationHeight(v int64) *DepositAddressUpsert {
	u.Add(depositaddress.FieldConfirmationHeight, v)
	return u
}

// ClearConfirmationHeight clears the value of the "confirmation_height" field.
func (u *DepositAddressUpsert) ClearConfirmationHeight() *DepositAddressUpsert {
	u.SetNull(depositaddress.FieldConfirmationHeight)
	return u
}

// SetConfirmationTxid sets the "confirmation_txid" field.
func (u *DepositAddressUpsert) SetConfirmationTxid(v string) *DepositAddressUpsert {
	u.Set(depositaddress.FieldConfirmationTxid, v)
	return u
}

// UpdateConfirmationTxid sets the "confirmation_txid" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdateConfirmationTxid() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldConfirmationTxid)
	return u
}

// ClearConfirmationTxid clears the value of the "confirmation_txid" field.
func (u *DepositAddressUpsert) ClearConfirmationTxid() *DepositAddressUpsert {
	u.SetNull(depositaddress.FieldConfirmationTxid)
	return u
}

// SetAddressSignatures sets the "address_signatures" field.
func (u *DepositAddressUpsert) SetAddressSignatures(v map[string][]uint8) *DepositAddressUpsert {
	u.Set(depositaddress.FieldAddressSignatures, v)
	return u
}

// UpdateAddressSignatures sets the "address_signatures" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdateAddressSignatures() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldAddressSignatures)
	return u
}

// ClearAddressSignatures clears the value of the "address_signatures" field.
func (u *DepositAddressUpsert) ClearAddressSignatures() *DepositAddressUpsert {
	u.SetNull(depositaddress.FieldAddressSignatures)
	return u
}

// SetPossessionSignature sets the "possession_signature" field.
func (u *DepositAddressUpsert) SetPossessionSignature(v []byte) *DepositAddressUpsert {
	u.Set(depositaddress.FieldPossessionSignature, v)
	return u
}

// UpdatePossessionSignature sets the "possession_signature" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdatePossessionSignature() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldPossessionSignature)
	return u
}

// ClearPossessionSignature clears the value of the "possession_signature" field.
func (u *DepositAddressUpsert) ClearPossessionSignature() *DepositAddressUpsert {
	u.SetNull(depositaddress.FieldPossessionSignature)
	return u
}

// SetNodeID sets the "node_id" field.
func (u *DepositAddressUpsert) SetNodeID(v uuid.UUID) *DepositAddressUpsert {
	u.Set(depositaddress.FieldNodeID, v)
	return u
}

// UpdateNodeID sets the "node_id" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdateNodeID() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldNodeID)
	return u
}

// ClearNodeID clears the value of the "node_id" field.
func (u *DepositAddressUpsert) ClearNodeID() *DepositAddressUpsert {
	u.SetNull(depositaddress.FieldNodeID)
	return u
}

// SetIsStatic sets the "is_static" field.
func (u *DepositAddressUpsert) SetIsStatic(v bool) *DepositAddressUpsert {
	u.Set(depositaddress.FieldIsStatic, v)
	return u
}

// UpdateIsStatic sets the "is_static" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdateIsStatic() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldIsStatic)
	return u
}

// SetIsDefault sets the "is_default" field.
func (u *DepositAddressUpsert) SetIsDefault(v bool) *DepositAddressUpsert {
	u.Set(depositaddress.FieldIsDefault, v)
	return u
}

// UpdateIsDefault sets the "is_default" field to the value that was provided on create.
func (u *DepositAddressUpsert) UpdateIsDefault() *DepositAddressUpsert {
	u.SetExcluded(depositaddress.FieldIsDefault)
	return u
}

// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
// Using this option is equivalent to using:
//
//	client.DepositAddress.Create().
//		OnConflict(
//			sql.ResolveWithNewValues(),
//			sql.ResolveWith(func(u *sql.UpdateSet) {
//				u.SetIgnore(depositaddress.FieldID)
//			}),
//		).
//		Exec(ctx)
func (u *DepositAddressUpsertOne) UpdateNewValues() *DepositAddressUpsertOne {
	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.ID(); exists {
			s.SetIgnore(depositaddress.FieldID)
		}
		if _, exists := u.create.mutation.CreateTime(); exists {
			s.SetIgnore(depositaddress.FieldCreateTime)
		}
		if _, exists := u.create.mutation.Address(); exists {
			s.SetIgnore(depositaddress.FieldAddress)
		}
		if _, exists := u.create.mutation.Network(); exists {
			s.SetIgnore(depositaddress.FieldNetwork)
		}
		if _, exists := u.create.mutation.OwnerIdentityPubkey(); exists {
			s.SetIgnore(depositaddress.FieldOwnerIdentityPubkey)
		}
		if _, exists := u.create.mutation.OwnerSigningPubkey(); exists {
			s.SetIgnore(depositaddress.FieldOwnerSigningPubkey)
		}
	}))
	return u
}

// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
//	client.DepositAddress.Create().
//	    OnConflict(sql.ResolveWithIgnore()).
//	    Exec(ctx)
func (u *DepositAddressUpsertOne) Ignore() *DepositAddressUpsertOne {
	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 *DepositAddressUpsertOne) DoNothing() *DepositAddressUpsertOne {
	u.create.conflict = append(u.create.conflict, sql.DoNothing())
	return u
}

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

// SetUpdateTime sets the "update_time" field.
func (u *DepositAddressUpsertOne) SetUpdateTime(v time.Time) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetUpdateTime(v)
	})
}

// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdateUpdateTime() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateUpdateTime()
	})
}

// SetConfirmationHeight sets the "confirmation_height" field.
func (u *DepositAddressUpsertOne) SetConfirmationHeight(v int64) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetConfirmationHeight(v)
	})
}

// AddConfirmationHeight adds v to the "confirmation_height" field.
func (u *DepositAddressUpsertOne) AddConfirmationHeight(v int64) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.AddConfirmationHeight(v)
	})
}

// UpdateConfirmationHeight sets the "confirmation_height" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdateConfirmationHeight() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateConfirmationHeight()
	})
}

// ClearConfirmationHeight clears the value of the "confirmation_height" field.
func (u *DepositAddressUpsertOne) ClearConfirmationHeight() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearConfirmationHeight()
	})
}

// SetConfirmationTxid sets the "confirmation_txid" field.
func (u *DepositAddressUpsertOne) SetConfirmationTxid(v string) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetConfirmationTxid(v)
	})
}

// UpdateConfirmationTxid sets the "confirmation_txid" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdateConfirmationTxid() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateConfirmationTxid()
	})
}

// ClearConfirmationTxid clears the value of the "confirmation_txid" field.
func (u *DepositAddressUpsertOne) ClearConfirmationTxid() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearConfirmationTxid()
	})
}

// SetAddressSignatures sets the "address_signatures" field.
func (u *DepositAddressUpsertOne) SetAddressSignatures(v map[string][]uint8) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetAddressSignatures(v)
	})
}

// UpdateAddressSignatures sets the "address_signatures" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdateAddressSignatures() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateAddressSignatures()
	})
}

// ClearAddressSignatures clears the value of the "address_signatures" field.
func (u *DepositAddressUpsertOne) ClearAddressSignatures() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearAddressSignatures()
	})
}

// SetPossessionSignature sets the "possession_signature" field.
func (u *DepositAddressUpsertOne) SetPossessionSignature(v []byte) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetPossessionSignature(v)
	})
}

// UpdatePossessionSignature sets the "possession_signature" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdatePossessionSignature() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdatePossessionSignature()
	})
}

// ClearPossessionSignature clears the value of the "possession_signature" field.
func (u *DepositAddressUpsertOne) ClearPossessionSignature() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearPossessionSignature()
	})
}

// SetNodeID sets the "node_id" field.
func (u *DepositAddressUpsertOne) SetNodeID(v uuid.UUID) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetNodeID(v)
	})
}

// UpdateNodeID sets the "node_id" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdateNodeID() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateNodeID()
	})
}

// ClearNodeID clears the value of the "node_id" field.
func (u *DepositAddressUpsertOne) ClearNodeID() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearNodeID()
	})
}

// SetIsStatic sets the "is_static" field.
func (u *DepositAddressUpsertOne) SetIsStatic(v bool) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetIsStatic(v)
	})
}

// UpdateIsStatic sets the "is_static" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdateIsStatic() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateIsStatic()
	})
}

// SetIsDefault sets the "is_default" field.
func (u *DepositAddressUpsertOne) SetIsDefault(v bool) *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetIsDefault(v)
	})
}

// UpdateIsDefault sets the "is_default" field to the value that was provided on create.
func (u *DepositAddressUpsertOne) UpdateIsDefault() *DepositAddressUpsertOne {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateIsDefault()
	})
}

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

// ExecX is like Exec, but panics if an error occurs.
func (u *DepositAddressUpsertOne) 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 *DepositAddressUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error) {
	if u.create.driver.Dialect() == dialect.MySQL {
		// In case of "ON CONFLICT", there is no way to get back non-numeric ID
		// fields from the database since MySQL does not support the RETURNING clause.
		return id, errors.New("ent: DepositAddressUpsertOne.ID is not supported by MySQL driver. Use DepositAddressUpsertOne.Exec instead")
	}
	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 *DepositAddressUpsertOne) IDX(ctx context.Context) uuid.UUID {
	id, err := u.ID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}

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

// Save creates the DepositAddress entities in the database.
func (dacb *DepositAddressCreateBulk) Save(ctx context.Context) ([]*DepositAddress, error) {
	if dacb.err != nil {
		return nil, dacb.err
	}
	specs := make([]*sqlgraph.CreateSpec, len(dacb.builders))
	nodes := make([]*DepositAddress, len(dacb.builders))
	mutators := make([]Mutator, len(dacb.builders))
	for i := range dacb.builders {
		func(i int, root context.Context) {
			builder := dacb.builders[i]
			builder.defaults()
			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
				mutation, ok := m.(*DepositAddressMutation)
				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, dacb.builders[i+1].mutation)
				} else {
					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
					spec.OnConflict = dacb.conflict
					// Invoke the actual operation on the latest mutation in the chain.
					if err = sqlgraph.BatchCreate(ctx, dacb.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
				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, dacb.builders[0].mutation); err != nil {
			return nil, err
		}
	}
	return nodes, nil
}

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

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

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

// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
//	client.DepositAddress.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.DepositAddressUpsert) {
//			SetCreateTime(v+v).
//		}).
//		Exec(ctx)
func (dacb *DepositAddressCreateBulk) OnConflict(opts ...sql.ConflictOption) *DepositAddressUpsertBulk {
	dacb.conflict = opts
	return &DepositAddressUpsertBulk{
		create: dacb,
	}
}

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

// DepositAddressUpsertBulk is the builder for "upsert"-ing
// a bulk of DepositAddress nodes.
type DepositAddressUpsertBulk struct {
	create *DepositAddressCreateBulk
}

// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
//	client.DepositAddress.Create().
//		OnConflict(
//			sql.ResolveWithNewValues(),
//			sql.ResolveWith(func(u *sql.UpdateSet) {
//				u.SetIgnore(depositaddress.FieldID)
//			}),
//		).
//		Exec(ctx)
func (u *DepositAddressUpsertBulk) UpdateNewValues() *DepositAddressUpsertBulk {
	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.ID(); exists {
				s.SetIgnore(depositaddress.FieldID)
			}
			if _, exists := b.mutation.CreateTime(); exists {
				s.SetIgnore(depositaddress.FieldCreateTime)
			}
			if _, exists := b.mutation.Address(); exists {
				s.SetIgnore(depositaddress.FieldAddress)
			}
			if _, exists := b.mutation.Network(); exists {
				s.SetIgnore(depositaddress.FieldNetwork)
			}
			if _, exists := b.mutation.OwnerIdentityPubkey(); exists {
				s.SetIgnore(depositaddress.FieldOwnerIdentityPubkey)
			}
			if _, exists := b.mutation.OwnerSigningPubkey(); exists {
				s.SetIgnore(depositaddress.FieldOwnerSigningPubkey)
			}
		}
	}))
	return u
}

// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
//	client.DepositAddress.Create().
//		OnConflict(sql.ResolveWithIgnore()).
//		Exec(ctx)
func (u *DepositAddressUpsertBulk) Ignore() *DepositAddressUpsertBulk {
	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 *DepositAddressUpsertBulk) DoNothing() *DepositAddressUpsertBulk {
	u.create.conflict = append(u.create.conflict, sql.DoNothing())
	return u
}

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

// SetUpdateTime sets the "update_time" field.
func (u *DepositAddressUpsertBulk) SetUpdateTime(v time.Time) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetUpdateTime(v)
	})
}

// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdateUpdateTime() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateUpdateTime()
	})
}

// SetConfirmationHeight sets the "confirmation_height" field.
func (u *DepositAddressUpsertBulk) SetConfirmationHeight(v int64) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetConfirmationHeight(v)
	})
}

// AddConfirmationHeight adds v to the "confirmation_height" field.
func (u *DepositAddressUpsertBulk) AddConfirmationHeight(v int64) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.AddConfirmationHeight(v)
	})
}

// UpdateConfirmationHeight sets the "confirmation_height" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdateConfirmationHeight() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateConfirmationHeight()
	})
}

// ClearConfirmationHeight clears the value of the "confirmation_height" field.
func (u *DepositAddressUpsertBulk) ClearConfirmationHeight() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearConfirmationHeight()
	})
}

// SetConfirmationTxid sets the "confirmation_txid" field.
func (u *DepositAddressUpsertBulk) SetConfirmationTxid(v string) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetConfirmationTxid(v)
	})
}

// UpdateConfirmationTxid sets the "confirmation_txid" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdateConfirmationTxid() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateConfirmationTxid()
	})
}

// ClearConfirmationTxid clears the value of the "confirmation_txid" field.
func (u *DepositAddressUpsertBulk) ClearConfirmationTxid() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearConfirmationTxid()
	})
}

// SetAddressSignatures sets the "address_signatures" field.
func (u *DepositAddressUpsertBulk) SetAddressSignatures(v map[string][]uint8) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetAddressSignatures(v)
	})
}

// UpdateAddressSignatures sets the "address_signatures" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdateAddressSignatures() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateAddressSignatures()
	})
}

// ClearAddressSignatures clears the value of the "address_signatures" field.
func (u *DepositAddressUpsertBulk) ClearAddressSignatures() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearAddressSignatures()
	})
}

// SetPossessionSignature sets the "possession_signature" field.
func (u *DepositAddressUpsertBulk) SetPossessionSignature(v []byte) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetPossessionSignature(v)
	})
}

// UpdatePossessionSignature sets the "possession_signature" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdatePossessionSignature() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdatePossessionSignature()
	})
}

// ClearPossessionSignature clears the value of the "possession_signature" field.
func (u *DepositAddressUpsertBulk) ClearPossessionSignature() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearPossessionSignature()
	})
}

// SetNodeID sets the "node_id" field.
func (u *DepositAddressUpsertBulk) SetNodeID(v uuid.UUID) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetNodeID(v)
	})
}

// UpdateNodeID sets the "node_id" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdateNodeID() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateNodeID()
	})
}

// ClearNodeID clears the value of the "node_id" field.
func (u *DepositAddressUpsertBulk) ClearNodeID() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.ClearNodeID()
	})
}

// SetIsStatic sets the "is_static" field.
func (u *DepositAddressUpsertBulk) SetIsStatic(v bool) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetIsStatic(v)
	})
}

// UpdateIsStatic sets the "is_static" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdateIsStatic() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateIsStatic()
	})
}

// SetIsDefault sets the "is_default" field.
func (u *DepositAddressUpsertBulk) SetIsDefault(v bool) *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.SetIsDefault(v)
	})
}

// UpdateIsDefault sets the "is_default" field to the value that was provided on create.
func (u *DepositAddressUpsertBulk) UpdateIsDefault() *DepositAddressUpsertBulk {
	return u.Update(func(s *DepositAddressUpsert) {
		s.UpdateIsDefault()
	})
}

// Exec executes the query.
func (u *DepositAddressUpsertBulk) 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 DepositAddressCreateBulk instead", i)
		}
	}
	if len(u.create.conflict) == 0 {
		return errors.New("ent: missing options for DepositAddressCreateBulk.OnConflict")
	}
	return u.create.Exec(ctx)
}

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