-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhandler_api.go
More file actions
134 lines (103 loc) · 2.31 KB
/
handler_api.go
File metadata and controls
134 lines (103 loc) · 2.31 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package torque
import (
"net/http"
)
type Handler interface {
http.Handler
setOverride(http.Handler)
getController() Controller
getHookProvider() HookProvider
getRouter() *router
setPath(string)
GetPath() string
addChild(child Handler)
getChildren() []Handler
setParent(Handler)
GetParent() Handler
GetMode() Mode
HasOutlet() bool
SetAction(Action)
SetRenderer(DynamicRenderer)
AddGuard(Guard)
GetGuards() []Guard
SetErrorBoundary(ErrorBoundary)
GetErrorBoundary() ErrorBoundary
SetPanicBoundary(PanicBoundary)
GetPanicBoundary() PanicBoundary
}
func (h *handlerImpl[T]) setOverride(override http.Handler) {
h.override = override
}
func (h *handlerImpl[T]) setPath(pattern string) {
h.path = pattern
}
func (h *handlerImpl[T]) GetPath() string {
return h.path
}
func (h *handlerImpl[T]) getController() Controller {
return h.ctl
}
func (h *handlerImpl[T]) getHookProvider() HookProvider {
return h.hookProvider
}
func (h *handlerImpl[T]) getRouter() *router {
return h.router
}
func (h *handlerImpl[T]) addChild(child Handler) {
h.children = append(h.children, child)
if child.GetParent() != h {
child.setParent(h)
}
}
func (h *handlerImpl[T]) getChildren() []Handler {
return h.children
}
func (h *handlerImpl[T]) setParent(parent Handler) {
h.parent = parent
var found = false
for _, child := range parent.getChildren() {
if child == h {
found = true
break
}
}
if !found {
parent.addChild(h)
}
}
func (h *handlerImpl[T]) GetParent() Handler {
return h.parent
}
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]) GetErrorBoundary() ErrorBoundary {
return h.errorBoundary
}
func (h *handlerImpl[T]) SetErrorBoundary(b ErrorBoundary) {
h.errorBoundary = b
}
func (h *handlerImpl[T]) GetPanicBoundary() PanicBoundary {
return h.panicBoundary
}
func (h *handlerImpl[T]) SetPanicBoundary(b PanicBoundary) {
h.panicBoundary = b
}