zkt24/z2/backend/ent/transactions_update.go

730 lines
21 KiB
Go
Raw Permalink Normal View History

2024-04-25 11:51:47 +00:00
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"thesis/ent/blocks"
"thesis/ent/key"
"thesis/ent/predicate"
"thesis/ent/transactions"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// TransactionsUpdate is the builder for updating Transactions entities.
type TransactionsUpdate struct {
config
hooks []Hook
mutation *TransactionsMutation
}
// Where appends a list predicates to the TransactionsUpdate builder.
func (tu *TransactionsUpdate) Where(ps ...predicate.Transactions) *TransactionsUpdate {
tu.mutation.Where(ps...)
return tu
}
// SetType sets the "type" field.
func (tu *TransactionsUpdate) SetType(i int) *TransactionsUpdate {
tu.mutation.ResetType()
tu.mutation.SetType(i)
return tu
}
// SetNillableType sets the "type" field if the given value is not nil.
func (tu *TransactionsUpdate) SetNillableType(i *int) *TransactionsUpdate {
if i != nil {
tu.SetType(*i)
}
return tu
}
// AddType adds i to the "type" field.
func (tu *TransactionsUpdate) AddType(i int) *TransactionsUpdate {
tu.mutation.AddType(i)
return tu
}
// SetTimestamp sets the "timestamp" field.
func (tu *TransactionsUpdate) SetTimestamp(i int) *TransactionsUpdate {
tu.mutation.ResetTimestamp()
tu.mutation.SetTimestamp(i)
return tu
}
// SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
func (tu *TransactionsUpdate) SetNillableTimestamp(i *int) *TransactionsUpdate {
if i != nil {
tu.SetTimestamp(*i)
}
return tu
}
// AddTimestamp adds i to the "timestamp" field.
func (tu *TransactionsUpdate) AddTimestamp(i int) *TransactionsUpdate {
tu.mutation.AddTimestamp(i)
return tu
}
// SetComment sets the "comment" field.
func (tu *TransactionsUpdate) SetComment(s string) *TransactionsUpdate {
tu.mutation.SetComment(s)
return tu
}
// SetNillableComment sets the "comment" field if the given value is not nil.
func (tu *TransactionsUpdate) SetNillableComment(s *string) *TransactionsUpdate {
if s != nil {
tu.SetComment(*s)
}
return tu
}
// SetContent sets the "content" field.
func (tu *TransactionsUpdate) SetContent(b []byte) *TransactionsUpdate {
tu.mutation.SetContent(b)
return tu
}
// SetHash sets the "hash" field.
func (tu *TransactionsUpdate) SetHash(s string) *TransactionsUpdate {
tu.mutation.SetHash(s)
return tu
}
// SetNillableHash sets the "hash" field if the given value is not nil.
func (tu *TransactionsUpdate) SetNillableHash(s *string) *TransactionsUpdate {
if s != nil {
tu.SetHash(*s)
}
return tu
}
// SetSignature sets the "signature" field.
func (tu *TransactionsUpdate) SetSignature(s string) *TransactionsUpdate {
tu.mutation.SetSignature(s)
return tu
}
// SetNillableSignature sets the "signature" field if the given value is not nil.
func (tu *TransactionsUpdate) SetNillableSignature(s *string) *TransactionsUpdate {
if s != nil {
tu.SetSignature(*s)
}
return tu
}
// AddSignerIDs adds the "Signer" edge to the Key entity by IDs.
func (tu *TransactionsUpdate) AddSignerIDs(ids ...int) *TransactionsUpdate {
tu.mutation.AddSignerIDs(ids...)
return tu
}
// AddSigner adds the "Signer" edges to the Key entity.
func (tu *TransactionsUpdate) AddSigner(k ...*Key) *TransactionsUpdate {
ids := make([]int, len(k))
for i := range k {
ids[i] = k[i].ID
}
return tu.AddSignerIDs(ids...)
}
// AddBlockIDs adds the "Block" edge to the Blocks entity by IDs.
func (tu *TransactionsUpdate) AddBlockIDs(ids ...int) *TransactionsUpdate {
tu.mutation.AddBlockIDs(ids...)
return tu
}
// AddBlock adds the "Block" edges to the Blocks entity.
func (tu *TransactionsUpdate) AddBlock(b ...*Blocks) *TransactionsUpdate {
ids := make([]int, len(b))
for i := range b {
ids[i] = b[i].ID
}
return tu.AddBlockIDs(ids...)
}
// Mutation returns the TransactionsMutation object of the builder.
func (tu *TransactionsUpdate) Mutation() *TransactionsMutation {
return tu.mutation
}
// ClearSigner clears all "Signer" edges to the Key entity.
func (tu *TransactionsUpdate) ClearSigner() *TransactionsUpdate {
tu.mutation.ClearSigner()
return tu
}
// RemoveSignerIDs removes the "Signer" edge to Key entities by IDs.
func (tu *TransactionsUpdate) RemoveSignerIDs(ids ...int) *TransactionsUpdate {
tu.mutation.RemoveSignerIDs(ids...)
return tu
}
// RemoveSigner removes "Signer" edges to Key entities.
func (tu *TransactionsUpdate) RemoveSigner(k ...*Key) *TransactionsUpdate {
ids := make([]int, len(k))
for i := range k {
ids[i] = k[i].ID
}
return tu.RemoveSignerIDs(ids...)
}
// ClearBlock clears all "Block" edges to the Blocks entity.
func (tu *TransactionsUpdate) ClearBlock() *TransactionsUpdate {
tu.mutation.ClearBlock()
return tu
}
// RemoveBlockIDs removes the "Block" edge to Blocks entities by IDs.
func (tu *TransactionsUpdate) RemoveBlockIDs(ids ...int) *TransactionsUpdate {
tu.mutation.RemoveBlockIDs(ids...)
return tu
}
// RemoveBlock removes "Block" edges to Blocks entities.
func (tu *TransactionsUpdate) RemoveBlock(b ...*Blocks) *TransactionsUpdate {
ids := make([]int, len(b))
for i := range b {
ids[i] = b[i].ID
}
return tu.RemoveBlockIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (tu *TransactionsUpdate) Save(ctx context.Context) (int, error) {
return withHooks(ctx, tu.sqlSave, tu.mutation, tu.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (tu *TransactionsUpdate) SaveX(ctx context.Context) int {
affected, err := tu.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (tu *TransactionsUpdate) Exec(ctx context.Context) error {
_, err := tu.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (tu *TransactionsUpdate) ExecX(ctx context.Context) {
if err := tu.Exec(ctx); err != nil {
panic(err)
}
}
func (tu *TransactionsUpdate) sqlSave(ctx context.Context) (n int, err error) {
_spec := sqlgraph.NewUpdateSpec(transactions.Table, transactions.Columns, sqlgraph.NewFieldSpec(transactions.FieldID, field.TypeInt))
if ps := tu.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := tu.mutation.GetType(); ok {
_spec.SetField(transactions.FieldType, field.TypeInt, value)
}
if value, ok := tu.mutation.AddedType(); ok {
_spec.AddField(transactions.FieldType, field.TypeInt, value)
}
if value, ok := tu.mutation.Timestamp(); ok {
_spec.SetField(transactions.FieldTimestamp, field.TypeInt, value)
}
if value, ok := tu.mutation.AddedTimestamp(); ok {
_spec.AddField(transactions.FieldTimestamp, field.TypeInt, value)
}
if value, ok := tu.mutation.Comment(); ok {
_spec.SetField(transactions.FieldComment, field.TypeString, value)
}
if value, ok := tu.mutation.Content(); ok {
_spec.SetField(transactions.FieldContent, field.TypeBytes, value)
}
if value, ok := tu.mutation.Hash(); ok {
_spec.SetField(transactions.FieldHash, field.TypeString, value)
}
if value, ok := tu.mutation.Signature(); ok {
_spec.SetField(transactions.FieldSignature, field.TypeString, value)
}
if tu.mutation.SignerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.SignerTable,
Columns: transactions.SignerPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(key.FieldID, field.TypeInt),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tu.mutation.RemovedSignerIDs(); len(nodes) > 0 && !tu.mutation.SignerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.SignerTable,
Columns: transactions.SignerPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(key.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tu.mutation.SignerIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.SignerTable,
Columns: transactions.SignerPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(key.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if tu.mutation.BlockCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.BlockTable,
Columns: transactions.BlockPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(blocks.FieldID, field.TypeInt),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tu.mutation.RemovedBlockIDs(); len(nodes) > 0 && !tu.mutation.BlockCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.BlockTable,
Columns: transactions.BlockPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(blocks.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tu.mutation.BlockIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.BlockTable,
Columns: transactions.BlockPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(blocks.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if n, err = sqlgraph.UpdateNodes(ctx, tu.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{transactions.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
tu.mutation.done = true
return n, nil
}
// TransactionsUpdateOne is the builder for updating a single Transactions entity.
type TransactionsUpdateOne struct {
config
fields []string
hooks []Hook
mutation *TransactionsMutation
}
// SetType sets the "type" field.
func (tuo *TransactionsUpdateOne) SetType(i int) *TransactionsUpdateOne {
tuo.mutation.ResetType()
tuo.mutation.SetType(i)
return tuo
}
// SetNillableType sets the "type" field if the given value is not nil.
func (tuo *TransactionsUpdateOne) SetNillableType(i *int) *TransactionsUpdateOne {
if i != nil {
tuo.SetType(*i)
}
return tuo
}
// AddType adds i to the "type" field.
func (tuo *TransactionsUpdateOne) AddType(i int) *TransactionsUpdateOne {
tuo.mutation.AddType(i)
return tuo
}
// SetTimestamp sets the "timestamp" field.
func (tuo *TransactionsUpdateOne) SetTimestamp(i int) *TransactionsUpdateOne {
tuo.mutation.ResetTimestamp()
tuo.mutation.SetTimestamp(i)
return tuo
}
// SetNillableTimestamp sets the "timestamp" field if the given value is not nil.
func (tuo *TransactionsUpdateOne) SetNillableTimestamp(i *int) *TransactionsUpdateOne {
if i != nil {
tuo.SetTimestamp(*i)
}
return tuo
}
// AddTimestamp adds i to the "timestamp" field.
func (tuo *TransactionsUpdateOne) AddTimestamp(i int) *TransactionsUpdateOne {
tuo.mutation.AddTimestamp(i)
return tuo
}
// SetComment sets the "comment" field.
func (tuo *TransactionsUpdateOne) SetComment(s string) *TransactionsUpdateOne {
tuo.mutation.SetComment(s)
return tuo
}
// SetNillableComment sets the "comment" field if the given value is not nil.
func (tuo *TransactionsUpdateOne) SetNillableComment(s *string) *TransactionsUpdateOne {
if s != nil {
tuo.SetComment(*s)
}
return tuo
}
// SetContent sets the "content" field.
func (tuo *TransactionsUpdateOne) SetContent(b []byte) *TransactionsUpdateOne {
tuo.mutation.SetContent(b)
return tuo
}
// SetHash sets the "hash" field.
func (tuo *TransactionsUpdateOne) SetHash(s string) *TransactionsUpdateOne {
tuo.mutation.SetHash(s)
return tuo
}
// SetNillableHash sets the "hash" field if the given value is not nil.
func (tuo *TransactionsUpdateOne) SetNillableHash(s *string) *TransactionsUpdateOne {
if s != nil {
tuo.SetHash(*s)
}
return tuo
}
// SetSignature sets the "signature" field.
func (tuo *TransactionsUpdateOne) SetSignature(s string) *TransactionsUpdateOne {
tuo.mutation.SetSignature(s)
return tuo
}
// SetNillableSignature sets the "signature" field if the given value is not nil.
func (tuo *TransactionsUpdateOne) SetNillableSignature(s *string) *TransactionsUpdateOne {
if s != nil {
tuo.SetSignature(*s)
}
return tuo
}
// AddSignerIDs adds the "Signer" edge to the Key entity by IDs.
func (tuo *TransactionsUpdateOne) AddSignerIDs(ids ...int) *TransactionsUpdateOne {
tuo.mutation.AddSignerIDs(ids...)
return tuo
}
// AddSigner adds the "Signer" edges to the Key entity.
func (tuo *TransactionsUpdateOne) AddSigner(k ...*Key) *TransactionsUpdateOne {
ids := make([]int, len(k))
for i := range k {
ids[i] = k[i].ID
}
return tuo.AddSignerIDs(ids...)
}
// AddBlockIDs adds the "Block" edge to the Blocks entity by IDs.
func (tuo *TransactionsUpdateOne) AddBlockIDs(ids ...int) *TransactionsUpdateOne {
tuo.mutation.AddBlockIDs(ids...)
return tuo
}
// AddBlock adds the "Block" edges to the Blocks entity.
func (tuo *TransactionsUpdateOne) AddBlock(b ...*Blocks) *TransactionsUpdateOne {
ids := make([]int, len(b))
for i := range b {
ids[i] = b[i].ID
}
return tuo.AddBlockIDs(ids...)
}
// Mutation returns the TransactionsMutation object of the builder.
func (tuo *TransactionsUpdateOne) Mutation() *TransactionsMutation {
return tuo.mutation
}
// ClearSigner clears all "Signer" edges to the Key entity.
func (tuo *TransactionsUpdateOne) ClearSigner() *TransactionsUpdateOne {
tuo.mutation.ClearSigner()
return tuo
}
// RemoveSignerIDs removes the "Signer" edge to Key entities by IDs.
func (tuo *TransactionsUpdateOne) RemoveSignerIDs(ids ...int) *TransactionsUpdateOne {
tuo.mutation.RemoveSignerIDs(ids...)
return tuo
}
// RemoveSigner removes "Signer" edges to Key entities.
func (tuo *TransactionsUpdateOne) RemoveSigner(k ...*Key) *TransactionsUpdateOne {
ids := make([]int, len(k))
for i := range k {
ids[i] = k[i].ID
}
return tuo.RemoveSignerIDs(ids...)
}
// ClearBlock clears all "Block" edges to the Blocks entity.
func (tuo *TransactionsUpdateOne) ClearBlock() *TransactionsUpdateOne {
tuo.mutation.ClearBlock()
return tuo
}
// RemoveBlockIDs removes the "Block" edge to Blocks entities by IDs.
func (tuo *TransactionsUpdateOne) RemoveBlockIDs(ids ...int) *TransactionsUpdateOne {
tuo.mutation.RemoveBlockIDs(ids...)
return tuo
}
// RemoveBlock removes "Block" edges to Blocks entities.
func (tuo *TransactionsUpdateOne) RemoveBlock(b ...*Blocks) *TransactionsUpdateOne {
ids := make([]int, len(b))
for i := range b {
ids[i] = b[i].ID
}
return tuo.RemoveBlockIDs(ids...)
}
// Where appends a list predicates to the TransactionsUpdate builder.
func (tuo *TransactionsUpdateOne) Where(ps ...predicate.Transactions) *TransactionsUpdateOne {
tuo.mutation.Where(ps...)
return tuo
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (tuo *TransactionsUpdateOne) Select(field string, fields ...string) *TransactionsUpdateOne {
tuo.fields = append([]string{field}, fields...)
return tuo
}
// Save executes the query and returns the updated Transactions entity.
func (tuo *TransactionsUpdateOne) Save(ctx context.Context) (*Transactions, error) {
return withHooks(ctx, tuo.sqlSave, tuo.mutation, tuo.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (tuo *TransactionsUpdateOne) SaveX(ctx context.Context) *Transactions {
node, err := tuo.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (tuo *TransactionsUpdateOne) Exec(ctx context.Context) error {
_, err := tuo.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (tuo *TransactionsUpdateOne) ExecX(ctx context.Context) {
if err := tuo.Exec(ctx); err != nil {
panic(err)
}
}
func (tuo *TransactionsUpdateOne) sqlSave(ctx context.Context) (_node *Transactions, err error) {
_spec := sqlgraph.NewUpdateSpec(transactions.Table, transactions.Columns, sqlgraph.NewFieldSpec(transactions.FieldID, field.TypeInt))
id, ok := tuo.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Transactions.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := tuo.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, transactions.FieldID)
for _, f := range fields {
if !transactions.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != transactions.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := tuo.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := tuo.mutation.GetType(); ok {
_spec.SetField(transactions.FieldType, field.TypeInt, value)
}
if value, ok := tuo.mutation.AddedType(); ok {
_spec.AddField(transactions.FieldType, field.TypeInt, value)
}
if value, ok := tuo.mutation.Timestamp(); ok {
_spec.SetField(transactions.FieldTimestamp, field.TypeInt, value)
}
if value, ok := tuo.mutation.AddedTimestamp(); ok {
_spec.AddField(transactions.FieldTimestamp, field.TypeInt, value)
}
if value, ok := tuo.mutation.Comment(); ok {
_spec.SetField(transactions.FieldComment, field.TypeString, value)
}
if value, ok := tuo.mutation.Content(); ok {
_spec.SetField(transactions.FieldContent, field.TypeBytes, value)
}
if value, ok := tuo.mutation.Hash(); ok {
_spec.SetField(transactions.FieldHash, field.TypeString, value)
}
if value, ok := tuo.mutation.Signature(); ok {
_spec.SetField(transactions.FieldSignature, field.TypeString, value)
}
if tuo.mutation.SignerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.SignerTable,
Columns: transactions.SignerPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(key.FieldID, field.TypeInt),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tuo.mutation.RemovedSignerIDs(); len(nodes) > 0 && !tuo.mutation.SignerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.SignerTable,
Columns: transactions.SignerPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(key.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tuo.mutation.SignerIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.SignerTable,
Columns: transactions.SignerPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(key.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if tuo.mutation.BlockCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.BlockTable,
Columns: transactions.BlockPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(blocks.FieldID, field.TypeInt),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tuo.mutation.RemovedBlockIDs(); len(nodes) > 0 && !tuo.mutation.BlockCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.BlockTable,
Columns: transactions.BlockPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(blocks.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := tuo.mutation.BlockIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: transactions.BlockTable,
Columns: transactions.BlockPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(blocks.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_node = &Transactions{config: tuo.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, tuo.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{transactions.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
tuo.mutation.done = true
return _node, nil
}