Documentation ¶
Index ¶
- func DispatchDomainEvents(ctx context.Context, order IAggregateRoot)
- func HandleUseCase[H IBaseUseCaseHandler[U, R], U IBaseUseCase, R any](ctx context.Context, handler H, useCase U, result *UseCaseResult[R]) error
- func NewEventContext(ctx context.Context) context.Context
- type EventContext
- type EventHandlerDispatcherMiddleware
- type IAggregateRoot
- type IBaseEvent
- type IBaseEventHandler
- type IBaseUseCase
- type IBaseUseCaseHandler
- type IBaseUseCaseMiddleware
- type IEventDispatcher
- type UseCaseIdentity
- type UseCaseResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchDomainEvents ¶
func DispatchDomainEvents(ctx context.Context, order IAggregateRoot)
func HandleUseCase ¶
func HandleUseCase[H IBaseUseCaseHandler[U, R], U IBaseUseCase, R any](ctx context.Context, handler H, useCase U, result *UseCaseResult[R]) error
Types ¶
type EventContext ¶
type EventContext struct {
// contains filtered or unexported fields
}
func GetEventContext ¶
func GetEventContext(ctx context.Context) *EventContext
func (*EventContext) AddDispatched ¶
func (self *EventContext) AddDispatched(event IBaseEvent)
func (*EventContext) AddRaised ¶
func (self *EventContext) AddRaised(event IBaseEvent)
func (*EventContext) TakeDispatched ¶
func (self *EventContext) TakeDispatched() IBaseEvent
func (*EventContext) TakeRaised ¶
func (self *EventContext) TakeRaised() IBaseEvent
type EventHandlerDispatcherMiddleware ¶
type EventHandlerDispatcherMiddleware[T IBaseUseCase, R any] struct { // contains filtered or unexported fields }
func NewEventHandlerDispatcherMiddleware ¶
func NewEventHandlerDispatcherMiddleware[T IBaseUseCase, R any](dispatcher IEventDispatcher) *EventHandlerDispatcherMiddleware[T, R]
func (*EventHandlerDispatcherMiddleware[T, R]) After ¶
func (s *EventHandlerDispatcherMiddleware[T, R]) After(ctx context.Context, useCase T, err error, result *UseCaseResult[R]) (error, context.Context, T, *UseCaseResult[R])
type IAggregateRoot ¶
type IAggregateRoot interface { RaiseEvent(event IBaseEvent) GetDomainEvents() []IBaseEvent ClearDomainEvents() }
type IBaseEvent ¶
type IBaseEvent interface {
ExchangeName() string
}
type IBaseEventHandler ¶
type IBaseEventHandler[E IBaseEvent] interface { Handle(ctx context.Context, event E) error }
type IBaseUseCase ¶
type IBaseUseCase interface {
GetIdentity() *UseCaseIdentity
}
type IBaseUseCaseHandler ¶
type IBaseUseCaseHandler[U IBaseUseCase, R any] interface { GetMiddlewares() []IBaseUseCaseMiddleware[U, R] Handle(ctx context.Context, useCase U) (error, *UseCaseResult[R]) }
type IBaseUseCaseMiddleware ¶
type IBaseUseCaseMiddleware[T IBaseUseCase, R any] interface { Before(ctx context.Context, useCase T) (error, context.Context, T) After(ctx context.Context, useCase T, err error, result *UseCaseResult[R]) (error, context.Context, T, *UseCaseResult[R]) }
type IEventDispatcher ¶
type IEventDispatcher interface {
Dispatch(ctx context.Context, event IBaseEvent) error
}
func GetEventDispatcher ¶
func GetEventDispatcher(ctx context.Context) IEventDispatcher
type UseCaseIdentity ¶
type UseCaseIdentity struct { }
type UseCaseResult ¶
func NewUseCaseResultAll ¶
func NewUseCaseResultAll[T any](content T, meta map[string]string) *UseCaseResult[T]
func NewUseCaseResultWithContent ¶
func NewUseCaseResultWithContent[T any](content T) *UseCaseResult[T]
Click to show internal directories.
Click to hide internal directories.