-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjObj.go
307 lines (257 loc) · 8.79 KB
/
ObjObj.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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
package demo
import (
"context"
"database/sql"
"mime/multipart"
"time"
"github.com/go-leo/gors/example/api/pb"
)
//go:generate gors -service ObjObj
// ObjObj
// @GORS @Path(/api/ObjObj)
type ObjObj interface {
// AllRequest is http api
// @GORS @GET @Path(/all/:id/user/:user) @UriBinding @UriBinding @QueryBinding @HeaderBinding @JSONBinding @JSONRender
AllRequest(context.Context, *AllRequestReq) (*AllRequestResp, error)
// UriBindingIndentedJSONRender
// @GORS @GET @Path(/UriBindingIndentedJSONRender/:id) @UriBinding @IndentedJSONRender
UriBindingIndentedJSONRender(context.Context, *UriBindingReq) (*IndentedJSONRenderResp, error)
// QueryBindingSecureJSONRender
// @GORS @GET @Path(/QueryBindingSecureJSONRender/:id) @UriBinding @QueryBinding @SecureJSONRender
QueryBindingSecureJSONRender(context.Context, *QueryBindingReq) (*SecureJSONRenderResp, error)
// HeaderBindingJsonpJSONRender
// @GORS @GET @Path(/HeaderBindingJsonpJSONRender/:id) @UriBinding @QueryBinding @HeaderBinding @JSONPJSONRender
HeaderBindingJsonpJSONRender(context.Context, *HeaderBindingReq) (*JsonpJSONRenderResp, error)
// JSONBindingJSONRender
// @GORS @POST @Path(/JSONBindingJSONRender/:id) @UriBinding @QueryBinding @HeaderBinding @JSONBinding @JSONRender
JSONBindingJSONRender(context.Context, *JSONBindingReq) (*JSONRenderResp, error)
// XMLBindingXMLRender
// @GORS @PATCH @Path(/XMLBindingXMLRender/:id) @UriBinding @QueryBinding @HeaderBinding @XMLBinding @XMLRender
XMLBindingXMLRender(context.Context, *XMLBindingReq) (*XMLRenderResp, error)
// FormBindingJSONRender
// @GORS @POST @Path(/FormBindingJSONRender/:id) @UriBinding @HeaderBinding @FormBinding @JSONRender
FormBindingJSONRender(context.Context, *FormBindingReq) (*JSONRenderResp, error)
// FormPostBindingPureJSONRender
// @GORS @POST @Path(/FormPostBindingPureJSONRender/:id) @UriBinding @QueryBinding @HeaderBinding @FormPostBinding @PureJSONRender
FormPostBindingPureJSONRender(context.Context, *FormPostBindingReq) (*PureJSONRenderResp, error)
// FormMultipartBindingAsciiJSONRender
// @GORS @POST @Path(/FormMultipartBindingAsciiJSONRender/:id) @UriBinding @QueryBinding @HeaderBinding @FormMultipartBinding @AsciiJSONRender
FormMultipartBindingAsciiJSONRender(context.Context, *FormMultipartBindingReq) (*AsciiJSONRenderResp, error)
// ProtoBufBindingProtoBufRender
// @GORS @PUT @Path(/ProtoBufBindingProtoBufRender) @ProtoBufBinding @ProtoBufRender
ProtoBufBindingProtoBufRender(context.Context, *pb.ProtoBufReq) (*pb.ProtoBufResp, error)
// MsgPackBindingMsgPackRender
// @GORS @DELETE @Path(/MsgPackBindingMsgPackRender) @MsgPackBinding @MsgPackRender
MsgPackBindingMsgPackRender(context.Context, *MsgPackBindingReq) (*MsgPackRenderResp, error)
// YAMLBindingYAMLRender
// @GORS @DELETE @Path(/YAMLBindingYAMLRender/:id) @UriBinding @QueryBinding @HeaderBinding @YAMLBinding @YAMLRender
YAMLBindingYAMLRender(context.Context, *YAMLBindingReq) (*YAMLRenderResp, error)
// TOMLBindingTOMLRender
// @GORS @PUT @Path(/TOMLBindingTOMLRender/:id) @UriBinding @QueryBinding @HeaderBinding @TOMLBinding @TOMLRender
TOMLBindingTOMLRender(context.Context, *TOMLBindingReq) (*TOMLRenderResp, error)
// ProtoJSONBindingProtoJSONRender
// @GORS @PUT @Path(/ProtoJSONBindingProtoJSONRender) @ProtoJSONBinding @ProtoJSONRender
ProtoJSONBindingProtoJSONRender(context.Context, *pb.ProtoBufReq) (*pb.ProtoBufResp, error)
}
type Page struct {
Num int `json:"num"`
Size int `json:"size"`
}
type TimeRage struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
}
type AllRequestReq struct {
// I comment 1
// comment 2
I int `uri:"i"` // comment 3
// comment 2
I8 int8 `form:"i8"` // comment 3
I16 int16 `header:"i16"`
I32 int32
I64 int64
U uint
U8 uint8
U16 uint16
U32 uint32
U64 uint64
F32 float32
F64 float64
B bool
S string
Bs []byte `json:"bs"`
A [10]int
T time.Time
UriBindingReq UriBindingReq
UriBindingReqPtr *UriBindingReq
ProtoBufReq pb.ProtoBufReq
ProtoBufReqPtr *pb.ProtoBufReq
UriBindingReqs []UriBindingReq
UriBindingReqPtrs []*UriBindingReq
ProtoBufReqs []pb.ProtoBufReq
ProtoBufReqPtrs []*pb.ProtoBufReq
Page
*TimeRage
sql.NullByte
*sql.NullInt32
int
bool
*int64
*string
Avatar *multipart.FileHeader `form:"avatar"`
}
type AllRequestResp struct {
}
type UriBindingReq struct {
ID int64 `uri:"id"`
}
type IndentedJSONRenderResp struct {
ID int64 `json:"id"`
Name string `json:"name"`
Address string `json:"address"`
Birthday time.Time `json:"birthday"`
CreateTime time.Time `json:"createTime"`
UnixTime time.Time `json:"unixTime"`
}
type QueryBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
}
type SecureJSONRenderResp struct {
ID int64 `json:"id"`
Name string `json:"name"`
Address string `json:"address"`
Birthday time.Time `json:"birthday"`
CreateTime time.Time `json:"createTime"`
UnixTime time.Time `json:"unixTime"`
}
type HeaderBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
}
type JsonpJSONRenderResp struct {
ID int64 `json:"id"`
Name string `json:"name"`
Auth string `json:"auth"`
Address string `json:"address"`
Birthday time.Time `json:"birthday"`
CreateTime time.Time `json:"createTime"`
UnixTime time.Time `json:"unixTime"`
}
type JSONBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string `json:"address"`
}
type JSONRenderResp struct {
ID int64 `json:"id"`
Name string `json:"name"`
Auth string `json:"auth"`
Address string `json:"address"`
Birthday time.Time `json:"birthday"`
CreateTime time.Time `json:"createTime"`
UnixTime time.Time `json:"unixTime"`
}
type XMLBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string `xml:"address"`
}
type XMLRenderResp struct {
ID int64 `xml:"id"`
Name string `xml:"name"`
Auth string `xml:"auth"`
Address string `xml:"address"`
Birthday time.Time `xml:"birthday"`
CreateTime time.Time `xml:"createTime"`
UnixTime time.Time `xml:"unixTime"`
}
type FormBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string `form:"address"`
Avatar *multipart.FileHeader `form:"avatar"`
}
type FormBindingResp struct {
V int64
}
type FormPostBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string `form:"address"`
}
type PureJSONRenderResp struct {
ID int64 `json:"id"`
Name string `json:"name"`
Auth string `json:"auth"`
Address string `json:"address"`
Birthday time.Time `json:"birthday"`
CreateTime time.Time `json:"createTime"`
UnixTime time.Time `json:"unixTime"`
}
type FormMultipartBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string `form:"address"`
Avatar *multipart.FileHeader `form:"avatar"`
}
type AsciiJSONRenderResp struct {
ID int64 `json:"id"`
Name string `json:"name"`
Auth string `json:"auth"`
Address string `json:"address"`
Birthday time.Time `json:"birthday"`
CreateTime time.Time `json:"createTime"`
UnixTime time.Time `json:"unixTime"`
}
type MsgPackBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string
}
type MsgPackRenderResp struct {
ID int64
Name string
Auth string
Address string
Birthday time.Time
CreateTime time.Time
UnixTime time.Time
}
type YAMLBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string `yaml:"address"`
}
type YAMLRenderResp struct {
ID int64 `yaml:"id"`
Name string `yaml:"name"`
Auth string `yaml:"auth"`
Address string `yaml:"address"`
Birthday time.Time `yaml:"birthday"`
CreateTime time.Time `yaml:"createTime"`
UnixTime time.Time `yaml:"unixTime"`
}
type TOMLBindingReq struct {
ID int64 `uri:"id"`
Name string `form:"name"`
Auth string `header:"Authorization"`
Address string `toml:"address"`
}
type TOMLRenderResp struct {
ID int64 `toml:"id"`
Name string `toml:"name"`
Auth string `toml:"auth"`
Address string `toml:"address"`
Birthday time.Time `toml:"birthday"`
CreateTime time.Time `toml:"createTime"`
UnixTime time.Time `toml:"unixTime"`
}