563 lines
16 KiB
Go
563 lines
16 KiB
Go
// Copyright 2019-present Facebook Inc. All rights reserved.
|
|
// This source code is licensed under the Apache 2.0 license found
|
|
// in the LICENSE file in the root directory of this source tree.
|
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/entc/integration/customid/ent/blob"
|
|
"entgo.io/ent/entc/integration/customid/ent/predicate"
|
|
"entgo.io/ent/schema/field"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// BlobUpdate is the builder for updating Blob entities.
|
|
type BlobUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *BlobMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the BlobUpdate builder.
|
|
func (_u *BlobUpdate) Where(ps ...predicate.Blob) *BlobUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetUUID sets the "uuid" field.
|
|
func (_u *BlobUpdate) SetUUID(v uuid.UUID) *BlobUpdate {
|
|
_u.mutation.SetUUID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUUID sets the "uuid" field if the given value is not nil.
|
|
func (_u *BlobUpdate) SetNillableUUID(v *uuid.UUID) *BlobUpdate {
|
|
if v != nil {
|
|
_u.SetUUID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetCount sets the "count" field.
|
|
func (_u *BlobUpdate) SetCount(v int) *BlobUpdate {
|
|
_u.mutation.ResetCount()
|
|
_u.mutation.SetCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCount sets the "count" field if the given value is not nil.
|
|
func (_u *BlobUpdate) SetNillableCount(v *int) *BlobUpdate {
|
|
if v != nil {
|
|
_u.SetCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCount adds value to the "count" field.
|
|
func (_u *BlobUpdate) AddCount(v int) *BlobUpdate {
|
|
_u.mutation.AddCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetParentID sets the "parent" edge to the Blob entity by ID.
|
|
func (_u *BlobUpdate) SetParentID(id uuid.UUID) *BlobUpdate {
|
|
_u.mutation.SetParentID(id)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableParentID sets the "parent" edge to the Blob entity by ID if the given value is not nil.
|
|
func (_u *BlobUpdate) SetNillableParentID(id *uuid.UUID) *BlobUpdate {
|
|
if id != nil {
|
|
_u = _u.SetParentID(*id)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetParent sets the "parent" edge to the Blob entity.
|
|
func (_u *BlobUpdate) SetParent(v *Blob) *BlobUpdate {
|
|
return _u.SetParentID(v.ID)
|
|
}
|
|
|
|
// AddLinkIDs adds the "links" edge to the Blob entity by IDs.
|
|
func (_u *BlobUpdate) AddLinkIDs(ids ...uuid.UUID) *BlobUpdate {
|
|
_u.mutation.AddLinkIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddLinks adds the "links" edges to the Blob entity.
|
|
func (_u *BlobUpdate) AddLinks(v ...*Blob) *BlobUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddLinkIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the BlobMutation object of the builder.
|
|
func (_u *BlobUpdate) Mutation() *BlobMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearParent clears the "parent" edge to the Blob entity.
|
|
func (_u *BlobUpdate) ClearParent() *BlobUpdate {
|
|
_u.mutation.ClearParent()
|
|
return _u
|
|
}
|
|
|
|
// ClearLinks clears all "links" edges to the Blob entity.
|
|
func (_u *BlobUpdate) ClearLinks() *BlobUpdate {
|
|
_u.mutation.ClearLinks()
|
|
return _u
|
|
}
|
|
|
|
// RemoveLinkIDs removes the "links" edge to Blob entities by IDs.
|
|
func (_u *BlobUpdate) RemoveLinkIDs(ids ...uuid.UUID) *BlobUpdate {
|
|
_u.mutation.RemoveLinkIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveLinks removes "links" edges to Blob entities.
|
|
func (_u *BlobUpdate) RemoveLinks(v ...*Blob) *BlobUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveLinkIDs(ids...)
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *BlobUpdate) Save(ctx context.Context) (int, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *BlobUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *BlobUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *BlobUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *BlobUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
_spec := sqlgraph.NewUpdateSpec(blob.Table, blob.Columns, sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID))
|
|
if ps := _u.mutation.Predicates(); len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.UUID(); ok {
|
|
_spec.SetField(blob.FieldUUID, field.TypeUUID, value)
|
|
}
|
|
if value, ok := _u.mutation.Count(); ok {
|
|
_spec.SetField(blob.FieldCount, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCount(); ok {
|
|
_spec.AddField(blob.FieldCount, field.TypeInt, value)
|
|
}
|
|
if _u.mutation.ParentCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2O,
|
|
Inverse: false,
|
|
Table: blob.ParentTable,
|
|
Columns: []string{blob.ParentColumn},
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2O,
|
|
Inverse: false,
|
|
Table: blob.ParentTable,
|
|
Columns: []string{blob.ParentColumn},
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.LinksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: blob.LinksTable,
|
|
Columns: blob.LinksPrimaryKey,
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
createE := &BlobLinkCreate{config: _u.config, mutation: newBlobLinkMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedLinksIDs(); len(nodes) > 0 && !_u.mutation.LinksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: blob.LinksTable,
|
|
Columns: blob.LinksPrimaryKey,
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &BlobLinkCreate{config: _u.config, mutation: newBlobLinkMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.LinksIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: blob.LinksTable,
|
|
Columns: blob.LinksPrimaryKey,
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &BlobLinkCreate{config: _u.config, mutation: newBlobLinkMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{blob.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// BlobUpdateOne is the builder for updating a single Blob entity.
|
|
type BlobUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *BlobMutation
|
|
}
|
|
|
|
// SetUUID sets the "uuid" field.
|
|
func (_u *BlobUpdateOne) SetUUID(v uuid.UUID) *BlobUpdateOne {
|
|
_u.mutation.SetUUID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUUID sets the "uuid" field if the given value is not nil.
|
|
func (_u *BlobUpdateOne) SetNillableUUID(v *uuid.UUID) *BlobUpdateOne {
|
|
if v != nil {
|
|
_u.SetUUID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetCount sets the "count" field.
|
|
func (_u *BlobUpdateOne) SetCount(v int) *BlobUpdateOne {
|
|
_u.mutation.ResetCount()
|
|
_u.mutation.SetCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCount sets the "count" field if the given value is not nil.
|
|
func (_u *BlobUpdateOne) SetNillableCount(v *int) *BlobUpdateOne {
|
|
if v != nil {
|
|
_u.SetCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCount adds value to the "count" field.
|
|
func (_u *BlobUpdateOne) AddCount(v int) *BlobUpdateOne {
|
|
_u.mutation.AddCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetParentID sets the "parent" edge to the Blob entity by ID.
|
|
func (_u *BlobUpdateOne) SetParentID(id uuid.UUID) *BlobUpdateOne {
|
|
_u.mutation.SetParentID(id)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableParentID sets the "parent" edge to the Blob entity by ID if the given value is not nil.
|
|
func (_u *BlobUpdateOne) SetNillableParentID(id *uuid.UUID) *BlobUpdateOne {
|
|
if id != nil {
|
|
_u = _u.SetParentID(*id)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetParent sets the "parent" edge to the Blob entity.
|
|
func (_u *BlobUpdateOne) SetParent(v *Blob) *BlobUpdateOne {
|
|
return _u.SetParentID(v.ID)
|
|
}
|
|
|
|
// AddLinkIDs adds the "links" edge to the Blob entity by IDs.
|
|
func (_u *BlobUpdateOne) AddLinkIDs(ids ...uuid.UUID) *BlobUpdateOne {
|
|
_u.mutation.AddLinkIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddLinks adds the "links" edges to the Blob entity.
|
|
func (_u *BlobUpdateOne) AddLinks(v ...*Blob) *BlobUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddLinkIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the BlobMutation object of the builder.
|
|
func (_u *BlobUpdateOne) Mutation() *BlobMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearParent clears the "parent" edge to the Blob entity.
|
|
func (_u *BlobUpdateOne) ClearParent() *BlobUpdateOne {
|
|
_u.mutation.ClearParent()
|
|
return _u
|
|
}
|
|
|
|
// ClearLinks clears all "links" edges to the Blob entity.
|
|
func (_u *BlobUpdateOne) ClearLinks() *BlobUpdateOne {
|
|
_u.mutation.ClearLinks()
|
|
return _u
|
|
}
|
|
|
|
// RemoveLinkIDs removes the "links" edge to Blob entities by IDs.
|
|
func (_u *BlobUpdateOne) RemoveLinkIDs(ids ...uuid.UUID) *BlobUpdateOne {
|
|
_u.mutation.RemoveLinkIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveLinks removes "links" edges to Blob entities.
|
|
func (_u *BlobUpdateOne) RemoveLinks(v ...*Blob) *BlobUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveLinkIDs(ids...)
|
|
}
|
|
|
|
// Where appends a list predicates to the BlobUpdate builder.
|
|
func (_u *BlobUpdateOne) Where(ps ...predicate.Blob) *BlobUpdateOne {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
// The default is selecting all fields defined in the entity schema.
|
|
func (_u *BlobUpdateOne) Select(field string, fields ...string) *BlobUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated Blob entity.
|
|
func (_u *BlobUpdateOne) Save(ctx context.Context) (*Blob, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *BlobUpdateOne) SaveX(ctx context.Context) *Blob {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *BlobUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *BlobUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *BlobUpdateOne) sqlSave(ctx context.Context) (_node *Blob, err error) {
|
|
_spec := sqlgraph.NewUpdateSpec(blob.Table, blob.Columns, sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Blob.id" for update`)}
|
|
}
|
|
_spec.Node.ID.Value = id
|
|
if fields := _u.fields; len(fields) > 0 {
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
_spec.Node.Columns = append(_spec.Node.Columns, blob.FieldID)
|
|
for _, f := range fields {
|
|
if !blob.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != blob.FieldID {
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
}
|
|
}
|
|
}
|
|
if ps := _u.mutation.Predicates(); len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.UUID(); ok {
|
|
_spec.SetField(blob.FieldUUID, field.TypeUUID, value)
|
|
}
|
|
if value, ok := _u.mutation.Count(); ok {
|
|
_spec.SetField(blob.FieldCount, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCount(); ok {
|
|
_spec.AddField(blob.FieldCount, field.TypeInt, value)
|
|
}
|
|
if _u.mutation.ParentCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2O,
|
|
Inverse: false,
|
|
Table: blob.ParentTable,
|
|
Columns: []string{blob.ParentColumn},
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2O,
|
|
Inverse: false,
|
|
Table: blob.ParentTable,
|
|
Columns: []string{blob.ParentColumn},
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.LinksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: blob.LinksTable,
|
|
Columns: blob.LinksPrimaryKey,
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
createE := &BlobLinkCreate{config: _u.config, mutation: newBlobLinkMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedLinksIDs(); len(nodes) > 0 && !_u.mutation.LinksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: blob.LinksTable,
|
|
Columns: blob.LinksPrimaryKey,
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &BlobLinkCreate{config: _u.config, mutation: newBlobLinkMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.LinksIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: blob.LinksTable,
|
|
Columns: blob.LinksPrimaryKey,
|
|
Bidi: true,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(blob.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &BlobLinkCreate{config: _u.config, mutation: newBlobLinkMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
_node = &Blob{config: _u.config}
|
|
_spec.Assign = _node.assignValues
|
|
_spec.ScanValues = _node.scanValues
|
|
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{blob.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|