Rene Nochebuena bc3c5aa846
All checks were successful
Go CI/CD / go-ci (push) Successful in 36s
Add CQRS library 'Singularity' with core handlers and tests
Introduces the 'Singularity' implementation, a CQRS Bus that supports commands, queries, and events, along with middleware extensibility. Includes comprehensive tests, modular files for commands, queries, and events, as well as CI/CD workflows.
2025-04-26 22:25:23 -06:00

18 lines
570 B
Go

package cqrs
import (
"context"
)
type Bus interface {
RegisterCommandHandler(cmd Command, handler CommandHandler)
RegisterQueryHandler(query Query, handler QueryHandler)
RegisterEventHandler(event Event, handler EventHandler)
UseCommandMiddleware(middleware CommandMiddleware)
UseQueryMiddleware(middleware QueryMiddleware)
UseEventMiddleware(middleware EventMiddleware)
ExecuteCommand(ctx context.Context, cmd Command) ([]Event, error)
ExecuteQuery(ctx context.Context, query Query) (interface{}, error)
EmitEvent(ctx context.Context, event Event) error
}