MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / latestStrategyCommits

Method latestStrategyCommits

module/service-diff/iml.go:86–111  ·  view source on GitHub ↗
(ctx context.Context, serviceId string)

Source from the content-addressed store, hash-verified

84}
85
86func (m *imlServiceDiff) latestStrategyCommits(ctx context.Context, serviceId string) ([]*commit.Commit[strategy.Commit], error) {
87 list, err := m.strategyService.All(ctx, 2, serviceId)
88 if err != nil {
89 return nil, fmt.Errorf("get latest strategy failed:%w", err)
90 }
91
92 return utils.SliceToSlice(list, func(s *strategy.Strategy) *commit.Commit[strategy.Commit] {
93 key := fmt.Sprintf("service-%s", s.Id)
94 return &commit.Commit[strategy.Commit]{
95 Target: s.Id,
96 Key: key,
97 Data: &strategy.Commit{
98 Id: s.Id,
99 Name: s.Name,
100 Priority: s.Priority,
101 Filters: s.Filters,
102 Config: s.Config,
103 Driver: s.Driver,
104 IsStop: s.IsStop,
105 Version: s.UpdateAt.Format("20060102150405"),
106 },
107 }
108 }, func(s *strategy.Strategy) bool {
109 return !s.IsDelete
110 }), nil
111}
112
113func (m *imlServiceDiff) DiffForLatest(ctx context.Context, serviceId string, baseRelease string) (*service_diff.Diff, bool, error) {
114 serviceInfo, err := m.serviceService.Get(ctx, serviceId)

Callers 1

DiffForLatestMethod · 0.95

Calls 1

AllMethod · 0.65

Tested by

no test coverage detected