All checks were successful
Go CI/CD / go-ci (push) Successful in 36s
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.
20 lines
363 B
Go
20 lines
363 B
Go
package cqrs
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type Event interface{}
|
|
|
|
type EventMiddleware func(EventHandler) EventHandler
|
|
|
|
type EventHandlerFunc func(ctx context.Context, event Event) error
|
|
|
|
func (f EventHandlerFunc) Handle(ctx context.Context, event Event) error {
|
|
return f(ctx, event)
|
|
}
|
|
|
|
type EventHandler interface {
|
|
Handle(ctx context.Context, event Event) error
|
|
}
|