diff options
author | Guangxiong Lin <[email protected]> | 2023-01-24 20:27:22 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2023-01-24 20:27:22 +0800 |
commit | 104ee66f5930f4a37ac84538c29a291bf1d08f4f (patch) | |
tree | c663768184594207fd68533a773740d99956c865 /pkg/set.go | |
parent | 3f6aeea8c795b8bff59c1a8b45700d7bc44da4b9 (diff) | |
download | zk-104ee66f5930f4a37ac84538c29a291bf1d08f4f.tar.gz zk-104ee66f5930f4a37ac84538c29a291bf1d08f4f.tar.bz2 zk-104ee66f5930f4a37ac84538c29a291bf1d08f4f.zip |
Use cobra as command selector
Diffstat (limited to 'pkg/set.go')
-rw-r--r-- | pkg/set.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/set.go b/pkg/set.go new file mode 100644 index 0000000..634bb59 --- /dev/null +++ b/pkg/set.go @@ -0,0 +1,16 @@ +package pkg + +type Set[T comparable] map[T]bool + +func (s Set[T]) Contain(val T) bool { + _, ok := s[val] + return ok +} + +func (s Set[T]) Insert(val T) { + s[val] = true +} + +func (s Set[T]) Erase(val T) { + delete(s, val) +} |