make application with base logic
This commit is contained in:
17
internal/common/decorator/query.go
Normal file
17
internal/common/decorator/query.go
Normal file
@ -0,0 +1,17 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user