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

Method Map

service/service-doc/iml.go:65–85  ·  view source on GitHub ↗
(ctx context.Context, sids ...string)

Source from the content-addressed store, hash-verified

63}
64
65func (i *imlDocService) Map(ctx context.Context, sids ...string) (map[string]*Doc, error) {
66 w := map[string]interface{}{}
67 if len(sids) > 0 {
68 w["sid"] = sids
69 }
70
71 list, err := i.store.List(ctx, w)
72 if err != nil {
73 return nil, err
74 }
75 return utils.SliceToMapO(list, func(d *service.Doc) (string, *Doc) {
76 return d.Sid, &Doc{
77 ID: d.Sid,
78 Creator: d.Creator,
79 Updater: d.Updater,
80 Doc: d.Doc,
81 UpdateTime: d.UpdateAt,
82 CreateTime: d.CreateAt,
83 }
84 }), nil
85}
86
87func (i *imlDocService) Save(ctx context.Context, input *SaveDoc) error {
88 info, err := i.store.First(ctx, map[string]interface{}{"sid": input.Sid})

Callers

nothing calls this directly

Calls 1

ListMethod · 0.65

Tested by

no test coverage detected