gf: github.com/johng-cn/gf/g/container/gset Index | Files

package gset

import "github.com/johng-cn/gf/g/container/gset"

Package gset provides kinds of concurrent-safe(alternative) sets.

并发安全集合.

Index

Package Files

gset.go gset_int_set.go gset_interface_set.go gset_string_set.go

type IntSet Uses

type IntSet struct {
    // contains filtered or unexported fields
}

func NewIntSet Uses

func NewIntSet(unsafe ...bool) *IntSet

func (*IntSet) Add Uses

func (set *IntSet) Add(item int) *IntSet

设置键

func (*IntSet) BatchAdd Uses

func (set *IntSet) BatchAdd(items []int) *IntSet

批量添加设置键

func (*IntSet) Clear Uses

func (set *IntSet) Clear()

清空set

func (*IntSet) Contains Uses

func (set *IntSet) Contains(item int) bool

键是否存在

func (*IntSet) Iterator Uses

func (set *IntSet) Iterator(f func(v int) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*IntSet) LockFunc Uses

func (set *IntSet) LockFunc(f func(m map[int]struct{}))

func (*IntSet) RLockFunc Uses

func (set *IntSet) RLockFunc(f func(m map[int]struct{}))

func (*IntSet) Remove Uses

func (set *IntSet) Remove(key int)

删除键值对

func (*IntSet) Size Uses

func (set *IntSet) Size() int

大小

func (*IntSet) Slice Uses

func (set *IntSet) Slice() []int

转换为数组

func (*IntSet) String Uses

func (set *IntSet) String() string

转换为字符串

type InterfaceSet Uses

type InterfaceSet struct {
    // contains filtered or unexported fields
}

func NewInterfaceSet Uses

func NewInterfaceSet(unsafe ...bool) *InterfaceSet

func (*InterfaceSet) Add Uses

func (set *InterfaceSet) Add(item interface{}) *InterfaceSet

添加

func (*InterfaceSet) BatchAdd Uses

func (set *InterfaceSet) BatchAdd(items []interface{}) *InterfaceSet

批量添加

func (*InterfaceSet) Clear Uses

func (set *InterfaceSet) Clear()

清空set

func (*InterfaceSet) Contains Uses

func (set *InterfaceSet) Contains(item interface{}) bool

键是否存在

func (*InterfaceSet) Iterator Uses

func (set *InterfaceSet) Iterator(f func(v interface{}) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*InterfaceSet) LockFunc Uses

func (set *InterfaceSet) LockFunc(f func(m map[interface{}]struct{}))

func (*InterfaceSet) RLockFunc Uses

func (set *InterfaceSet) RLockFunc(f func(m map[interface{}]struct{}))

func (*InterfaceSet) Remove Uses

func (set *InterfaceSet) Remove(key interface{})

删除键值对

func (*InterfaceSet) Size Uses

func (set *InterfaceSet) Size() int

大小

func (*InterfaceSet) Slice Uses

func (set *InterfaceSet) Slice() []interface{}

转换为数组

func (*InterfaceSet) String Uses

func (set *InterfaceSet) String() string

转换为字符串

type Set Uses

type Set = InterfaceSet

func New Uses

func New(unsafe ...bool) *Set

默认Set类型

type StringSet Uses

type StringSet struct {
    // contains filtered or unexported fields
}

func NewStringSet Uses

func NewStringSet(unsafe ...bool) *StringSet

func (*StringSet) Add Uses

func (set *StringSet) Add(item string) *StringSet

设置键

func (*StringSet) BatchAdd Uses

func (set *StringSet) BatchAdd(items []string) *StringSet

批量添加设置键

func (*StringSet) Clear Uses

func (set *StringSet) Clear()

清空set

func (*StringSet) Contains Uses

func (set *StringSet) Contains(item string) bool

键是否存在

func (*StringSet) Iterator Uses

func (set *StringSet) Iterator(f func(v string) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*StringSet) LockFunc Uses

func (set *StringSet) LockFunc(f func(m map[string]struct{}))

func (*StringSet) RLockFunc Uses

func (set *StringSet) RLockFunc(f func(m map[string]struct{}))

func (*StringSet) Remove Uses

func (set *StringSet) Remove(key string)

删除键值对

func (*StringSet) Size Uses

func (set *StringSet) Size() int

大小

func (*StringSet) Slice Uses

func (set *StringSet) Slice() []string

转换为数组

func (*StringSet) String Uses

func (set *StringSet) String() string

转换为字符串

Package gset imports 2 packages (graph). Updated 2019-01-16. Refresh now. Tools for package owners.