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 ¶ 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 (*Manager) Run ¶
func (m *Manager) Run(fn ClosureAnonym, opts ...OptionFunc)
Run runs the task in a separate go function.
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.