forked from External/ergo
move StringSet to utils package
This commit is contained in:
parent
ddac7d94a8
commit
df8be72c6f
9 changed files with 50 additions and 40 deletions
17
irc/utils/types.go
Normal file
17
irc/utils/types.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) 2020 Shivaram Lingamneni
|
||||
// released under the MIT license
|
||||
|
||||
package utils
|
||||
|
||||
type empty struct{}
|
||||
|
||||
type StringSet map[string]empty
|
||||
|
||||
func (s StringSet) Has(str string) bool {
|
||||
_, ok := s[str]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (s StringSet) Add(str string) {
|
||||
s[str] = empty{}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue