| 21 | } |
| 22 | |
| 23 | func (i *imlUpstreamService) List(ctx context.Context, serviceIds ...string) ([]*Upstream, error) { |
| 24 | w := make(map[string]interface{}) |
| 25 | if len(serviceIds) > 0 { |
| 26 | w["service"] = serviceIds |
| 27 | } |
| 28 | |
| 29 | upstreams, err := i.store.List(ctx, w) |
| 30 | if err != nil { |
| 31 | return nil, err |
| 32 | } |
| 33 | return utils.SliceToSlice(upstreams, func(u *upstream.Upstream) *Upstream { |
| 34 | return &Upstream{ |
| 35 | Item: &Item{ |
| 36 | UUID: u.UUID, |
| 37 | Service: u.Service, |
| 38 | Team: u.Team, |
| 39 | Remark: u.Remark, |
| 40 | Creator: u.Creator, |
| 41 | Updater: u.Updater, |
| 42 | CreateTime: u.CreateAt, |
| 43 | UpdateTime: u.UpdateAt, |
| 44 | }, |
| 45 | } |
| 46 | }), nil |
| 47 | } |
| 48 | |
| 49 | func (i *imlUpstreamService) ListCommit(ctx context.Context, uuid ...string) ([]*commit.Commit[Config], error) { |
| 50 | return i.commitService.List(ctx, uuid...) |