Documentation ¶
Overview ¶
Package sets 多种set.
包括 Int64s, Strings.
Index ¶
- Variables
- type Int64s
- func (set Int64s) Add(elems ...int64) Int64s
- func (set Int64s) All(elems ...int64) bool
- func (set Int64s) Any(elems ...int64) bool
- func (set Int64s) Del(elems ...int64) Int64s
- func (set Int64s) Has(s int64) bool
- func (set Int64s) Join(sep string) string
- func (set Int64s) Slice() []int64
- func (set Int64s) String() string
- type Strings
- func (set Strings) Add(elems ...string) Strings
- func (set Strings) All(elems ...string) bool
- func (set Strings) Any(elems ...string) bool
- func (set Strings) Del(elems ...string) Strings
- func (set Strings) Has(s string) bool
- func (set Strings) Join(sep string) string
- func (set Strings) Slice() []string
- func (set Strings) String() string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var None struct{} // nolint: gochecknoglobals
None 无值.
Functions ¶
This section is empty.
Types ¶
type Int64s ¶ added in v1.0.12
type Int64s map[int64]struct{}
Int64s int64 set.
Example ¶
package main import ( "fmt" "gitee.com/xuender/oils/sets" ) func main() { set := sets.NewInt64s(1, 2, 2) set.Add(3) fmt.Println(len(set)) fmt.Println(set.Any(7, 2)) fmt.Println(set.All(7, 2)) fmt.Println(set.Has(3)) set.Del(1) fmt.Println(len(set)) fmt.Println(set) }
Output: 3 true false true 2 2, 3
type Strings ¶
type Strings map[string]struct{}
Strings 字符串set.
Example ¶
package main import ( "fmt" "gitee.com/xuender/oils/sets" ) func main() { set := sets.NewStrings("1", "2", "2") set.Add("3") fmt.Println(len(set)) fmt.Println(set.Any("7", "2")) fmt.Println(set.All("7", "2")) set.Del("1") fmt.Println(len(set)) }
Output: 3 true false 2
Click to show internal directories.
Click to hide internal directories.