22 lines
302 B
Go
22 lines
302 B
Go
package config_handler
|
|
|
|
type Set map[int]struct{}
|
|
|
|
func NewSet() Set {
|
|
return make(Set)
|
|
}
|
|
|
|
func (s *Set) Add(data ...int) {
|
|
for _, d := range data {
|
|
(*s)[d] = struct{}{}
|
|
}
|
|
}
|
|
|
|
func (s Set) ToSlice() []int {
|
|
ret := make([]int, 0, len(s))
|
|
for k := range s {
|
|
ret = append(ret, k)
|
|
}
|
|
return ret
|
|
}
|