Documentation ¶
Index ¶
- func Append[T Comparable](slice []T, values ...T) []T
- func GetTopDuration(tasks []Task) float32
- func GoSafe(fn func())
- func Guard(lock sync.Locker, fn func())
- func NewJob() *job
- func Recover(cleanups ...func())
- func RunSafe(fn func())
- type Barrier
- type Comparable
- type HookOption
- type JobFunc
- type MapSet
- func (this *MapSet) Add(key interface{}) bool
- func (this *MapSet) Clear()
- func (this *MapSet) Contains(key interface{}) bool
- func (this *MapSet) Difference(other Set) Set
- func (this *MapSet) Intersect(other Set) Set
- func (this *MapSet) KeysStr() []string
- func (this *MapSet) Remove(key interface{}) bool
- func (this *MapSet) Size() int
- func (this *MapSet) Union(other Set) Set
- func (this *MapSet) Values() []interface{}
- type Set
- type SetT
- type SingleFlight
- type Slice
- func (s *Slice[T]) Append(value T) []T
- func (s *Slice[T]) Clear()
- func (s *Slice[T]) IndexAdd(index int, value T) []T
- func (s *Slice[T]) IndexEdit(index int, value T) []T
- func (s *Slice[T]) IndexRemove(index int) []T
- func (s *Slice[T]) Prepend(value T) []T
- func (s *Slice[T]) QueryIndex(value T) int
- func (s *Slice[T]) QueryValue(index int) interface{}
- type Task
- type TaskHook
- type TopicInter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Comparable ¶
type HookOption ¶
func WithAfter ¶
func WithAfter(after TaskHook, params ...interface{}) HookOption
func WithCurrent ¶
func WithCurrent(current TaskHook, params ...interface{}) HookOption
func WithPrev ¶
func WithPrev(prev TaskHook, params ...interface{}) HookOption
type MapSet ¶
type MapSet struct {
// contains filtered or unexported fields
}
func (*MapSet) Difference ¶
type Set ¶
type Set interface { Add(interface{}) bool //添加元素 Remove(interface{}) bool //删除元素 Contains(interface{}) bool //判断是否包含元素 Size() int //返回集合大小 Clear() //清空集合 Values() []interface{} //返回集合中所有元素的切片 KeysStr() []string Union(other Set) Set //返回另一个集合的并集 Intersect(other Set) Set //返回另一个集合的交集 Difference(other Set) Set //返回另一个集合的差集 }
type SetT ¶
type SetT[T Comparable] interface { Add(T) bool //添加元素 Remove(T) bool //删除元素 Contains(T) bool //判断是否包含元素 Size() int //返回集合大小 Clear() //清空集合 Values() []T //返回集合中所有元素的切片 ValueList() []T Union(other SetT[T]) SetT[T] //返回另一个集合的并集 Intersect(other SetT[T]) SetT[T] //返回另一个集合的交集 Difference(other SetT[T]) SetT[T] //返回另一个集合的差集 }
func NewSetT ¶
func NewSetT[T Comparable]() SetT[T]
type SingleFlight ¶
type SingleFlight interface { Do(key string, fn func() (interface{}, error)) (interface{}, error) DoEx(key string, fn func() (interface{}, error)) (interface{}, bool, error) }
SingleFlight 并发任务抽象
func NewFlightGroup ¶
func NewFlightGroup() SingleFlight
type Slice ¶
type Slice[T Comparable] struct { // contains filtered or unexported fields }
func NewSlice ¶
func NewSlice[T Comparable](slice []T) *Slice[T]
func (*Slice[T]) QueryValue ¶
QueryValue 获取指定索引的值
type TopicInter ¶
type TopicInter interface { AddTopic(string, HookOption) *topicTask PrevHandle(string, HookOption) *topicTask AfterHandle(string, HookOption) *topicTask DoAll() }
func Topic ¶
func Topic() TopicInter
Click to show internal directories.
Click to hide internal directories.