1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 07:19:41 +02:00

feat(home): filter by connection type and agent version [EE-3373] (#7085)

This commit is contained in:
Chaim Lev-Ari 2022-08-11 07:32:12 +03:00 committed by GitHub
parent 9666c21b8a
commit 5ee570e075
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 828 additions and 323 deletions

40
api/internal/set/set.go Normal file
View file

@ -0,0 +1,40 @@
package set
type SetKey interface {
~int | ~string
}
type Set[T SetKey] map[T]bool
func (s Set[T]) Add(key T) {
s[key] = true
}
func (s Set[T]) Contains(key T) bool {
_, ok := s[key]
return ok
}
func (s Set[T]) Remove(key T) {
delete(s, key)
}
func (s Set[T]) Len() int {
return len(s)
}
func (s Set[T]) IsEmpty() bool {
return len(s) == 0
}
func (s Set[T]) Keys() []T {
keys := make([]T, s.Len())
i := 0
for k := range s {
keys[i] = k
i++
}
return keys
}