(ctx context.Context)
| 421 | } |
| 422 | |
| 423 | func (sfuo *StorageFileUpdateOne) sqlSave(ctx context.Context) (_node *StorageFile, err error) { |
| 424 | if err := sfuo.check(); err != nil { |
| 425 | return _node, err |
| 426 | } |
| 427 | _spec := sqlgraph.NewUpdateSpec(storagefile.Table, storagefile.Columns, sqlgraph.NewFieldSpec(storagefile.FieldID, field.TypeUUID)) |
| 428 | id, ok := sfuo.mutation.ID() |
| 429 | if !ok { |
| 430 | return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "StorageFile.id" for update`)} |
| 431 | } |
| 432 | _spec.Node.ID.Value = id |
| 433 | if fields := sfuo.fields; len(fields) > 0 { |
| 434 | _spec.Node.Columns = make([]string, 0, len(fields)) |
| 435 | _spec.Node.Columns = append(_spec.Node.Columns, storagefile.FieldID) |
| 436 | for _, f := range fields { |
| 437 | if !storagefile.ValidColumn(f) { |
| 438 | return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} |
| 439 | } |
| 440 | if f != storagefile.FieldID { |
| 441 | _spec.Node.Columns = append(_spec.Node.Columns, f) |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | if ps := sfuo.mutation.predicates; len(ps) > 0 { |
| 446 | _spec.Predicate = func(selector *sql.Selector) { |
| 447 | for i := range ps { |
| 448 | ps[i](selector) |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | if value, ok := sfuo.mutation.UpdateTime(); ok { |
| 453 | _spec.SetField(storagefile.FieldUpdateTime, field.TypeTime, value) |
| 454 | } |
| 455 | if value, ok := sfuo.mutation.BucketName(); ok { |
| 456 | _spec.SetField(storagefile.FieldBucketName, field.TypeString, value) |
| 457 | } |
| 458 | if value, ok := sfuo.mutation.ObjectName(); ok { |
| 459 | _spec.SetField(storagefile.FieldObjectName, field.TypeString, value) |
| 460 | } |
| 461 | if sfuo.mutation.ObjectNameCleared() { |
| 462 | _spec.ClearField(storagefile.FieldObjectName, field.TypeString) |
| 463 | } |
| 464 | if value, ok := sfuo.mutation.FilePath(); ok { |
| 465 | _spec.SetField(storagefile.FieldFilePath, field.TypeString, value) |
| 466 | } |
| 467 | if value, ok := sfuo.mutation.FileType(); ok { |
| 468 | _spec.SetField(storagefile.FieldFileType, field.TypeString, value) |
| 469 | } |
| 470 | if value, ok := sfuo.mutation.FileURL(); ok { |
| 471 | _spec.SetField(storagefile.FieldFileURL, field.TypeString, value) |
| 472 | } |
| 473 | if sfuo.mutation.FileURLCleared() { |
| 474 | _spec.ClearField(storagefile.FieldFileURL, field.TypeString) |
| 475 | } |
| 476 | _spec.AddModifiers(sfuo.modifiers...) |
| 477 | _node = &StorageFile{config: sfuo.config} |
| 478 | _spec.Assign = _node.assignValues |
| 479 | _spec.ScanValues = _node.scanValues |
| 480 | if err = sqlgraph.UpdateNode(ctx, sfuo.driver, _spec); err != nil { |
nothing calls this directly
no test coverage detected