Documentation
¶
Index ¶
Constants ¶
View Source
const CapSize = 10
Variables ¶
This section is empty.
Functions ¶
func RegisterHandler ¶
Types ¶
type Callback ¶
type Callback struct { Func CallbackFunc Async bool }
type CallbackFunc ¶
type CallbackFunc func(r Result)
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func (*Chain) Next ¶
func (c *Chain) Next(i *Invocation)
type Handler ¶
type Handler interface {
Handle(i *Invocation)
}
type Invocation ¶
type Invocation struct { Callback // contains filtered or unexported fields }
func NewInvocation ¶
func NewInvocation(ctx context.Context, ch Chain) (inv Invocation)
func (*Invocation) Context ¶
func (i *Invocation) Context() context.Context
func (*Invocation) Invoke ¶
func (i *Invocation) Invoke(f CallbackFunc)
func (*Invocation) Next ¶
func (i *Invocation) Next(opts ...InvocationOption)
Next is the method to go next step in handler chain WithFunc and WithAsyncFunc options can add customize callbacks in chain and the callbacks seq like below i.Success/Fail() -> CB1 ---> CB3 ----------> END goroutine 0
\-> CB2(async) \ goroutine 1 \-> CB4(async) goroutine 1 or 2
func (*Invocation) WithContext ¶
func (i *Invocation) WithContext(key string, val interface{}) *Invocation
type InvocationOp ¶
type InvocationOp struct { Func CallbackFunc Async bool }
type InvocationOption ¶
type InvocationOption func(op InvocationOp) InvocationOp
func WithAsyncFunc ¶
func WithAsyncFunc(f func(r Result)) InvocationOption
func WithFunc ¶
func WithFunc(f func(r Result)) InvocationOption
Click to show internal directories.
Click to hide internal directories.