| 703 | } |
| 704 | |
| 705 | func (s setCreateOrUpdateG[T]) Update(ctx context.Context) (rowsAffected int, err error) { |
| 706 | // Execute association operations |
| 707 | for _, assocOp := range s.assocOps { |
| 708 | if err := s.executeAssociationOperation(ctx, assocOp); err != nil { |
| 709 | return 0, err |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | // Execute assignment operations |
| 714 | if len(s.assigns) > 0 { |
| 715 | var r T |
| 716 | res := s.c.g.apply(ctx).Model(r).Clauses(clause.Set(s.assigns)).Updates(map[string]interface{}{}) |
| 717 | return int(res.RowsAffected), res.Error |
| 718 | } |
| 719 | |
| 720 | return 0, nil |
| 721 | } |
| 722 | |
| 723 | func (s setCreateOrUpdateG[T]) Create(ctx context.Context) error { |
| 724 | // Execute association operations |