-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
models_gen.go
180 lines (150 loc) · 3.61 KB
/
models_gen.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
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package graphql
import (
"fmt"
"io"
"strconv"
"time"
)
type Linkable interface {
IsLinkable()
GetURI() URI
}
type Searchable interface {
IsSearchable()
GetSummary() string
}
type AddComment struct {
Content string `json:"content"`
PostID string `json:"post_id"`
}
type EditBook struct {
ID *string `json:"id,omitempty"`
Title *string `json:"title,omitempty"`
GoodreadsID string `json:"goodreads_id"`
}
type EditPost struct {
ID *string `json:"id,omitempty"`
Content *string `json:"content,omitempty"`
Title *string `json:"title,omitempty"`
Datetime *time.Time `json:"datetime,omitempty"`
Draft *bool `json:"draft,omitempty"`
}
type InputGeo struct {
Lat float64 `json:"lat"`
Long float64 `json:"long"`
}
type Limit struct {
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
type NewLink struct {
Title string `json:"title"`
URI URI `json:"uri"`
Description string `json:"description"`
Tags []string `json:"tags"`
Created *time.Time `json:"created,omitempty"`
}
type NewLog struct {
Sector Sector `json:"sector"`
Description *string `json:"description,omitempty"`
Project string `json:"project"`
Started time.Time `json:"started"`
Stopped time.Time `json:"stopped"`
}
type NewStat struct {
Key string `json:"key"`
Value float64 `json:"value"`
}
type NewTweet struct {
FavoriteCount int `json:"favorite_count"`
Hashtags []string `json:"hashtags,omitempty"`
ID string `json:"id"`
Posted time.Time `json:"posted"`
RetweetCount int `json:"retweet_count"`
Symbols []string `json:"symbols,omitempty"`
Text string `json:"text"`
Urls []*URI `json:"urls,omitempty"`
ScreenName string `json:"screen_name"`
UserMentions []string `json:"user_mentions,omitempty"`
}
// A stat is a key value pair of two interesting strings.
type Stat struct {
Key string `json:"key"`
Value float64 `json:"value"`
When time.Time `json:"when"`
}
type Role string
const (
RoleAdmin Role = "admin"
RoleNormal Role = "normal"
)
var AllRole = []Role{
RoleAdmin,
RoleNormal,
}
func (e Role) IsValid() bool {
switch e {
case RoleAdmin, RoleNormal:
return true
}
return false
}
func (e Role) String() string {
return string(e)
}
func (e *Role) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Role(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Role", str)
}
return nil
}
func (e Role) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type Sector string
const (
SectorCode Sector = "CODE"
SectorWriting Sector = "WRITING"
SectorAudio Sector = "AUDIO"
SectorResearch Sector = "RESEARCH"
SectorSocial Sector = "SOCIAL"
SectorPersonal Sector = "PERSONAL"
)
var AllSector = []Sector{
SectorCode,
SectorWriting,
SectorAudio,
SectorResearch,
SectorSocial,
SectorPersonal,
}
func (e Sector) IsValid() bool {
switch e {
case SectorCode, SectorWriting, SectorAudio, SectorResearch, SectorSocial, SectorPersonal:
return true
}
return false
}
func (e Sector) String() string {
return string(e)
}
func (e *Sector) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Sector(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Sector", str)
}
return nil
}
func (e Sector) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}