task

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

README

بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِيْمِ


السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ


ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ


اللَّهُمَّ صَلِّ عَلَى مُحَمَّدٍ ، وَعَلَى آلِ مُحَمَّدٍ ، كَمَا صَلَّيْتَ عَلَى إِبْرَاهِيمَ وَعَلَى آلِ إِبْرَاهِيمَ ، إِنَّكَ حَمِيدٌ مَجِيدٌ ، اللَّهُمَّ بَارِكْ عَلَى مُحَمَّدٍ ، وَعَلَى آلِ مُحَمَّدٍ ، كَمَا بَارَكْتَ عَلَى إِبْرَاهِيمَ ، وَعَلَى آلِ إِبْرَاهِيمَ ، إِنَّكَ حَمِيدٌ مَجِيدٌ

Task

Coverage Status CircleCI Go Report Card

Task is a library to manage and execute tasks.

Documentation

Index

Constants

View Source
const (

	// DefaultBufferSize specifies the default size of channel.
	DefaultBufferSize = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClosureAnonym added in v0.0.2

type ClosureAnonym func()

ClosureAnonym defines the anonymous function for the Run argument.

type ClosureErr added in v0.0.2

type ClosureErr func() (err error)

ClosureErr defines closure that returns error.

type ErrorManager added in v0.0.2

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

ErrorManager contains Manager but especially for error function.

func NewErrorManager added in v0.0.2

func NewErrorManager(bufSize int) *ErrorManager

NewErrorManager initialize the new error manager.

func (*ErrorManager) ErrChan added in v0.0.2

func (em *ErrorManager) ErrChan() <-chan error

ErrChan returns the receiving error channel of this error manager.

func (*ErrorManager) Error added in v0.0.2

func (em *ErrorManager) Error() (err error)

Error returns the first error from the Run execution of the fn closure.

func (*ErrorManager) Run added in v0.0.2

func (em *ErrorManager) Run(fn ClosureErr, opts ...OptionFunc)

Run runs the closure error function.

func (*ErrorManager) WaitClose added in v0.0.4

func (em *ErrorManager) WaitClose()

WaitClose wait all go routines to complete and close the channel in the separate go routine.

type Manager

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

Manager contains all the required tools to manage the task.

func NewManager

func NewManager() *Manager

NewManager initialize the task manager.

func (*Manager) Run

func (m *Manager) Run(fn ClosureAnonym, opts ...OptionFunc)

Run runs the task in a separate go function.

func (*Manager) Wait

func (m *Manager) Wait()

Wait blocks the current thread until the wg counter is zero.

type Option added in v1.0.0

type Option struct {
	// UsePanicHandler defaults to false
	UsePanicHandler bool
}

Option specifies the option to be used in this package.

func (*Option) Assign added in v1.0.0

func (o *Option) Assign(opts ...OptionFunc) *Option

Assign assign the functional options list to the Option.

type OptionFunc added in v1.0.0

type OptionFunc func(*Option)

OptionFunc specifies the optional function for this package.

func WithPanicHandler added in v1.0.0

func WithPanicHandler(confirm bool) OptionFunc

WithPanicHandler adds the option to toggle the panic handler on and off.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL