-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserializeable.go
242 lines (237 loc) · 4 KB
/
serializeable.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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
package magic
import (
"time"
)
type Value interface {
int |
int8 |
int16 |
int32 |
int64 |
uint |
uint8 |
uint16 |
uint32 |
uint64 |
uintptr |
float32 |
float64 |
complex64 |
complex128 |
string |
bool |
time.Time |
AppliedView |
[]AppliedView |
*[]AppliedView |
func() int |
func() int8 |
func() int16 |
func() int32 |
func() int64 |
func() uint |
func() uint8 |
func() uint16 |
func() uint32 |
func() uint64 |
func() uintptr |
func() float32 |
func() float64 |
func() complex64 |
func() complex128 |
func() string |
func() bool |
func() time.Time |
func() AppliedView |
func() []AppliedView |
func() *[]AppliedView |
<-chan int |
<-chan int8 |
<-chan int16 |
<-chan int32 |
<-chan int64 |
<-chan uint |
<-chan uint8 |
<-chan uint16 |
<-chan uint32 |
<-chan uint64 |
<-chan uintptr |
<-chan float32 |
<-chan float64 |
<-chan complex64 |
<-chan complex128 |
<-chan string |
<-chan bool |
<-chan time.Time |
<-chan AppliedView |
<-chan []AppliedView |
<-chan *[]AppliedView
}
// Assign assigns a new value to the given socket
func Assign[T Value](s Socket, key string, value T) {
s.assign(key, value)
}
func isDeferred(v any) bool {
switch v.(type) {
case func() int:
return true
case func() int8:
return true
case func() int16:
return true
case func() int32:
return true
case func() int64:
return true
case func() uint:
return true
case func() uint8:
return true
case func() uint16:
return true
case func() uintptr:
return true
case func() float32:
return true
case func() float64:
return true
case func() complex64:
return true
case func() complex128:
return true
case func() string:
return true
case func() bool:
return true
case func() time.Time:
return true
case func() AppliedView:
return true
case func() []AppliedView:
return true
case func() *[]AppliedView:
return true
case <-chan int:
return true
case <-chan int8:
return true
case <-chan int16:
return true
case <-chan int32:
return true
case <-chan int64:
return true
case <-chan uint:
return true
case <-chan uint8:
return true
case <-chan uint16:
return true
case <-chan uintptr:
return true
case <-chan float32:
return true
case <-chan float64:
return true
case <-chan complex64:
return true
case <-chan complex128:
return true
case <-chan string:
return true
case <-chan bool:
return true
case <-chan time.Time:
return true
case <-chan AppliedView:
return true
case <-chan []AppliedView:
return true
case <-chan *[]AppliedView:
return true
default:
return false
}
}
func resolveDeferred(v any) any {
switch d := v.(type) {
case func() int:
return d()
case func() int8:
return d()
case func() int16:
return d()
case func() int32:
return d()
case func() int64:
return d()
case func() uint:
return d()
case func() uint8:
return d()
case func() uint16:
return d()
case func() uintptr:
return d()
case func() float32:
return d()
case func() float64:
return d()
case func() complex64:
return d()
case func() complex128:
return d()
case func() string:
return d()
case func() bool:
return d()
case func() time.Time:
return d()
case func() AppliedView:
return d()
case func() []AppliedView:
return d()
case func() *[]AppliedView:
return d()
case <-chan int:
return <-d
case <-chan int8:
return <-d
case <-chan int16:
return <-d
case <-chan int32:
return <-d
case <-chan int64:
return <-d
case <-chan uint:
return <-d
case <-chan uint8:
return <-d
case <-chan uint16:
return <-d
case <-chan uintptr:
return <-d
case <-chan float32:
return <-d
case <-chan float64:
return <-d
case <-chan complex64:
return <-d
case <-chan complex128:
return <-d
case <-chan string:
return <-d
case <-chan bool:
return <-d
case <-chan time.Time:
return <-d
case <-chan AppliedView:
return <-d
case <-chan *[]AppliedView:
return <-d
case <-chan []AppliedView:
return <-d
default:
return ""
}
}