Documentation ¶
Index ¶
Constants ¶
const (
// DefaultBufferSize specifies the default size of channel.
DefaultBufferSize = 5
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClosureAnonym ¶
type ClosureAnonym func()
ClosureAnonym defines the anonymous function for the Run argument.
type ErrorManager ¶
type ErrorManager struct {
// contains filtered or unexported fields
}
ErrorManager contains Manager but especially for error function.
func NewErrorManager ¶
func NewErrorManager(fns ...OptionFunc) *ErrorManager
NewErrorManager initialize the new error manager.
func (*ErrorManager) Assign ¶
func (em *ErrorManager) Assign(fns ...OptionFunc) *ErrorManager
Assign assigns the OptionFunc to the opt in the error manager.
func (*ErrorManager) ErrChan ¶
func (em *ErrorManager) ErrChan() <-chan error
ErrChan returns the receiving error channel of this error manager.
func (*ErrorManager) Error ¶
func (em *ErrorManager) Error() (err error)
Error returns the first error from the Run execution of the fn closure.
func (*ErrorManager) Run ¶
func (em *ErrorManager) Run(fn ClosureErr) *ErrorManager
Run runs the closure error function.
func (*ErrorManager) WaitClose ¶
func (em *ErrorManager) WaitClose() *ErrorManager
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(fns ...OptionFunc) *Manager
NewManager initialize the task manager.
func (*Manager) Assign ¶
func (m *Manager) Assign(fns ...OptionFunc) *Manager
Assign assigns the functional option to the opt in the Manager.
func (*Manager) Run ¶
func (m *Manager) Run(fn ClosureAnonym) *Manager
Run runs the task in a separate go function.
type Option ¶
type Option struct { // Not affected by Default() method. // UsePanicHandler defaults to false UsePanicHandler bool // Affected by Default() method. // Default is DefaultBufferSize BufferSize int }
Option specifies the option to be used in this package.
func NewDefaultOption ¶
func NewDefaultOption() *Option
NewDefaultOption initialize a new default Option.
func (*Option) Assign ¶
func (o *Option) Assign(opts ...OptionFunc) *Option
Assign assign the functional options list to the Option.
type OptionFunc ¶
type OptionFunc func(*Option)
OptionFunc specifies the optional function for this package.
func WithBufferSize ¶
func WithBufferSize(input int) OptionFunc
WithBufferSize sets the buffer size of the error manager.
func WithPanicHandler ¶
func WithPanicHandler(confirm bool) OptionFunc
WithPanicHandler adds the option to toggle the panic handler on and off.