18 lines
306 B
Go
18 lines
306 B
Go
package decorator
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
)
|
|
|
|
type CommandHandler[T any] interface {
|
|
Handle(ctx context.Context, params T) error
|
|
}
|
|
|
|
func ApplyCommandDecorators[T any](base CommandHandler[T], log *slog.Logger) CommandHandler[T] {
|
|
return commandLoggingDecorator[T]{
|
|
base: base,
|
|
log: log,
|
|
}
|
|
}
|