...
1
2
3
4 package resource
5
6 import "sigs.k8s.io/kustomize/kyaml/resid"
7
8 type IdSet struct {
9 ids map[resid.ResId]bool
10 }
11
12 func MakeIdSet(slice []*Resource) *IdSet {
13 set := make(map[resid.ResId]bool)
14 for _, r := range slice {
15 id := r.CurId()
16 if _, ok := set[id]; !ok {
17 set[id] = true
18 }
19 }
20 return &IdSet{ids: set}
21 }
22
23 func (s IdSet) Contains(id resid.ResId) bool {
24 _, ok := s.ids[id]
25 return ok
26 }
27
28 func (s IdSet) Size() int {
29 return len(s.ids)
30 }
31
View as plain text