18 lines
324 B
Go
18 lines
324 B
Go
package decorator
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
)
|
|
|
|
type QueryHandler[Q, U any] interface {
|
|
Handle(ctx context.Context, query Q) (entity U, err error)
|
|
}
|
|
|
|
func AddQueryDecorators[Q, U any](base QueryHandler[Q, U], log *slog.Logger) QueryHandler[Q, U] {
|
|
return queryLoggingDecorator[Q, U]{
|
|
base: base,
|
|
log: log,
|
|
}
|
|
}
|