Documentation
¶
Index ¶
- Variables
- type App
- func (app *App) CommandHandler() CommandHandler
- func (app *App) EventHandler() EventHandler
- func (app *App) HandleCommand(t CommandType, f CommandHandlerFunc)
- func (app *App) HandleEvent(t EventType, f EventHandlerFunc)
- func (app *App) HandleQuery(t QueryType, f QueryHandlerFunc)
- func (app *App) QueryHandler() QueryHandler
- type Command
- type CommandBus
- type CommandHandler
- type CommandHandlerFunc
- type CommandType
- type Controller
- func (c *Controller) Close()
- func (c *Controller) Commands(w http.ResponseWriter, r *http.Request)
- func (c *Controller) Events(w http.ResponseWriter, r *http.Request)
- func (c *Controller) Handler() http.Handler
- func (c *Controller) Queries(w http.ResponseWriter, r *http.Request)
- func (c *Controller) ServeCommands(w http.ResponseWriter, r *http.Request)
- func (c *Controller) ServeEvents(w http.ResponseWriter, r *http.Request)
- func (c *Controller) ServeQueries(w http.ResponseWriter, r *http.Request)
- type Decoder
- type Event
- type EventBus
- type EventHandler
- type EventHandlerFunc
- type EventType
- type Query
- type QueryBus
- type QueryHandler
- type QueryHandlerFunc
- type QueryType
- type Result
- type TraceID
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknownCommandType = errors.New("cqrs: unknown command type") ErrUnknownQueryType = errors.New("cqrs: unknown query type") )
View Source
var (
ErrEventHandler = errors.New("cqrs: event handling failed")
)
View Source
var ErrUnimplementedHandler = errors.New("cqrs: unimplemented handler")
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) CommandHandler ¶
func (app *App) CommandHandler() CommandHandler
func (*App) EventHandler ¶
func (app *App) EventHandler() EventHandler
func (*App) HandleCommand ¶
func (app *App) HandleCommand(t CommandType, f CommandHandlerFunc)
func (*App) HandleEvent ¶
func (app *App) HandleEvent(t EventType, f EventHandlerFunc)
func (*App) HandleQuery ¶
func (app *App) HandleQuery(t QueryType, f QueryHandlerFunc)
func (*App) QueryHandler ¶
func (app *App) QueryHandler() QueryHandler
type CommandBus ¶
type CommandBus interface {
CommandHandler
HandleFunc(CommandType, CommandHandlerFunc)
}
CommandBus
func NewCommandBus ¶
func NewCommandBus() CommandBus
type CommandHandler ¶
type CommandHandler interface {
Types() []CommandType
Handle(context.Context, Command) ([]Event, error)
}
CommandHandler
type CommandHandlerFunc ¶
CommandHandlerFunc
type CommandType ¶
type CommandType string
CommandType
func (CommandType) String ¶
func (ct CommandType) String() string
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(logger *slog.Logger, app *App, decoder Decoder) *Controller
func (*Controller) Close ¶
func (c *Controller) Close()
func (*Controller) Commands ¶
func (c *Controller) Commands(w http.ResponseWriter, r *http.Request)
func (*Controller) Events ¶
func (c *Controller) Events(w http.ResponseWriter, r *http.Request)
func (*Controller) Handler ¶
func (c *Controller) Handler() http.Handler
func (*Controller) Queries ¶
func (c *Controller) Queries(w http.ResponseWriter, r *http.Request)
func (*Controller) ServeCommands ¶
func (c *Controller) ServeCommands(w http.ResponseWriter, r *http.Request)
func (*Controller) ServeEvents ¶
func (c *Controller) ServeEvents(w http.ResponseWriter, r *http.Request)
func (*Controller) ServeQueries ¶
func (c *Controller) ServeQueries(w http.ResponseWriter, r *http.Request)
type EventBus ¶
type EventBus interface {
EventHandler
HandleFunc(EventType, EventHandlerFunc)
}
EventBus
func NewEventBus ¶
func NewEventBus() EventBus
type EventHandler ¶
EventHandler
type QueryBus ¶
type QueryBus interface {
QueryHandler
HandleFunc(QueryType, QueryHandlerFunc)
}
QueryBus
func NewQueryBus ¶
func NewQueryBus() QueryBus
type QueryHandler ¶
QueryHandler
type QueryHandlerFunc ¶
QueryHandlerFunc
Click to show internal directories.
Click to hide internal directories.