-
Notifications
You must be signed in to change notification settings - Fork 1
/
handler.go
42 lines (37 loc) · 951 Bytes
/
handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package handler
import (
"github.com/shandysiswandi/echo-service/internal/config"
"github.com/shandysiswandi/echo-service/internal/domain/port"
"github.com/shandysiswandi/echo-service/pkg/clock"
"github.com/shandysiswandi/echo-service/pkg/gen"
"github.com/shandysiswandi/echo-service/pkg/validation"
)
/* Example get user jwt
user := c.Get("user").(*jwte.Token)
data := user.Claims.(*JWTClaim)
*/
type (
Handler struct {
config *config.Config
validate *validation.Validation
clock clock.Clocker
generator gen.Generator
tdu port.TodoUsecase
}
HandlerConfig struct {
Config *config.Config
Validator *validation.Validation
Clock clock.Clocker
Generator gen.Generator
TodoUsecase port.TodoUsecase
}
)
func New(hc HandlerConfig) *Handler {
return &Handler{
config: hc.Config,
validate: hc.Validator,
clock: hc.Clock,
generator: hc.Generator,
tdu: hc.TodoUsecase,
}
}