(ctx context.Context, id string, model *INPUT, appendLabels ...string)
| 29 | } |
| 30 | |
| 31 | func (p *imlServiceEdit[INPUT, E]) Save(ctx context.Context, id string, model *INPUT, appendLabels ...string) error { |
| 32 | operator := utils.UserId(ctx) |
| 33 | return p.store.Transaction(ctx, func(ctx context.Context) error { |
| 34 | ev, err := p.store.First(ctx, map[string]interface{}{ |
| 35 | "uuid": id, |
| 36 | }) |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | |
| 41 | auto.Auto("updater", operator, ev) |
| 42 | p.updateHandler(ev, model) |
| 43 | err = p.store.Save(ctx, ev) |
| 44 | if err != nil { |
| 45 | return err |
| 46 | } |
| 47 | labels := appendLabels |
| 48 | for _, hd := range p.labelHandler { |
| 49 | labels = append(labels, hd(ev)...) |
| 50 | } |
| 51 | |
| 52 | return p.store.SetLabels(ctx, idValue(ev), labels...) |
| 53 | |
| 54 | }) |
| 55 | } |
nothing calls this directly
no test coverage detected