Documentation
¶
Index ¶
- type Handler
- type Option
- type Router
- func (r *Router) Actions() []string
- func (r *Router) Build() (*di.Container, error)
- func (r *Router) Dispatch(ctx context.Context, name string, payload ...any) (any, error)
- func (r *Router) DispatchKey(ctx context.Context, key string, payload ...any) (any, error)
- func (r *Router) Has(name string) bool
- func (r *Router) KeyBindings() map[string]string
- func (r *Router) Provide(name string, instance any)
- func (r *Router) Register(prototype Handler)
- func (r *Router) UseAsyncEvents(bus *events.Bus)
- func (r *Router) UseContainer(container *di.Container)
- func (r *Router) UseEvents(bus *events.Bus)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option configures a Router.
func WithAsyncEvents ¶
WithAsyncEvents emits the action instance asynchronously after dispatch.
func WithContainer ¶
WithContainer uses an existing DI container.
func WithEvents ¶
WithEvents emits the action instance after dispatch.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router dispatches named actions and optional key bindings.
func (*Router) DispatchKey ¶
DispatchKey executes an action by key binding.
func (*Router) KeyBindings ¶
KeyBindings returns key-to-action mappings.
func (*Router) UseAsyncEvents ¶
UseAsyncEvents emits the action instance asynchronously after dispatch.
func (*Router) UseContainer ¶
UseContainer replaces the DI container used during dispatch.
Click to show internal directories.
Click to hide internal directories.