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

Method Latest

service/dynamic-module/iml.go:96–117  ·  view source on GitHub ↗
(ctx context.Context, dmID string, clusters []string)

Source from the content-addressed store, hash-verified

94}
95
96func (i *imlDynamicModulePublishService) Latest(ctx context.Context, dmID string, clusters []string) (map[string]*DynamicModulePublish, error) {
97 result := make(map[string]*DynamicModulePublish)
98 for _, c := range clusters {
99 info, err := i.store.First(ctx, map[string]interface{}{"dynamic_module": dmID, "cluster": c}, "create_at desc")
100 if err != nil {
101 if errors.Is(err, gorm.ErrRecordNotFound) {
102 continue
103 }
104 return nil, err
105 }
106 result[c] = &DynamicModulePublish{
107 ID: info.UUID,
108 DynamicModule: info.DynamicModule,
109 Module: info.Module,
110 Cluster: info.Cluster,
111 Creator: info.Creator,
112 Version: info.Version,
113 CreateAt: info.CreateAt,
114 }
115 }
116 return result, nil
117}
118
119func (i *imlDynamicModulePublishService) labelHandler(e *dynamic_module.DynamicModulePublish) []string {
120 return []string{e.UUID}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected