auto-deploy-service/pkg/set/set.go
Jay 9b680530d5
All checks were successful
continuous-integration/drone/push Build is passing
add cron setting
2021-07-02 17:00:18 +08:00

31 lines
411 B
Go

package set
type Set map[interface{}]struct{}
func NewSet() Set {
return make(map[interface{}]struct{})
}
func (s Set) Add(i interface{}) {
s[i] = struct{}{}
}
func (s Set) Has(i interface{}) bool {
_, ok := s[i]
return ok
}
func (s Set) Size() int {
return len(s)
}
func (s Set) Keys() []interface{} {
keys := make([]interface{}, 0)
for k := range s {
keys = append(keys, k)
}
return keys
}