This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
swipe.go
executable file
·265 lines (215 loc) · 8.35 KB
/
swipe.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
// Code generated by Swipe v2.0.0-rc13. DO NOT EDIT.
package fixtures
// A Option is an option for a Swipe.
type Option string
// Build the basic option for defining the generation.
func Build(opts Option) {}
// A ConfigEnvOption is an option env config.
type ConfigEnvOption string
// ConfigEnv option for config generation.
//
// To generate a configuration loader, you can use the swipe.ConfigEnv option.
// The optionsStruct parameter is a pointer to the configuration structure.
//
// The option can work with all primitives, including datetime, and an array of primitives.
//
// The option supports nested structures.
//
// To use the default value, just specify it as a value in the structure.
//
// Default func name is `LoadConfig`.
//
// You can use structure tags to control generation:
//
// env - name of environment var, options: `required`.
//
// flag - name of flag, enable as the console flag.
//
// desc - description for String function.
func ConfigEnv(optionsStruct interface{}, opts ...ConfigEnvOption) Option {
return "implementation not generated, run swipe"
}
func ConfigEnvFuncName(name string) ConfigEnvOption {
return "implementation not generated, run swipe"
}
// ConfigEnvDocEnable enable markdown doc generate.
func ConfigEnvDocEnable() ConfigEnvOption {
return "implementation not generated, run swipe"
}
// ConfigEnvDocOutput output path markdown doc generate.
func ConfigEnvDocOutput(output string) ConfigEnvOption {
return "implementation not generated, run swipe"
}
// A ServiceOption is an option service.
type ServiceOption string
// A MethodOption is an option method.
type MethodOption string
// A OpenapiServersOption is an openapi servers option.
type OpenapiServersOption string
// A OpenapiServerOption is an openapi concrete server option.
type OpenapiServerOption string
// Service a option that defines the generation of transport, metrics, tracing, and logging for gokit.
// Given iface is nil pointer interface, for example:
// (*pkg.Iface)(nil)
func Service(opts ...ServiceOption) Option {
return "implementation not generated, run swipe"
}
// @type:"repeat"
func Interface(iface interface{}, ns string) ServiceOption {
return "implementation not generated, run swipe"
}
func AppName(value string) ServiceOption {
return "implementation not generated, run swipe"
}
// ReadmeEnable enable for generate readme markdown for service.
func ReadmeEnable() ServiceOption {
return "implementation not generated, run swipe"
}
func ReadmeOutput(value string) ServiceOption {
return "implementation not generated, run swipe"
}
func ReadmeTemplatePath(value string) ServiceOption {
return "implementation not generated, run swipe"
}
// JSONRPCEnable enabled use JSON RPC instead of REST.
func JSONRPCEnable() ServiceOption {
return "implementation not generated, run swipe"
}
// JSONRPCPath sets the end point for transport.
func JSONRPCPath(value string) ServiceOption {
return "implementation not generated, run swipe"
}
// JSONRPCDocEnable enable for generate markdown JSON RPC doc.
func JSONRPCDocEnable() ServiceOption {
return "implementation not generated, run swipe"
}
// JSONRPCDocOutput change output dir for generate markdown JSON RPC doc.
func JSONRPCDocOutput(output string) ServiceOption {
return "implementation not generated, run swipe"
}
// MethodOptions option for defining method settings.
// Given signature is interface method, for example: pkg.Interface.Create
// @type:"repeat"
func MethodOptions(signature interface{}, opts ...MethodOption) ServiceOption {
return "implementation not generated, run swipe"
}
// MethodDefaultOptions option for defining for all methods default settings.
func MethodDefaultOptions(opts ...MethodOption) ServiceOption {
return "implementation not generated, run swipe"
}
// Logging a option enabled/disable logging middleware.
func Logging(enable bool) MethodOption {
return "implementation not generated, run swipe"
}
func Exclude(enable bool) MethodOption {
return "implementation not generated, run swipe"
}
func LoggingParams(includes []string, excludes []string) MethodOption {
return "implementation not generated, run swipe"
}
func LoggingContext(key interface{}, name string) MethodOption {
return "implementation not generated, run swipe"
}
// InstrumentingEnable a option enabled/disable instrumenting (collect metrics) middleware.
func Instrumenting(enable bool) MethodOption {
return "implementation not generated, run swipe"
}
// InstrumentingDisable a option disable instrumenting (collect metrics) middleware.
func InstrumentingDisable() MethodOption {
return "implementation not generated, run swipe"
}
// RESTMethod sets http method, default is GET.
func RESTMethod(value string) MethodOption {
return "implementation not generated, run swipe"
}
// WrapResponse wrap the response from the server to an object, for example if you want to return as:
// {data: { you response data }}
// need to add option:
// ...code here...
// WrapResponse("data")
// ... code here ...
func RESTWrapResponse(value string) MethodOption {
return "implementation not generated, run swipe"
}
// Path sets http path, default is lowecase method name with the prefix "/",
// for example: the Get method will look like " /get".
func RESTPath(value string) MethodOption {
return "implementation not generated, run swipe"
}
// HeaderVars sets the key/value array to get method values from headers,
// where the key is the name of the method parameter,
// and the value is the name of the header.
func RESTHeaderVars(value ...string) MethodOption {
return "implementation not generated, run swipe"
}
// QueryVars sets the key/value array to get method values from query args,
// where the key is the name of the method parameter,
// and the value is the name of the query args.
func RESTQueryVars(value ...string) MethodOption {
return "implementation not generated, run swipe"
}
// DefaultErrorEncoder is responsible for encoding the server error.
func DefaultErrorEncoder(fn interface{}) ServiceOption {
return "implementation not generated, run swipe"
}
// ServerEncodeResponseFunc sets the encoding function of the passed
// response object to the response writer.
func ServerEncodeResponseFunc(fn interface{}) MethodOption {
return "implementation not generated, run swipe"
}
// ServerDecodeRequestFunc sets a function to extract the user's domain
// request object from the request object.
func ServerDecodeRequestFunc(fn interface{}) MethodOption {
return "implementation not generated, run swipe"
}
// ClientEncodeRequestFunc sets the function to encode the passed
// request object into an object.
func ClientEncodeRequestFunc(fn interface{}) MethodOption {
return "implementation not generated, run swipe"
}
// ClientDecodeResponseFunc sets a function to extract the user's domain
// response object from the response object.
func ClientDecodeResponseFunc(fn interface{}) MethodOption {
return "implementation not generated, run swipe"
}
// ClientsEnable enable generate Golang, JavaScript client.
func ClientsEnable(langs []string) ServiceOption {
return "implementation not generated, run swipe"
}
// HTTPServer enable generate http server.
func HTTPServer() ServiceOption {
return "implementation not generated, run swipe"
}
// HTTPFast enable generate fast http server.
func HTTPFast() ServiceOption {
return "implementation not generated, run swipe"
}
// OpenapiEnable enabled generate openapi documentation.
func OpenapiEnable() ServiceOption {
return "implementation not generated, run swipe"
}
// OpenapiTags sets docs tags for method.
func OpenapiTags(methods []interface{}, tags []string) ServiceOption {
return "implementation not generated, run swipe"
}
// OpenapiOutput sets output directory, path relative to the file, default is "./".
func OpenapiOutput(value string) ServiceOption {
return "implementation not generated, run swipe"
}
// OpenapiInfo sets info.
func OpenapiInfo(title, description, version string) ServiceOption {
return "implementation not generated, run swipe"
}
// OpenapiContact sets openapi contact.
func OpenapiContact(name, email, url string) ServiceOption {
return "implementation not generated, run swipe"
}
// OpenapiLicence sets openapi licence.
func OpenapiLicence(name, url string) ServiceOption {
return "implementation not generated, run swipe"
}
// OpenapiServer sets openapi server.
// @type:"repeat"
func OpenapiServer(description, url string) ServiceOption {
return "implementation not generated, run swipe"
}