Documentation ¶
Index ¶
- Constants
- func Assign[K comparable, V any](maps ...map[K]V) map[K]V
- func Async[A any](f func() A) chan A
- func AttemptWithDelay(maxIteration int, delay time.Duration, f func(int, time.Duration) error) (int, time.Duration, error)
- func CheckInSlice[T constraints.Ordered](a T, s []T) bool
- func Clamp[T constraints.Ordered](value, min, max T) T
- func Contains[T comparable](collection []T, element T) bool
- func DecorateFn(before, fn, after func()) func()
- func DelOneInSlice[T constraints.Ordered](a T, old []T) (new []T)
- func Empty[T any]() T
- func EntriesToMap[K comparable, V any](entries []Entry[K, V]) map[K]V
- func FanIn(in ...chan any) <-chan any
- func FanOut(ch <-chan any, n int) []chan any
- func FiltrateBy[K comparable, V any](in map[K]V, filtrate func(K, V) bool) map[K]V
- func FiltrateByKeys[K comparable, V any](in map[K]V, keys []K) map[K]V
- func FiltrateByValues[K comparable, V comparable](in map[K]V, values []V) map[K]V
- func Idiom(member any) func(obj any)
- func IndexOf[T comparable](collection []T, predicate func(T) bool) int
- func Invert[K comparable, V comparable](in map[K]V) map[V]K
- func IsNil1(i interface{}) bool
- func IsNil2(i interface{}) bool
- func Keys[K comparable, V any](in map[K]V) []K
- func LastIndexOf[T comparable](collection []T, predicate func(T) bool) int
- func MapUpdateKeys[K comparable, V any, R comparable](in map[K]V, iteratee func(K, V) R) map[R]V
- func MapUpdateValues[K comparable, V any, R any](in map[K]V, iteratee func(K, V) R) map[K]R
- func NewDebounce(duration time.Duration, fns ...func()) (func(), func())
- func SliceFiltrate[V any](collection []V, filtrate func(V, int) bool) []V
- func SliceGroupBy[T any, U comparable](collection []T, iteratee func(T) U) map[U][]T
- func SliceUniq[T any, U comparable](collection []T, iteratee func(T) U) []T
- func SliceUpdateElement[T any, R any](collection []T, iteratee func(T, int) R) []R
- func Synchronize(opt ...sync.Locker) synchronize
- func Ternary[T any](condition bool, ifOutput T, elseOutput T) T
- func Try(callback func() error) (ok bool)
- func Values[K comparable, V any](in map[K]V) []V
- func WaitSignal(fn func(sig os.Signal) bool)
- type AbstractFactory
- type Adapt
- type AdaptImpl
- type Adapter
- type Builder
- type Cloneable
- type Component
- type Composite
- type Debounce
- type Entry
- type IfElse
- type Leaf
- type Mediator
- type Member
- type Message
- type Product
- type PrototypeManager
- type Proxy
- type RingBuffer
- type Session
- type Subscription
- type SwitchCase
- type Target
- type Topic
- type User
Constants ¶
View Source
const ( LeafNode = iota CompositeNode )
Variables ¶
This section is empty.
Functions ¶
func Assign ¶
func Assign[K comparable, V any](maps ...map[K]V) map[K]V
Assign merges multiple maps from left to right.
func AttemptWithDelay ¶
func CheckInSlice ¶
func CheckInSlice[T constraints.Ordered](a T, s []T) bool
CheckInSlice check value in slice
func Clamp ¶
func Clamp[T constraints.Ordered](value, min, max T) T
Clamp clamps number within the inclusive lower and upper bounds.
func Contains ¶
func Contains[T comparable](collection []T, element T) bool
func DecorateFn ¶
func DecorateFn(before, fn, after func()) func()
func DelOneInSlice ¶
func DelOneInSlice[T constraints.Ordered](a T, old []T) (new []T)
DelOneInSlice delete one element of slice left->right
func EntriesToMap ¶
func EntriesToMap[K comparable, V any](entries []Entry[K, V]) map[K]V
func FiltrateBy ¶
func FiltrateBy[K comparable, V any](in map[K]V, filtrate func(K, V) bool) map[K]V
func FiltrateByKeys ¶
func FiltrateByKeys[K comparable, V any](in map[K]V, keys []K) map[K]V
func FiltrateByValues ¶
func FiltrateByValues[K comparable, V comparable](in map[K]V, values []V) map[K]V
func IndexOf ¶
func IndexOf[T comparable](collection []T, predicate func(T) bool) int
func Invert ¶
func Invert[K comparable, V comparable](in map[K]V) map[V]K
func Keys ¶
func Keys[K comparable, V any](in map[K]V) []K
func LastIndexOf ¶
func LastIndexOf[T comparable](collection []T, predicate func(T) bool) int
func MapUpdateKeys ¶
func MapUpdateKeys[K comparable, V any, R comparable](in map[K]V, iteratee func(K, V) R) map[R]V
MapUpdateKeys manipulates a map keys and transforms it to a map of another type.
func MapUpdateValues ¶
func MapUpdateValues[K comparable, V any, R any](in map[K]V, iteratee func(K, V) R) map[K]R
MapUpdateValues manipulates a map values and transforms it to a map of another type.
func NewDebounce ¶
func SliceFiltrate ¶
func SliceGroupBy ¶
func SliceGroupBy[T any, U comparable](collection []T, iteratee func(T) U) map[U][]T
func SliceUniq ¶
func SliceUniq[T any, U comparable](collection []T, iteratee func(T) U) []T
func SliceUpdateElement ¶
func Synchronize ¶
func Values ¶
func Values[K comparable, V any](in map[K]V) []V
func WaitSignal ¶
Types ¶
type AbstractFactory ¶
type AbstractFactory interface {
Create() Product
}
type Component ¶
type Component interface { Parent() Component SetParent(Component) Name() string SetName(string) AddChild(Component) Print(string) }
func NewComponent ¶
type Composite ¶
type Composite struct {
// contains filtered or unexported fields
}
func NewComposite ¶
func NewComposite() *Composite
type Entry ¶
type Entry[K comparable, V any] struct { Key K Value V }
func MapToEntries ¶
func MapToEntries[K comparable, V any](in map[K]V) []Entry[K, V]
type Mediator ¶
type Mediator struct {
// contains filtered or unexported fields
}
func GetMediator ¶
func GetMediator() *Mediator
func (*Mediator) RegisterMember ¶
type PrototypeManager ¶
type PrototypeManager struct {
// contains filtered or unexported fields
}
func NewPrototypeManager ¶
func NewPrototypeManager() *PrototypeManager
func (*PrototypeManager) Get ¶
func (p *PrototypeManager) Get(name string) Cloneable
func (*PrototypeManager) Set ¶
func (p *PrototypeManager) Set(name string, prototype Cloneable)
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
func NewRingBuffer ¶
func NewRingBuffer(inputChannel <-chan any, outputChannel chan any) *RingBuffer
func (*RingBuffer) Run ¶
func (r *RingBuffer) Run()
type Subscription ¶
type Subscription struct { Inbox chan Message // contains filtered or unexported fields }
func (*Subscription) Publish ¶
func (s *Subscription) Publish(msg Message) error
type SwitchCase ¶
type SwitchCase[T comparable, R any] struct { Predicate T Result R Ok bool }
func Switch ¶
func Switch[T comparable, R any](predicate T) *SwitchCase[T, R]
func (*SwitchCase[T, R]) Case ¶
func (s *SwitchCase[T, R]) Case(value T, result R) *SwitchCase[T, R]
func (*SwitchCase[T, R]) CaseFn ¶
func (s *SwitchCase[T, R]) CaseFn(value T, resultFn func() R) *SwitchCase[T, R]
func (*SwitchCase[T, R]) Default ¶
func (s *SwitchCase[T, R]) Default(result R) R
func (*SwitchCase[T, R]) DefaultFn ¶
func (s *SwitchCase[T, R]) DefaultFn(resultFn func() R) R
type Topic ¶
type Topic struct { Subscribers []Session MessageHistory []Message // contains filtered or unexported fields }
func (*Topic) Unsubscribe ¶
func (t *Topic) Unsubscribe(Subscription) error
Click to show internal directories.
Click to hide internal directories.