/
model.go
49 lines (46 loc) · 1.82 KB
/
model.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
package api
// Base contains possible fields for any response
// non-required fields are optional and may not exist
type Base struct {
ID int `json:"id" binding:"required"`
Type string `json:"type" binding:"required"`
By string `json:"by"`
Time int `json:"time"`
Kids []int `json:"kids,omitempty"`
Dead bool `json:"-"`
Deleted bool `json:"-"`
Descendants int `json:"descendants"`
Score int `json:"score"`
Title string `json:"title,omitempty"`
Parent int `json:"parent,omitempty"`
URL string `json:"url,omitempty"`
Text string `json:"text,omitempty"`
}
type BaseWithKids struct {
ID int `json:"id" binding:"required"`
Type string `json:"type" binding:"required"`
By string `json:"by"`
Time int `json:"time"`
Kids []interface{} `json:"kids,omitempty"`
Dead bool `json:"-"`
Deleted bool `json:"-"`
Descendants int `json:"descendants"`
Score int `json:"score"`
Title string `json:"title,omitempty"`
Parent int `json:"parent,omitempty"`
URL string `json:"url,omitempty"`
Text string `json:"text,omitempty"`
}
type Comment struct {
ID int `json:"id" binding:"required"`
Type string `json:"type" binding:"required"`
By string `json:"by"`
Time int `json:"time"`
Kids []interface{} `json:"kids,omitempty"`
Dead bool `json:"-"`
Deleted bool `json:"-"`
Descendants int `json:"descendants"`
Score int `json:"score"`
Parent int `json:"parent,omitempty"`
Text string `json:"text,omitempty"`
}