| 63 | } |
| 64 | |
| 65 | func (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 | |
| 87 | func (i *imlDocService) Save(ctx context.Context, input *SaveDoc) error { |
| 88 | info, err := i.store.First(ctx, map[string]interface{}{"sid": input.Sid}) |