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

Method Update

service/service-overview/iml.go:33–57  ·  view source on GitHub ↗
(ctx context.Context, serviceId string, update *Update)

Source from the content-addressed store, hash-verified

31}
32
33func (i imlOverviewService) Update(ctx context.Context, serviceId string, update *Update) error {
34 if update == nil {
35 return nil
36 }
37
38 info, err := i.store.First(ctx, map[string]interface{}{
39 "service": serviceId,
40 })
41 if err != nil {
42 if !errors.Is(err, gorm.ErrRecordNotFound) {
43 return err
44 }
45 info = &service.Overview{
46 Service: serviceId,
47 }
48 genUpdateFields(info, update)
49 return i.store.Insert(ctx, info)
50 }
51 genUpdateFields(info, update)
52 _, err = i.store.Update(ctx, info)
53 if err != nil {
54 return err
55 }
56 return nil
57}
58
59func (i imlOverviewService) List(ctx context.Context, serviceIds ...string) ([]*Overview, error) {
60 w := make(map[string]interface{})

Callers

nothing calls this directly

Calls 2

genUpdateFieldsFunction · 0.85
UpdateMethod · 0.65

Tested by

no test coverage detected