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

Function matchLabels

gateway/apinto/project.go:143–158  ·  view source on GitHub ↗
(ctx context.Context, client admin_client.Client, profession string, labels map[string]string, t ...[]*T)

Source from the content-addressed store, hash-verified

141 return p.deleteByLabels(ctx, gateway.ProfessionService, map[string]string{"project": id})
142}
143func matchLabels[T any](ctx context.Context, client admin_client.Client, profession string, labels map[string]string, t ...[]*T) ([]*T, error) {
144 list, err := client.MatchLabels(ctx, profession, labels)
145 if err != nil {
146 return nil, err
147 }
148 var items = make([]*T, 0, len(list))
149 for _, item := range list {
150 var basicItem = new(T)
151 err = item.Scan(encoding.Json(basicItem))
152 if err != nil {
153 return nil, err
154 }
155 items = append(items, basicItem)
156 }
157 return items, nil
158}
159func (p *ProjectClient) matchLabels(ctx context.Context, profession string, labels map[string]string) ([]*entity.BasicInfo, error) {
160 return matchLabels[entity.BasicInfo](ctx, p.client, profession, labels)
161}

Callers 2

onlineMethod · 0.85
matchLabelsMethod · 0.85

Calls 1

ScanMethod · 0.45

Tested by

no test coverage detected