Documentation
¶
Index ¶
- Variables
- func Dispatch(ctx context.Context, d Dispatcher, msg ...Message) error
- func DispatchAfter(ctx context.Context, d Dispatcher, duration time.Duration, ...)
- func DispatchAt(ctx context.Context, d Dispatcher, t time.Time, resultFn func(err error), ...)
- func MessageName(msg Message) string
- func MessageNameFromHandler(h Handler) string
- type Dispatcher
- type HTTPHandlerWrapper
- type Handler
- type Message
- type Mux
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("dispatcher: handler not found")
)
Errors
Functions ¶
func Dispatch ¶
func Dispatch(ctx context.Context, d Dispatcher, msg ...Message) error
Dispatch calls handler for given messages in sequence order, when a handler returns error, dispatch will stop and return that error
func DispatchAfter ¶ added in v1.0.5
func DispatchAfter(ctx context.Context, d Dispatcher, duration time.Duration, resultFn func(err error), msg ...Message)
DispatchAfter calls dispatch after given duration or run immediate if duration is negative, then call resultFn with return error
func DispatchAt ¶ added in v1.0.5
func DispatchAt(ctx context.Context, d Dispatcher, t time.Time, resultFn func(err error), msg ...Message)
DispatchAt calls dispatch at given time, and will run immediate if time already passed
func MessageName ¶ added in v1.1.0
MessageName gets message name
func MessageNameFromHandler ¶ added in v1.1.0
MessageNameFromHandler gets message name from handler
Types ¶
type Dispatcher ¶
Dispatcher is the event dispatcher
type HTTPHandlerWrapper ¶ added in v1.3.0
type HTTPHandlerWrapper struct {
Dispatcher Dispatcher
Decoder func(r *http.Request, v interface{}) error
Encoder func(w http.ResponseWriter, r *http.Request, v interface{}) error
Result string
}
HTTPHandlerWrapper wraps dispatcher message to http handler
type Handler ¶
type Handler interface{}
Handler is the event handler
func(context.Context, *Any) error
Click to show internal directories.
Click to hide internal directories.