Skip to content

Commit

Permalink
Refactor hanler
Browse files Browse the repository at this point in the history
  • Loading branch information
minhduc140583 committed Jul 21, 2024
1 parent 1153c1c commit 86751c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/core-go/mq

go 1.18
Empty file added go.sum
Empty file.
6 changes: 3 additions & 3 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ func NewHandlerByConfig[T any](c HandlerConfig,
validate func(context.Context, *T) ([]ErrorMessage, error),
reject func(context.Context, *T, []ErrorMessage, []byte),
handleError func(context.Context, []byte),
goroutines bool, key string, logs ...func(context.Context, string)) *Handler[T] {
return NewHandlerByConfigAndUnmarshal[T](c, nil, write, validate, reject, handleError, goroutines, key, logs...)
logs ...func(context.Context, string)) *Handler[T] {
return NewHandlerByConfigAndUnmarshal[T](c, nil, write, validate, reject, handleError, logs...)
}
func NewHandlerByConfigAndUnmarshal[T any](c HandlerConfig,
unmarshal func(data []byte, v any) error,
write func(context.Context, *T) error,
validate func(context.Context, *T) ([]ErrorMessage, error),
reject func(context.Context, *T, []ErrorMessage, []byte),
handleError func(context.Context, []byte),
goroutines bool, key string, logs ...func(context.Context, string)) *Handler[T] {
logs ...func(context.Context, string)) *Handler[T] {
if c.Retry == nil {
return NewHandlerWithKey[T](unmarshal, write, validate, reject, handleError, nil, c.Goroutines, c.Key, logs...)
} else {
Expand Down

0 comments on commit 86751c6

Please sign in to comment.