MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / Save

Method Save

service/universally/edit.go:31–55  ·  view source on GitHub ↗
(ctx context.Context, id string, model *INPUT, appendLabels ...string)

Source from the content-addressed store, hash-verified

29}
30
31func (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}

Callers

nothing calls this directly

Calls 3

idValueFunction · 0.85
SaveMethod · 0.65
updateHandlerMethod · 0.45

Tested by

no test coverage detected