-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
73 lines (59 loc) · 1.11 KB
/
types.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
package types
import "fmt"
// WeekDay can be converted to string.
type WeekDay int
const (
SUNDAY WeekDay = 1
MONDAY WeekDay = 2
)
// helllo this is week day
type WeekDay2 string
const (
A WeekDay2 = "3"
A2 WeekDay2 = "4"
)
// WeekDay3 has no String method.
type WeekDay3 int
const (
TUESDAY WeekDay3 = 5
WEDNESDAY WeekDay3 = 6
)
func (e WeekDay) String() string {
switch e {
case SUNDAY:
return "sun"
case MONDAY:
return "mon"
default:
return fmt.Sprintf("%d", int(e))
}
}
// Super custom array
type CustomArray []int
// struct level comment
type T struct {
//body comment
W WeekDay `json:"weekday"` // field level comment
// kek
W2 WeekDay2 `json:"weekday2"` // kek
W3 WeekDay3 `json:"weekday3"`
}
type UserTag struct {
Tag string `json:"tag"`
}
// Hello
type M struct {
// body comment
Username string `json:"Username2"` // field doc
}
// user
type User struct {
M
NestedStruct struct {
UserTag
}
CustomArray *CustomArray `json:"k"`
FirstName *string `json:"firstname"`
SecondName string `json:"secondName"` // hello
Tags []UserTag `json:"tags"` // dima
}