| 1 |
// Code generated by ent, DO NOT EDIT. |
| 2 |
|
| 3 |
package ent |
| 4 |
|
| 5 |
import ( |
| 6 |
"context" |
| 7 |
"errors" |
| 8 |
"fmt" |
| 9 |
|
| 10 |
"entgo.io/ent/dialect/sql" |
| 11 |
"entgo.io/ent/dialect/sql/sqlgraph" |
| 12 |
"entgo.io/ent/schema/field" |
| 13 |
"github.com/google/uuid" |
| 14 |
"github.com/in-toto/archivista/ent/dsse" |
| 15 |
"github.com/in-toto/archivista/ent/predicate" |
| 16 |
"github.com/in-toto/archivista/ent/signature" |
| 17 |
"github.com/in-toto/archivista/ent/timestamp" |
| 18 |
) |
| 19 |
|
| 20 |
// SignatureUpdate is the builder for updating Signature entities. |
| 21 |
type SignatureUpdate struct { |
| 22 |
config |
| 23 |
hooks []Hook |
| 24 |
mutation *SignatureMutation |
| 25 |
} |
| 26 |
|
| 27 |
// Where appends a list predicates to the SignatureUpdate builder. |
| 28 |
func (_u *SignatureUpdate) Where(ps ...predicate.Signature) *SignatureUpdate { |
| 29 |
_u.mutation.Where(ps...) |
| 30 |
return _u |
| 31 |
} |
| 32 |
|
| 33 |
// SetKeyID sets the "key_id" field. |
| 34 |
func (_u *SignatureUpdate) SetKeyID(v string) *SignatureUpdate { |
| 35 |
_u.mutation.SetKeyID(v) |
| 36 |
return _u |
| 37 |
} |
| 38 |
|
| 39 |
// SetNillableKeyID sets the "key_id" field if the given value is not nil. |
| 40 |
func (_u *SignatureUpdate) SetNillableKeyID(v *string) *SignatureUpdate { |
| 41 |
if v != nil { |
| 42 |
_u.SetKeyID(*v) |
| 43 |
} |
| 44 |
return _u |
| 45 |
} |
| 46 |
|
| 47 |
// SetSignature sets the "signature" field. |
| 48 |
func (_u *SignatureUpdate) SetSignature(v string) *SignatureUpdate { |
| 49 |
_u.mutation.SetSignature(v) |
| 50 |
return _u |
| 51 |
} |
| 52 |
|
| 53 |
// SetNillableSignature sets the "signature" field if the given value is not nil. |
| 54 |
func (_u *SignatureUpdate) SetNillableSignature(v *string) *SignatureUpdate { |
| 55 |
if v != nil { |
| 56 |
_u.SetSignature(*v) |
| 57 |
} |
| 58 |
return _u |
| 59 |
} |
| 60 |
|
| 61 |
// SetDsseID sets the "dsse" edge to the Dsse entity by ID. |
| 62 |
func (_u *SignatureUpdate) SetDsseID(id uuid.UUID) *SignatureUpdate { |
| 63 |
_u.mutation.SetDsseID(id) |
| 64 |
return _u |
| 65 |
} |
| 66 |
|
| 67 |
// SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. |
| 68 |
func (_u *SignatureUpdate) SetNillableDsseID(id *uuid.UUID) *SignatureUpdate { |
| 69 |
if id != nil { |
| 70 |
_u = _u.SetDsseID(*id) |
| 71 |
} |
| 72 |
return _u |
| 73 |
} |
| 74 |
|
| 75 |
// SetDsse sets the "dsse" edge to the Dsse entity. |
| 76 |
func (_u *SignatureUpdate) SetDsse(v *Dsse) *SignatureUpdate { |
| 77 |
return _u.SetDsseID(v.ID) |
| 78 |
} |
| 79 |
|
| 80 |
// AddTimestampIDs adds the "timestamps" edge to the Timestamp entity by IDs. |
| 81 |
func (_u *SignatureUpdate) AddTimestampIDs(ids ...uuid.UUID) *SignatureUpdate { |
| 82 |
_u.mutation.AddTimestampIDs(ids...) |
| 83 |
return _u |
| 84 |
} |
| 85 |
|
| 86 |
// AddTimestamps adds the "timestamps" edges to the Timestamp entity. |
| 87 |
func (_u *SignatureUpdate) AddTimestamps(v ...*Timestamp) *SignatureUpdate { |
| 88 |
ids := make([]uuid.UUID, len(v)) |
| 89 |
for i := range v { |
| 90 |
ids[i] = v[i].ID |
| 91 |
} |
| 92 |
return _u.AddTimestampIDs(ids...) |
| 93 |
} |
| 94 |
|
| 95 |
// Mutation returns the SignatureMutation object of the builder. |
| 96 |
func (_u *SignatureUpdate) Mutation() *SignatureMutation { |
| 97 |
return _u.mutation |
| 98 |
} |
| 99 |
|
| 100 |
// ClearDsse clears the "dsse" edge to the Dsse entity. |
| 101 |
func (_u *SignatureUpdate) ClearDsse() *SignatureUpdate { |
| 102 |
_u.mutation.ClearDsse() |
| 103 |
return _u |
| 104 |
} |
| 105 |
|
| 106 |
// ClearTimestamps clears all "timestamps" edges to the Timestamp entity. |
| 107 |
func (_u *SignatureUpdate) ClearTimestamps() *SignatureUpdate { |
| 108 |
_u.mutation.ClearTimestamps() |
| 109 |
return _u |
| 110 |
} |
| 111 |
|
| 112 |
// RemoveTimestampIDs removes the "timestamps" edge to Timestamp entities by IDs. |
| 113 |
func (_u *SignatureUpdate) RemoveTimestampIDs(ids ...uuid.UUID) *SignatureUpdate { |
| 114 |
_u.mutation.RemoveTimestampIDs(ids...) |
| 115 |
return _u |
| 116 |
} |
| 117 |
|
| 118 |
// RemoveTimestamps removes "timestamps" edges to Timestamp entities. |
| 119 |
func (_u *SignatureUpdate) RemoveTimestamps(v ...*Timestamp) *SignatureUpdate { |
| 120 |
ids := make([]uuid.UUID, len(v)) |
| 121 |
for i := range v { |
| 122 |
ids[i] = v[i].ID |
| 123 |
} |
| 124 |
return _u.RemoveTimestampIDs(ids...) |
| 125 |
} |
| 126 |
|
| 127 |
// Save executes the query and returns the number of nodes affected by the update operation. |
| 128 |
func (_u *SignatureUpdate) Save(ctx context.Context) (int, error) { |
| 129 |
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) |
| 130 |
} |
| 131 |
|
| 132 |
// SaveX is like Save, but panics if an error occurs. |
| 133 |
func (_u *SignatureUpdate) SaveX(ctx context.Context) int { |
| 134 |
affected, err := _u.Save(ctx) |
| 135 |
if err != nil { |
| 136 |
panic(err) |
| 137 |
} |
| 138 |
return affected |
| 139 |
} |
| 140 |
|
| 141 |
// Exec executes the query. |
| 142 |
func (_u *SignatureUpdate) Exec(ctx context.Context) error { |
| 143 |
_, err := _u.Save(ctx) |
| 144 |
return err |
| 145 |
} |
| 146 |
|
| 147 |
// ExecX is like Exec, but panics if an error occurs. |
| 148 |
func (_u *SignatureUpdate) ExecX(ctx context.Context) { |
| 149 |
if err := _u.Exec(ctx); err != nil { |
| 150 |
panic(err) |
| 151 |
} |
| 152 |
} |
| 153 |
|
| 154 |
// check runs all checks and user-defined validators on the builder. |
| 155 |
func (_u *SignatureUpdate) check() error { |
| 156 |
if v, ok := _u.mutation.Signature(); ok { |
| 157 |
if err := signature.SignatureValidator(v); err != nil { |
| 158 |
return &ValidationError{Name: "signature", err: fmt.Errorf(`ent: validator failed for field "Signature.signature": %w`, err)} |
| 159 |
} |
| 160 |
} |
| 161 |
return nil |
| 162 |
} |
| 163 |
|
| 164 |
func (_u *SignatureUpdate) sqlSave(ctx context.Context) (_node int, err error) { |
| 165 |
if err := _u.check(); err != nil { |
| 166 |
return _node, err |
| 167 |
} |
| 168 |
_spec := sqlgraph.NewUpdateSpec(signature.Table, signature.Columns, sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID)) |
| 169 |
if ps := _u.mutation.predicates; len(ps) > 0 { |
| 170 |
_spec.Predicate = func(selector *sql.Selector) { |
| 171 |
for i := range ps { |
| 172 |
ps[i](selector) |
| 173 |
} |
| 174 |
} |
| 175 |
} |
| 176 |
if value, ok := _u.mutation.KeyID(); ok { |
| 177 |
_spec.SetField(signature.FieldKeyID, field.TypeString, value) |
| 178 |
} |
| 179 |
if value, ok := _u.mutation.Signature(); ok { |
| 180 |
_spec.SetField(signature.FieldSignature, field.TypeString, value) |
| 181 |
} |
| 182 |
if _u.mutation.DsseCleared() { |
| 183 |
edge := &sqlgraph.EdgeSpec{ |
| 184 |
Rel: sqlgraph.M2O, |
| 185 |
Inverse: true, |
| 186 |
Table: signature.DsseTable, |
| 187 |
Columns: []string{signature.DsseColumn}, |
| 188 |
Bidi: false, |
| 189 |
Target: &sqlgraph.EdgeTarget{ |
| 190 |
IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), |
| 191 |
}, |
| 192 |
} |
| 193 |
_spec.Edges.Clear = append(_spec.Edges.Clear, edge) |
| 194 |
} |
| 195 |
if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { |
| 196 |
edge := &sqlgraph.EdgeSpec{ |
| 197 |
Rel: sqlgraph.M2O, |
| 198 |
Inverse: true, |
| 199 |
Table: signature.DsseTable, |
| 200 |
Columns: []string{signature.DsseColumn}, |
| 201 |
Bidi: false, |
| 202 |
Target: &sqlgraph.EdgeTarget{ |
| 203 |
IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), |
| 204 |
}, |
| 205 |
} |
| 206 |
for _, k := range nodes { |
| 207 |
edge.Target.Nodes = append(edge.Target.Nodes, k) |
| 208 |
} |
| 209 |
_spec.Edges.Add = append(_spec.Edges.Add, edge) |
| 210 |
} |
| 211 |
if _u.mutation.TimestampsCleared() { |
| 212 |
edge := &sqlgraph.EdgeSpec{ |
| 213 |
Rel: sqlgraph.O2M, |
| 214 |
Inverse: false, |
| 215 |
Table: signature.TimestampsTable, |
| 216 |
Columns: []string{signature.TimestampsColumn}, |
| 217 |
Bidi: false, |
| 218 |
Target: &sqlgraph.EdgeTarget{ |
| 219 |
IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), |
| 220 |
}, |
| 221 |
} |
| 222 |
_spec.Edges.Clear = append(_spec.Edges.Clear, edge) |
| 223 |
} |
| 224 |
if nodes := _u.mutation.RemovedTimestampsIDs(); len(nodes) > 0 && !_u.mutation.TimestampsCleared() { |
| 225 |
edge := &sqlgraph.EdgeSpec{ |
| 226 |
Rel: sqlgraph.O2M, |
| 227 |
Inverse: false, |
| 228 |
Table: signature.TimestampsTable, |
| 229 |
Columns: []string{signature.TimestampsColumn}, |
| 230 |
Bidi: false, |
| 231 |
Target: &sqlgraph.EdgeTarget{ |
| 232 |
IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), |
| 233 |
}, |
| 234 |
} |
| 235 |
for _, k := range nodes { |
| 236 |
edge.Target.Nodes = append(edge.Target.Nodes, k) |
| 237 |
} |
| 238 |
_spec.Edges.Clear = append(_spec.Edges.Clear, edge) |
| 239 |
} |
| 240 |
if nodes := _u.mutation.TimestampsIDs(); len(nodes) > 0 { |
| 241 |
edge := &sqlgraph.EdgeSpec{ |
| 242 |
Rel: sqlgraph.O2M, |
| 243 |
Inverse: false, |
| 244 |
Table: signature.TimestampsTable, |
| 245 |
Columns: []string{signature.TimestampsColumn}, |
| 246 |
Bidi: false, |
| 247 |
Target: &sqlgraph.EdgeTarget{ |
| 248 |
IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), |
| 249 |
}, |
| 250 |
} |
| 251 |
for _, k := range nodes { |
| 252 |
edge.Target.Nodes = append(edge.Target.Nodes, k) |
| 253 |
} |
| 254 |
_spec.Edges.Add = append(_spec.Edges.Add, edge) |
| 255 |
} |
| 256 |
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { |
| 257 |
if _, ok := err.(*sqlgraph.NotFoundError); ok { |
| 258 |
err = &NotFoundError{signature.Label} |
| 259 |
} else if sqlgraph.IsConstraintError(err) { |
| 260 |
err = &ConstraintError{msg: err.Error(), wrap: err} |
| 261 |
} |
| 262 |
return 0, err |
| 263 |
} |
| 264 |
_u.mutation.done = true |
| 265 |
return _node, nil |
| 266 |
} |
| 267 |
|
| 268 |
// SignatureUpdateOne is the builder for updating a single Signature entity. |
| 269 |
type SignatureUpdateOne struct { |
| 270 |
config |
| 271 |
fields []string |
| 272 |
hooks []Hook |
| 273 |
mutation *SignatureMutation |
| 274 |
} |
| 275 |
|
| 276 |
// SetKeyID sets the "key_id" field. |
| 277 |
func (_u *SignatureUpdateOne) SetKeyID(v string) *SignatureUpdateOne { |
| 278 |
_u.mutation.SetKeyID(v) |
| 279 |
return _u |
| 280 |
} |
| 281 |
|
| 282 |
// SetNillableKeyID sets the "key_id" field if the given value is not nil. |
| 283 |
func (_u *SignatureUpdateOne) SetNillableKeyID(v *string) *SignatureUpdateOne { |
| 284 |
if v != nil { |
| 285 |
_u.SetKeyID(*v) |
| 286 |
} |
| 287 |
return _u |
| 288 |
} |
| 289 |
|
| 290 |
// SetSignature sets the "signature" field. |
| 291 |
func (_u *SignatureUpdateOne) SetSignature(v string) *SignatureUpdateOne { |
| 292 |
_u.mutation.SetSignature(v) |
| 293 |
return _u |
| 294 |
} |
| 295 |
|
| 296 |
// SetNillableSignature sets the "signature" field if the given value is not nil. |
| 297 |
func (_u *SignatureUpdateOne) SetNillableSignature(v *string) *SignatureUpdateOne { |
| 298 |
if v != nil { |
| 299 |
_u.SetSignature(*v) |
| 300 |
} |
| 301 |
return _u |
| 302 |
} |
| 303 |
|
| 304 |
// SetDsseID sets the "dsse" edge to the Dsse entity by ID. |
| 305 |
func (_u *SignatureUpdateOne) SetDsseID(id uuid.UUID) *SignatureUpdateOne { |
| 306 |
_u.mutation.SetDsseID(id) |
| 307 |
return _u |
| 308 |
} |
| 309 |
|
| 310 |
// SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. |
| 311 |
func (_u *SignatureUpdateOne) SetNillableDsseID(id *uuid.UUID) *SignatureUpdateOne { |
| 312 |
if id != nil { |
| 313 |
_u = _u.SetDsseID(*id) |
| 314 |
} |
| 315 |
return _u |
| 316 |
} |
| 317 |
|
| 318 |
// SetDsse sets the "dsse" edge to the Dsse entity. |
| 319 |
func (_u *SignatureUpdateOne) SetDsse(v *Dsse) *SignatureUpdateOne { |
| 320 |
return _u.SetDsseID(v.ID) |
| 321 |
} |
| 322 |
|
| 323 |
// AddTimestampIDs adds the "timestamps" edge to the Timestamp entity by IDs. |
| 324 |
func (_u *SignatureUpdateOne) AddTimestampIDs(ids ...uuid.UUID) *SignatureUpdateOne { |
| 325 |
_u.mutation.AddTimestampIDs(ids...) |
| 326 |
return _u |
| 327 |
} |
| 328 |
|
| 329 |
// AddTimestamps adds the "timestamps" edges to the Timestamp entity. |
| 330 |
func (_u *SignatureUpdateOne) AddTimestamps(v ...*Timestamp) *SignatureUpdateOne { |
| 331 |
ids := make([]uuid.UUID, len(v)) |
| 332 |
for i := range v { |
| 333 |
ids[i] = v[i].ID |
| 334 |
} |
| 335 |
return _u.AddTimestampIDs(ids...) |
| 336 |
} |
| 337 |
|
| 338 |
// Mutation returns the SignatureMutation object of the builder. |
| 339 |
func (_u *SignatureUpdateOne) Mutation() *SignatureMutation { |
| 340 |
return _u.mutation |
| 341 |
} |
| 342 |
|
| 343 |
// ClearDsse clears the "dsse" edge to the Dsse entity. |
| 344 |
func (_u *SignatureUpdateOne) ClearDsse() *SignatureUpdateOne { |
| 345 |
_u.mutation.ClearDsse() |
| 346 |
return _u |
| 347 |
} |
| 348 |
|
| 349 |
// ClearTimestamps clears all "timestamps" edges to the Timestamp entity. |
| 350 |
func (_u *SignatureUpdateOne) ClearTimestamps() *SignatureUpdateOne { |
| 351 |
_u.mutation.ClearTimestamps() |
| 352 |
return _u |
| 353 |
} |
| 354 |
|
| 355 |
// RemoveTimestampIDs removes the "timestamps" edge to Timestamp entities by IDs. |
| 356 |
func (_u *SignatureUpdateOne) RemoveTimestampIDs(ids ...uuid.UUID) *SignatureUpdateOne { |
| 357 |
_u.mutation.RemoveTimestampIDs(ids...) |
| 358 |
return _u |
| 359 |
} |
| 360 |
|
| 361 |
// RemoveTimestamps removes "timestamps" edges to Timestamp entities. |
| 362 |
func (_u *SignatureUpdateOne) RemoveTimestamps(v ...*Timestamp) *SignatureUpdateOne { |
| 363 |
ids := make([]uuid.UUID, len(v)) |
| 364 |
for i := range v { |
| 365 |
ids[i] = v[i].ID |
| 366 |
} |
| 367 |
return _u.RemoveTimestampIDs(ids...) |
| 368 |
} |
| 369 |
|
| 370 |
// Where appends a list predicates to the SignatureUpdate builder. |
| 371 |
func (_u *SignatureUpdateOne) Where(ps ...predicate.Signature) *SignatureUpdateOne { |
| 372 |
_u.mutation.Where(ps...) |
| 373 |
return _u |
| 374 |
} |
| 375 |
|
| 376 |
// Select allows selecting one or more fields (columns) of the returned entity. |
| 377 |
// The default is selecting all fields defined in the entity schema. |
| 378 |
func (_u *SignatureUpdateOne) Select(field string, fields ...string) *SignatureUpdateOne { |
| 379 |
_u.fields = append([]string{field}, fields...) |
| 380 |
return _u |
| 381 |
} |
| 382 |
|
| 383 |
// Save executes the query and returns the updated Signature entity. |
| 384 |
func (_u *SignatureUpdateOne) Save(ctx context.Context) (*Signature, error) { |
| 385 |
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) |
| 386 |
} |
| 387 |
|
| 388 |
// SaveX is like Save, but panics if an error occurs. |
| 389 |
func (_u *SignatureUpdateOne) SaveX(ctx context.Context) *Signature { |
| 390 |
node, err := _u.Save(ctx) |
| 391 |
if err != nil { |
| 392 |
panic(err) |
| 393 |
} |
| 394 |
return node |
| 395 |
} |
| 396 |
|
| 397 |
// Exec executes the query on the entity. |
| 398 |
func (_u *SignatureUpdateOne) Exec(ctx context.Context) error { |
| 399 |
_, err := _u.Save(ctx) |
| 400 |
return err |
| 401 |
} |
| 402 |
|
| 403 |
// ExecX is like Exec, but panics if an error occurs. |
| 404 |
func (_u *SignatureUpdateOne) ExecX(ctx context.Context) { |
| 405 |
if err := _u.Exec(ctx); err != nil { |
| 406 |
panic(err) |
| 407 |
} |
| 408 |
} |
| 409 |
|
| 410 |
// check runs all checks and user-defined validators on the builder. |
| 411 |
func (_u *SignatureUpdateOne) check() error { |
| 412 |
if v, ok := _u.mutation.Signature(); ok { |
| 413 |
if err := signature.SignatureValidator(v); err != nil { |
| 414 |
return &ValidationError{Name: "signature", err: fmt.Errorf(`ent: validator failed for field "Signature.signature": %w`, err)} |
| 415 |
} |
| 416 |
} |
| 417 |
return nil |
| 418 |
} |
| 419 |
|
| 420 |
func (_u *SignatureUpdateOne) sqlSave(ctx context.Context) (_node *Signature, err error) { |
| 421 |
if err := _u.check(); err != nil { |
| 422 |
return _node, err |
| 423 |
} |
| 424 |
_spec := sqlgraph.NewUpdateSpec(signature.Table, signature.Columns, sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID)) |
| 425 |
id, ok := _u.mutation.ID() |
| 426 |
if !ok { |
| 427 |
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Signature.id" for update`)} |
| 428 |
} |
| 429 |
_spec.Node.ID.Value = id |
| 430 |
if fields := _u.fields; len(fields) > 0 { |
| 431 |
_spec.Node.Columns = make([]string, 0, len(fields)) |
| 432 |
_spec.Node.Columns = append(_spec.Node.Columns, signature.FieldID) |
| 433 |
for _, f := range fields { |
| 434 |
if !signature.ValidColumn(f) { |
| 435 |
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} |
| 436 |
} |
| 437 |
if f != signature.FieldID { |
| 438 |
_spec.Node.Columns = append(_spec.Node.Columns, f) |
| 439 |
} |
| 440 |
} |
| 441 |
} |
| 442 |
if ps := _u.mutation.predicates; len(ps) > 0 { |
| 443 |
_spec.Predicate = func(selector *sql.Selector) { |
| 444 |
for i := range ps { |
| 445 |
ps[i](selector) |
| 446 |
} |
| 447 |
} |
| 448 |
} |
| 449 |
if value, ok := _u.mutation.KeyID(); ok { |
| 450 |
_spec.SetField(signature.FieldKeyID, field.TypeString, value) |
| 451 |
} |
| 452 |
if value, ok := _u.mutation.Signature(); ok { |
| 453 |
_spec.SetField(signature.FieldSignature, field.TypeString, value) |
| 454 |
} |
| 455 |
if _u.mutation.DsseCleared() { |
| 456 |
edge := &sqlgraph.EdgeSpec{ |
| 457 |
Rel: sqlgraph.M2O, |
| 458 |
Inverse: true, |
| 459 |
Table: signature.DsseTable, |
| 460 |
Columns: []string{signature.DsseColumn}, |
| 461 |
Bidi: false, |
| 462 |
Target: &sqlgraph.EdgeTarget{ |
| 463 |
IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), |
| 464 |
}, |
| 465 |
} |
| 466 |
_spec.Edges.Clear = append(_spec.Edges.Clear, edge) |
| 467 |
} |
| 468 |
if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { |
| 469 |
edge := &sqlgraph.EdgeSpec{ |
| 470 |
Rel: sqlgraph.M2O, |
| 471 |
Inverse: true, |
| 472 |
Table: signature.DsseTable, |
| 473 |
Columns: []string{signature.DsseColumn}, |
| 474 |
Bidi: false, |
| 475 |
Target: &sqlgraph.EdgeTarget{ |
| 476 |
IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), |
| 477 |
}, |
| 478 |
} |
| 479 |
for _, k := range nodes { |
| 480 |
edge.Target.Nodes = append(edge.Target.Nodes, k) |
| 481 |
} |
| 482 |
_spec.Edges.Add = append(_spec.Edges.Add, edge) |
| 483 |
} |
| 484 |
if _u.mutation.TimestampsCleared() { |
| 485 |
edge := &sqlgraph.EdgeSpec{ |
| 486 |
Rel: sqlgraph.O2M, |
| 487 |
Inverse: false, |
| 488 |
Table: signature.TimestampsTable, |
| 489 |
Columns: []string{signature.TimestampsColumn}, |
| 490 |
Bidi: false, |
| 491 |
Target: &sqlgraph.EdgeTarget{ |
| 492 |
IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), |
| 493 |
}, |
| 494 |
} |
| 495 |
_spec.Edges.Clear = append(_spec.Edges.Clear, edge) |
| 496 |
} |
| 497 |
if nodes := _u.mutation.RemovedTimestampsIDs(); len(nodes) > 0 && !_u.mutation.TimestampsCleared() { |
| 498 |
edge := &sqlgraph.EdgeSpec{ |
| 499 |
Rel: sqlgraph.O2M, |
| 500 |
Inverse: false, |
| 501 |
Table: signature.TimestampsTable, |
| 502 |
Columns: []string{signature.TimestampsColumn}, |
| 503 |
Bidi: false, |
| 504 |
Target: &sqlgraph.EdgeTarget{ |
| 505 |
IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), |
| 506 |
}, |
| 507 |
} |
| 508 |
for _, k := range nodes { |
| 509 |
edge.Target.Nodes = append(edge.Target.Nodes, k) |
| 510 |
} |
| 511 |
_spec.Edges.Clear = append(_spec.Edges.Clear, edge) |
| 512 |
} |
| 513 |
if nodes := _u.mutation.TimestampsIDs(); len(nodes) > 0 { |
| 514 |
edge := &sqlgraph.EdgeSpec{ |
| 515 |
Rel: sqlgraph.O2M, |
| 516 |
Inverse: false, |
| 517 |
Table: signature.TimestampsTable, |
| 518 |
Columns: []string{signature.TimestampsColumn}, |
| 519 |
Bidi: false, |
| 520 |
Target: &sqlgraph.EdgeTarget{ |
| 521 |
IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), |
| 522 |
}, |
| 523 |
} |
| 524 |
for _, k := range nodes { |
| 525 |
edge.Target.Nodes = append(edge.Target.Nodes, k) |
| 526 |
} |
| 527 |
_spec.Edges.Add = append(_spec.Edges.Add, edge) |
| 528 |
} |
| 529 |
_node = &Signature{config: _u.config} |
| 530 |
_spec.Assign = _node.assignValues |
| 531 |
_spec.ScanValues = _node.scanValues |
| 532 |
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { |
| 533 |
if _, ok := err.(*sqlgraph.NotFoundError); ok { |
| 534 |
err = &NotFoundError{signature.Label} |
| 535 |
} else if sqlgraph.IsConstraintError(err) { |
| 536 |
err = &ConstraintError{msg: err.Error(), wrap: err} |
| 537 |
} |
| 538 |
return nil, err |
| 539 |
} |
| 540 |
_u.mutation.done = true |
| 541 |
return _node, nil |
| 542 |
} |