(ctx context.Context, client admin_client.Client, profession string, labels map[string]string, t ...[]*T)
| 141 | return p.deleteByLabels(ctx, gateway.ProfessionService, map[string]string{"project": id}) |
| 142 | } |
| 143 | func 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 | } |
| 159 | func (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 | } |
no test coverage detected