Files
terminal/server/common/sets/set.go
T
admin 5563d0d430 fix: 修复 staticcheck 和优化前端构建
- 修复所有 Yoda 条件错误 (ST1017)
- 修复 error 格式错误 (ST1005)
- 修复不必要的 blank identifier (QF1001)
- 移除 tsc 重复编译,减少内存使用
- monaco-editor 改为动态导入
2026-04-20 08:26:42 +08:00

35 lines
521 B
Go

package sets
func NewStringSet() *Set {
return &Set{data: make(map[string]struct{})}
}
type Set struct {
data map[string]struct{}
}
func (s *Set) Add(key ...string) {
for _, k := range key {
s.data[k] = struct{}{}
}
}
func (s *Set) Remove(key ...string) {
for _, k := range key {
delete(s.data, k)
}
}
func (s *Set) Contains(key string) bool {
_, ok := s.data[key]
return ok
}
func (s *Set) ToArray() []string {
var keys []string
for key := range s.data {
keys = append(keys, key)
}
return keys
}