Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorChannel ¶ added in v0.3.0
type ErrorChannel struct {
// contains filtered or unexported fields
}
ErrorChannel supports non-blocking send and receive operation to capture error. A maximum of one error is kept in the channel and the rest of the errors sent are ignored, unless the existing error is received and the channel becomes empty again.
func NewErrorChannel ¶ added in v0.3.0
func NewErrorChannel() *ErrorChannel
NewErrorChannel returns a new ErrorChannel.
func (*ErrorChannel) ReceiveError ¶ added in v0.3.0
func (e *ErrorChannel) ReceiveError() error
ReceiveError receives an error from channel without blocking on the receiver.
func (*ErrorChannel) SendError ¶ added in v0.3.0
func (e *ErrorChannel) SendError(err error)
SendError sends an error without blocking the sender.
func (*ErrorChannel) SendErrorWithCancel ¶ added in v0.3.0
func (e *ErrorChannel) SendErrorWithCancel(err error, cancel context.CancelFunc)
SendErrorWithCancel sends an error without blocking the sender and calls cancel function.
type Wrapper ¶
type Wrapper interface {
Run(func())
}
Wrapper is used to wrap a function that will run in a goroutine.
var DefaultWrapper Wrapper = NewWrapper(nil, nil)
func NewWrapper ¶
func NewWrapper(before, after func()) Wrapper
Click to show internal directories.
Click to hide internal directories.