Versions in this module Expand all Collapse all v1 v1.4.0 Jul 29, 2024 Changes in this version + var ErrNilLinkFn = errors.New("nil link function") + func CastToPointer[T any](v any) (*T, bool) + func DefaultIfNil[T any](a *T, b T) T + func GetMapKeys[K comparable, V any](m map[K]V) []K + func GetMapValues[K comparable, V comparable](m map[K]V, removeDuplicates bool) []V + func IfThenElseFn[T any](condition bool, a, b func() T) T + func IfThenElse[T any](condition bool, a, b T) T + func MapToStruct[T any](m map[string]any) (*T, error) + func StrToStruct[T any](s string) (*T, error) + func StructToMap(t any) (map[string]any, error) + func ToFloat64(value any) (float64, bool) + func ToInt(value any) (int, bool) + func ZeroValue[T any]() T + type AtomicNumber struct + func (a *AtomicNumber[T]) Decrement() + func (a *AtomicNumber[T]) DecrementAndGet() T + func (a *AtomicNumber[T]) DecrementBy(n T) + func (a *AtomicNumber[T]) DecrementByAndGet(n T) T + func (a *AtomicNumber[T]) DecrementByIf(n T, cond func(T) bool) bool + func (a *AtomicNumber[T]) DecrementIf(cond func(T) bool) bool + func (a *AtomicNumber[T]) EqualTo(value T) bool + func (a *AtomicNumber[T]) Get() T + func (a *AtomicNumber[T]) GreaterThan(value T) bool + func (a *AtomicNumber[T]) Increment() + func (a *AtomicNumber[T]) IncrementAndGet() T + func (a *AtomicNumber[T]) IncrementBy(n T) + func (a *AtomicNumber[T]) IncrementByAndGet(n T) T + func (a *AtomicNumber[T]) IncrementByIf(n T, cond func(T) bool) bool + func (a *AtomicNumber[T]) IncrementIf(cond func(T) bool) bool + func (a *AtomicNumber[T]) LessThan(value T) bool + func (a *AtomicNumber[T]) Set(value T) type ConcurrentExec + func (ce *ConcurrentExec) GetNotNilErrors() []error type ConcurrentExecResponse + GetNotNilErrors func() []error + type ConcurrentManager struct + func NewConcurrentManager(minWorkers, maxWorkers int, workerIncreaseRate float64, ...) *ConcurrentManager + func (c *ConcurrentManager) Allocate() + func (c *ConcurrentManager) Release() + func (c *ConcurrentManager) Wait() + type ConcurrentWorkers struct + func NewConcurrentWorkers(maxWorkers int) *ConcurrentWorkers + func (cw *ConcurrentWorkers) Execute(fn func()) + func (cw *ConcurrentWorkers) GetError() error + func (cw *ConcurrentWorkers) IsOpen() bool + func (cw *ConcurrentWorkers) Stop(err error) + func (cw *ConcurrentWorkers) Wait() + type LinkFn func(context.Context, T) error + type Number interface + type Pair struct + First F + Second S + func NewPair[F any, S any](first F, second S) Pair[F, S] + func (p *Pair[F, S]) GetAll() (F, S) + func (p *Pair[F, S]) GetFirst() F + func (p *Pair[F, S]) GetSecond() S + type ProcessChain interface + AddLink func(string, LinkFn[T]) error + Execute func(context.Context, T) ([]string, error) + ExecuteWithIgnorableLinks func(context.Context, T, []string) ([]string, error) + GetChain func() []string + SetSaveStep func(SaveStep[T]) + func NewProcessChain[T any](opts *ProcessChainOptions) ProcessChain[T] + type ProcessChainOptions struct + AddLinkNameToError bool type ResilienceOptions + IsIgnorableErrorHandler func(error) bool + ReturnIgnorable bool + type SaveStep func(context.Context, T, []string) error + type Triple struct + First F + Second S + Third T + func NewTriple[F any, S any, T any](first F, second S, third T) Triple[F, S, T] + func (t Triple[F, S, T]) GetAll() (F, S, T) + func (t Triple[F, S, T]) GetFirst() F + func (t Triple[F, S, T]) GetSecond() S + func (t Triple[F, S, T]) GetThird() T v1.3.0 Sep 26, 2023 Changes in this version + type ToolKitProp interface + SetDefaults func() v1.2.0 Sep 26, 2023 Changes in this version + func RegisterCustomValidator(name string, fn func(fl validator.FieldLevel) bool) v1.1.1 Aug 10, 2023 Changes in this version type ConcurrentExec + func NewConcurrentExec() *ConcurrentExec v1.1.0 Aug 9, 2023 Changes in this version + type Resilience interface + RetryOperation func(operation func() error) error + func NewResilience(options *ResilienceOptions) (Resilience, error) + type ResilienceOptions struct + Backoff bool + MaxRetries int + RawError bool + WaitTime time.Duration v1.0.0 Jun 30, 2023 Changes in this version + var ConcurrentExecAlreadyRunningErr = errors.New("concurrent fns already running") + var ConcurrentExecFnsNilOrEmptyErr = errors.New("fns must not be nil or empty") + var ConcurrentExecNilContextErr = errors.New("context must not be nil") + func Contains(slice []T, item T) bool + func ContainsWithPredicate(slice []T, item T, predicate func(T, T) bool) bool + func Difference(slice, other []T) []T + func Filter(slice []T, predicate func(T) bool) []T + func FilterNot(slice []T, predicate func(T) bool) []T + func IndexOf(slice []T, item T) int + func IndexOfWithPredicate(slice []T, item T, predicate func(T, T) bool) int + func Intersection(slice, other []T) []T + func IsZero(t any) bool + func LastIndexOf(slice []T, item T) int + func LastIndexOfWithPredicate(slice []T, item T, predicate func(T, T) bool) int + func LoadPropFile(filePath string, props []T) error + func Map(slice []T, mapper func(T) R) []R + func Remove(slice []T, item T) bool + func RemoveAll(slice []T, item T) bool + func RemoveAllWithPredicate(slice []T, item T, predicate func(T, T) bool) bool + func RemoveAt(slice []T, index int) bool + func RemoveDuplicates(slice []T) bool + func RemoveIf(slice []T, predicate func(T) bool) bool + func RemoveRange(slice []T, start, end int) bool + func RemoveWithPredicate(slice []T, item T, predicate func(T, T) bool) bool + func Reverse(slice []T) + func ToPtr(t T) *T + func Union(slice, other []T) []T + type ConcurrentExec struct + func (ce *ConcurrentExec) CancelExecution() + func (ce *ConcurrentExec) Done() <-chan struct{} + func (ce *ConcurrentExec) Errors() []error + func (ce *ConcurrentExec) ExecuteFns(ctx context.Context, fns ...ConcurrentFn) (ConcurrentExecResponse, error) + func (ce *ConcurrentExec) Results() []any + type ConcurrentExecResponse interface + CancelExecution func() + Done func() <-chan struct{} + Errors func() []error + Results func() []any + type ConcurrentFn func(ctx context.Context) (any, error)