(ctx context.Context)
| 629 | } |
| 630 | |
| 631 | func (_u *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err error) { |
| 632 | _spec := sqlgraph.NewUpdateSpec(bouncer.Table, bouncer.Columns, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt)) |
| 633 | id, ok := _u.mutation.ID() |
| 634 | if !ok { |
| 635 | return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Bouncer.id" for update`)} |
| 636 | } |
| 637 | _spec.Node.ID.Value = id |
| 638 | if fields := _u.fields; len(fields) > 0 { |
| 639 | _spec.Node.Columns = make([]string, 0, len(fields)) |
| 640 | _spec.Node.Columns = append(_spec.Node.Columns, bouncer.FieldID) |
| 641 | for _, f := range fields { |
| 642 | if !bouncer.ValidColumn(f) { |
| 643 | return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} |
| 644 | } |
| 645 | if f != bouncer.FieldID { |
| 646 | _spec.Node.Columns = append(_spec.Node.Columns, f) |
| 647 | } |
| 648 | } |
| 649 | } |
| 650 | if ps := _u.mutation.predicates; len(ps) > 0 { |
| 651 | _spec.Predicate = func(selector *sql.Selector) { |
| 652 | for i := range ps { |
| 653 | ps[i](selector) |
| 654 | } |
| 655 | } |
| 656 | } |
| 657 | if value, ok := _u.mutation.UpdatedAt(); ok { |
| 658 | _spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value) |
| 659 | } |
| 660 | if value, ok := _u.mutation.APIKey(); ok { |
| 661 | _spec.SetField(bouncer.FieldAPIKey, field.TypeString, value) |
| 662 | } |
| 663 | if value, ok := _u.mutation.Revoked(); ok { |
| 664 | _spec.SetField(bouncer.FieldRevoked, field.TypeBool, value) |
| 665 | } |
| 666 | if value, ok := _u.mutation.IPAddress(); ok { |
| 667 | _spec.SetField(bouncer.FieldIPAddress, field.TypeString, value) |
| 668 | } |
| 669 | if _u.mutation.IPAddressCleared() { |
| 670 | _spec.ClearField(bouncer.FieldIPAddress, field.TypeString) |
| 671 | } |
| 672 | if value, ok := _u.mutation.GetType(); ok { |
| 673 | _spec.SetField(bouncer.FieldType, field.TypeString, value) |
| 674 | } |
| 675 | if _u.mutation.TypeCleared() { |
| 676 | _spec.ClearField(bouncer.FieldType, field.TypeString) |
| 677 | } |
| 678 | if value, ok := _u.mutation.Version(); ok { |
| 679 | _spec.SetField(bouncer.FieldVersion, field.TypeString, value) |
| 680 | } |
| 681 | if _u.mutation.VersionCleared() { |
| 682 | _spec.ClearField(bouncer.FieldVersion, field.TypeString) |
| 683 | } |
| 684 | if value, ok := _u.mutation.LastPull(); ok { |
| 685 | _spec.SetField(bouncer.FieldLastPull, field.TypeTime, value) |
| 686 | } |
| 687 | if _u.mutation.LastPullCleared() { |
| 688 | _spec.ClearField(bouncer.FieldLastPull, field.TypeTime) |
nothing calls this directly
no test coverage detected