| 32 | } |
| 33 | |
| 34 | func (p *imlServiceDelete[E]) Delete(ctx context.Context, uuid string) error { |
| 35 | return p.store.Transaction(ctx, func(ctx context.Context) error { |
| 36 | o, err := p.store.First(ctx, map[string]interface{}{"uuid": uuid}) |
| 37 | if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { |
| 38 | return err |
| 39 | } |
| 40 | if o == nil { |
| 41 | return fmt.Errorf("partition %s not exists", uuid) |
| 42 | } |
| 43 | |
| 44 | _, err = p.store.DeleteWhere(ctx, map[string]interface{}{"uuid": uuid}) |
| 45 | if err != nil { |
| 46 | return err |
| 47 | } |
| 48 | return p.store.SetLabels(ctx, idValue(o)) |
| 49 | }) |
| 50 | } |
| 51 | |
| 52 | type imlServiceSoftDelete[E any] struct { |
| 53 | store store.ISearchStore[E] |