-
Notifications
You must be signed in to change notification settings - Fork 3
/
handler_api.go
89 lines (66 loc) · 1.53 KB
/
handler_api.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package torque
import "net/http"
type Handler interface {
http.Handler
serveInternal(wr http.ResponseWriter, req *http.Request)
setPath(string)
GetPath() string
setParent(Handler)
GetParent() Handler
addChild(Handler)
GetChildren() []Handler
GetMode() Mode
HasOutlet() bool
SetAction(Action)
SetRenderer(DynamicRenderer)
AddGuard(Guard)
GetGuards() []Guard
SetErrorBoundary(ErrorBoundary)
SetPanicBoundary(PanicBoundary)
}
func (h *handlerImpl[T]) setPath(pattern string) {
h.path = pattern
}
func (h *handlerImpl[T]) GetPath() string {
return h.path
}
func (h *handlerImpl[T]) setParent(parent Handler) {
h.parent = parent
}
func (h *handlerImpl[T]) GetParent() Handler {
return h.parent
}
func (h *handlerImpl[T]) addChild(child Handler) {
h.children = append(h.children, child)
child.setParent(h)
}
func (h *handlerImpl[T]) GetChildren() []Handler {
return h.children
}
func (h *handlerImpl[T]) GetMode() Mode {
return h.mode
}
func (h *handlerImpl[T]) HasOutlet() bool {
if t, ok := h.rendererT.(*templateRenderer[T]); ok {
return t.HasOutlet
}
return false
}
func (h *handlerImpl[T]) SetAction(a Action) {
h.action = a
}
func (h *handlerImpl[T]) SetRenderer(r DynamicRenderer) {
h.rendererVM = r
}
func (h *handlerImpl[T]) AddGuard(g Guard) {
h.guards = append(h.guards, g)
}
func (h *handlerImpl[T]) GetGuards() []Guard {
return h.guards
}
func (h *handlerImpl[T]) SetErrorBoundary(b ErrorBoundary) {
h.errorBoundary = b
}
func (h *handlerImpl[T]) SetPanicBoundary(b PanicBoundary) {
h.panicBoundary = b
}