icechen de700cfdef
All checks were successful
continuous-integration/drone/push Build is passing
update
2021-12-28 20:42:51 +08:00

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
}