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) AddStrings(elems ...Strings) Strings
- func (set Strings) All(elems ...string) bool
- func (set Strings) AllStrings(elems ...Strings) bool
- func (set Strings) Any(elems ...string) bool
- func (set Strings) AnyStrings(elems ...Strings) bool
- func (set Strings) Del(elems ...string) Strings
- func (set Strings) DelStrings(elems ...Strings) 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
- type Uint32s
- func (set Uint32s) Add(elems ...uint32) Uint32s
- func (set Uint32s) AddUint32s(elems ...Uint32s) Uint32s
- func (set Uint32s) All(elems ...uint32) bool
- func (set Uint32s) Any(elems ...uint32) bool
- func (set Uint32s) Del(elems ...uint32) Uint32s
- func (set Uint32s) DelUint32s(elems ...Uint32s) Uint32s
- func (set Uint32s) Has(i uint32) bool
- func (set Uint32s) Join(sep string) string
- func (set Uint32s) Slice() []uint32
- func (set Uint32s) 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
func (Strings) AddStrings ¶ added in v1.0.31
AddStrings 增加字符串set.
func (Strings) AllStrings ¶ added in v1.0.33
AllStrings 全部包含.
func (Strings) AnyStrings ¶ added in v1.0.33
AnyStrings 包含任意.
func (Strings) DelStrings ¶ added in v1.0.31
DelStrings 删除字符串set.
type Uint32s ¶ added in v1.0.32
type Uint32s map[uint32]struct{}
Uint32s uint32 set.
Example ¶
package main import ( "fmt" "gitee.com/xuender/oils/sets" ) func main() { set := sets.NewUint32s(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
func (Uint32s) AddUint32s ¶ added in v1.0.32
AddUint32s 增加字符串set.
func (Uint32s) DelUint32s ¶ added in v1.0.32
DelUint32s 删除uint32 set.
Click to show internal directories.
Click to hide internal directories.