(ctx context.Context)
| 665 | } |
| 666 | |
| 667 | func (_u *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error) { |
| 668 | _spec := sqlgraph.NewUpdateSpec(alert.Table, alert.Columns, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt)) |
| 669 | id, ok := _u.mutation.ID() |
| 670 | if !ok { |
| 671 | return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Alert.id" for update`)} |
| 672 | } |
| 673 | _spec.Node.ID.Value = id |
| 674 | if fields := _u.fields; len(fields) > 0 { |
| 675 | _spec.Node.Columns = make([]string, 0, len(fields)) |
| 676 | _spec.Node.Columns = append(_spec.Node.Columns, alert.FieldID) |
| 677 | for _, f := range fields { |
| 678 | if !alert.ValidColumn(f) { |
| 679 | return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} |
| 680 | } |
| 681 | if f != alert.FieldID { |
| 682 | _spec.Node.Columns = append(_spec.Node.Columns, f) |
| 683 | } |
| 684 | } |
| 685 | } |
| 686 | if ps := _u.mutation.predicates; len(ps) > 0 { |
| 687 | _spec.Predicate = func(selector *sql.Selector) { |
| 688 | for i := range ps { |
| 689 | ps[i](selector) |
| 690 | } |
| 691 | } |
| 692 | } |
| 693 | if value, ok := _u.mutation.UpdatedAt(); ok { |
| 694 | _spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value) |
| 695 | } |
| 696 | if _u.mutation.BucketIdCleared() { |
| 697 | _spec.ClearField(alert.FieldBucketId, field.TypeString) |
| 698 | } |
| 699 | if _u.mutation.MessageCleared() { |
| 700 | _spec.ClearField(alert.FieldMessage, field.TypeString) |
| 701 | } |
| 702 | if _u.mutation.EventsCountCleared() { |
| 703 | _spec.ClearField(alert.FieldEventsCount, field.TypeInt32) |
| 704 | } |
| 705 | if _u.mutation.StartedAtCleared() { |
| 706 | _spec.ClearField(alert.FieldStartedAt, field.TypeTime) |
| 707 | } |
| 708 | if _u.mutation.StoppedAtCleared() { |
| 709 | _spec.ClearField(alert.FieldStoppedAt, field.TypeTime) |
| 710 | } |
| 711 | if _u.mutation.SourceIpCleared() { |
| 712 | _spec.ClearField(alert.FieldSourceIp, field.TypeString) |
| 713 | } |
| 714 | if _u.mutation.SourceRangeCleared() { |
| 715 | _spec.ClearField(alert.FieldSourceRange, field.TypeString) |
| 716 | } |
| 717 | if _u.mutation.SourceAsNumberCleared() { |
| 718 | _spec.ClearField(alert.FieldSourceAsNumber, field.TypeString) |
| 719 | } |
| 720 | if _u.mutation.SourceAsNameCleared() { |
| 721 | _spec.ClearField(alert.FieldSourceAsName, field.TypeString) |
| 722 | } |
| 723 | if _u.mutation.SourceCountryCleared() { |
| 724 | _spec.ClearField(alert.FieldSourceCountry, field.TypeString) |
nothing calls this directly
no test coverage detected