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
- func (app *App) WithCommandBus(cb CommandBus) *App
- func (app *App) WithEventBus(eb EventBus) *App
- func (app *App) WithQueryBus(qb QueryBus) *App
- type Codec
- type Command
- type CommandBus
- type CommandDecoder
- 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) Queue() int
- 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)
- func (c *Controller) Streams() int
- func (c *Controller) WithConfig(config ControllerConfig) *Controller
- type ControllerConfig
- type Decoder
- type Encoder
- type Event
- type EventBus
- type EventEncoder
- type EventHandler
- type EventHandlerFunc
- type EventType
- type Query
- type QueryBus
- type QueryDecoder
- type QueryHandler
- type QueryHandlerFunc
- type QueryType
- type Result
- type ResultEncoder
- type TraceID
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEventHandler = errors.New("cqrs: failed to handle event") ErrUnknownCommandType = errors.New("cqrs: unknown command type") ErrUnknownQueryType = errors.New("cqrs: unknown query type") ErrUnimplementedHandler = errors.New("cqrs: unimplemented handler") ErrPanicRecovered = errors.New("cqrs: panic recovered") )
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
func (*App) WithCommandBus ¶ added in v1.1.1
func (app *App) WithCommandBus(cb CommandBus) *App
func (*App) WithEventBus ¶ added in v1.1.1
func (*App) WithQueryBus ¶ added in v1.1.1
type CommandBus ¶
type CommandBus interface {
CommandHandler
HandleFunc(CommandType, CommandHandlerFunc)
}
CommandBus
func NewCommandBus ¶
func NewCommandBus(logger *slog.Logger) CommandBus
type CommandDecoder ¶ added in v1.1.1
type CommandDecoder interface {
DecodeCommand(CommandType, []byte) (Command, error)
}
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, codec Codec) *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) Queue ¶ added in v1.1.1
func (c *Controller) Queue() int
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)
func (*Controller) Streams ¶ added in v1.1.1
func (c *Controller) Streams() int
func (*Controller) WithConfig ¶ added in v1.1.1
func (c *Controller) WithConfig(config ControllerConfig) *Controller
type ControllerConfig ¶ added in v1.1.1
func DefaultControllerConfig ¶ added in v1.1.1
func DefaultControllerConfig() ControllerConfig
type Decoder ¶
type Decoder interface {
CommandDecoder
QueryDecoder
}
type Encoder ¶ added in v1.1.1
type Encoder interface {
EventEncoder
ResultEncoder
}
type EventBus ¶
type EventBus interface {
EventHandler
HandleFunc(EventType, EventHandlerFunc)
}
EventBus
func NewEventBus ¶
type EventEncoder ¶ added in v1.1.1
type EventHandler ¶
EventHandler
type QueryBus ¶
type QueryBus interface {
QueryHandler
HandleFunc(QueryType, QueryHandlerFunc)
}
QueryBus
func NewQueryBus ¶
type QueryDecoder ¶ added in v1.1.1
type QueryHandler ¶
QueryHandler
type QueryHandlerFunc ¶
QueryHandlerFunc
type ResultEncoder ¶ added in v1.1.1
Click to show internal directories.
Click to hide internal directories.