Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface {
// Use your custom sync.WaitGroup
WithWg(wg *sync.WaitGroup) Interface
// Use your custom sync.Mutex
WithMt(mt *sync.Mutex) Interface
// Set maximum worker here. Default is 1
WithMaxWorker(maxWorker int64) Interface
// Run the list functions with goroutine
Do(ctx context.Context) error
// Added function that will be run async at goroutine. This method already call c.Done() after process is complete
AddFunc(fn func(ctx context.Context, c Interface))
// Lock block of code. This like mt.Lock()
Lock()
// Unlock block of code. This like mt.Unlock()
Unlock()
// To flag wait group if proccess is done. This like wg.Done()
Done()
// Added errors if have error. This method already implement c.Lock() and c.Unlock(). The error will be returned at Do() method if exists. Recommended to use errors.NewWithCode()
AddError(errs ...error)
// To clear list functions
ClearFunc()
}
func NewConcurrency ¶
func NewConcurrency() Interface
Do concurrency proccess with custom maximum worker
Click to show internal directories.
Click to hide internal directories.