|
1 | 1 | <templateSet group="GoFrame">
|
2 |
| - <template name="gfapi" value="type $apiName$Req struct { 	g.Meta `path:"$path$" method:"$method$"` 	$input$ } type $apiName$Res struct { }" description="gen gf api struct" toReformat="false" toShortenFQNames="true"> |
| 2 | + <template name="gf-api" value="type $apiName$Req struct { 	g.Meta `path:"$path$" method:"$method$"` 	$input$ } type $apiName$Res struct { }" description="gen gf api struct" toReformat="false" toShortenFQNames="true"> |
3 | 3 | <variable name="apiName" expression="" defaultValue="" alwaysStopAt="true" />
|
4 | 4 | <variable name="path" expression="" defaultValue="" alwaysStopAt="true" />
|
5 | 5 | <variable name="method" expression="" defaultValue="" alwaysStopAt="true" />
|
|
8 | 8 | <option name="GO_FILE" value="true" />
|
9 | 9 | </context>
|
10 | 10 | </template>
|
11 |
| - <template name="gfapicombo" value="type ( $apiName$Req struct { g.Meta `path:"$path$" method:"$method$"` $input$ } $apiName$Res struct { } )" description="gen gf api struct(gf >= 2.5.7)" toReformat="false" toShortenFQNames="true"> |
| 11 | + <template name="gf-api-combo" value="type ( $apiName$Req struct { g.Meta `path:"$path$" method:"$method$"` $input$ } $apiName$Res struct { } )" description="gen gf api struct(gf >= 2.5.7)" toReformat="false" toShortenFQNames="true"> |
12 | 12 | <variable name="apiName" expression="" defaultValue="" alwaysStopAt="true" />
|
13 | 13 | <variable name="path" expression="" defaultValue="" alwaysStopAt="true" />
|
14 | 14 | <variable name="method" expression="" defaultValue="" alwaysStopAt="true" />
|
|
17 | 17 | <option name="GO_FILE" value="true" />
|
18 | 18 | </context>
|
19 | 19 | </template>
|
20 |
| - <template name="gfservice" value="type s$serviceName$ struct { } func init() { 	service.Register$serviceName$(New()) } func New() *s$serviceName$ { 	return &s$serviceName${$content$} }" description="gen gf service" toReformat="false" toShortenFQNames="true"> |
| 20 | + <template name="gf-ctrl-func" value="func (c *$cName$) $name$(ctx context.Context, req *$pName$.$name$Req) (res *$pName$.$name$Res, err error) { 	return } " description="gen gf controller" toReformat="false" toShortenFQNames="true"> |
| 21 | + <variable name="cName" expression="" defaultValue="" alwaysStopAt="true" /> |
| 22 | + <variable name="name" expression="" defaultValue="" alwaysStopAt="true" /> |
| 23 | + <variable name="pName" expression="" defaultValue="" alwaysStopAt="true" /> |
| 24 | + <context> |
| 25 | + <option name="GO_FILE" value="true" /> |
| 26 | + </context> |
| 27 | + </template> |
| 28 | + <template name="gf-srv" value="type s$serviceName$ struct { } func init() { 	service.Register$serviceName$(New()) } func New() *s$serviceName$ { 	return &s$serviceName${$content$} }" description="gen gf service" toReformat="false" toShortenFQNames="true"> |
21 | 29 | <variable name="serviceName" expression="" defaultValue="" alwaysStopAt="true" />
|
22 | 30 | <variable name="content" expression="" defaultValue="" alwaysStopAt="true" />
|
23 | 31 | <context>
|
24 | 32 | <option name="GO_FILE" value="true" />
|
25 | 33 | </context>
|
26 | 34 | </template>
|
27 |
| - <template name="gfctrlrfunc" value="func (c *$cName$) $name$(ctx context.Context, req *$pName$.$name$Req) (res *$pName$.$name$Res, err error) { 	return } " description="gen gf controller" toReformat="false" toShortenFQNames="true"> |
28 |
| - <variable name="cName" expression="" defaultValue="" alwaysStopAt="true" /> |
29 |
| - <variable name="name" expression="" defaultValue="" alwaysStopAt="true" /> |
30 |
| - <variable name="pName" expression="" defaultValue="" alwaysStopAt="true" /> |
| 35 | + <template name="gf-srv-func" value="func (s *s$serviceName$) $funcName$(ctx context.Context) (err error) { }" description="gen gf service func" toReformat="false" toShortenFQNames="true"> |
| 36 | + <variable name="serviceName" expression="" defaultValue="" alwaysStopAt="true" /> |
| 37 | + <variable name="funcName" expression="" defaultValue="" alwaysStopAt="true" /> |
31 | 38 | <context>
|
32 | 39 | <option name="GO_FILE" value="true" />
|
33 | 40 | </context>
|
34 | 41 | </template>
|
35 |
| - <template name="gfservicefunc" value="func (s *s$serviceName$) $funcName$(ctx context.Context) (err error) { }" description="gen gf service func" toReformat="false" toShortenFQNames="true"> |
| 42 | + <template name="gf-srv-crud" value="func init() { 	service.Register$serviceName$(New()) } type s$serviceName$ struct { } func New() *s$serviceName$ { 	return &s$serviceName${} } func (s *s$serviceName$) Create(ctx context.Context, $modelName$ *entity.$model$) (id int, err error) { 	return 0, nil } func (s *s$serviceName$) GetOne(ctx context.Context, id int) ($modelName$ *entity.$model$, err error) { 	return nil, err } func (s *s$serviceName$) GetList(ctx context.Context) (libs []*entity.$model$, err error) { 	return nil, err } func (s *s$serviceName$) Update(ctx context.Context, $modelName$ *entity.$model$) (err error) { 	return nil } func (s *s$serviceName$) Delete(ctx context.Context, id int) (err error) { 	return nil } " description="gen gf service crud" toReformat="false" toShortenFQNames="true"> |
36 | 43 | <variable name="serviceName" expression="" defaultValue="" alwaysStopAt="true" />
|
37 |
| - <variable name="funcName" expression="" defaultValue="" alwaysStopAt="true" /> |
| 44 | + <variable name="modelName" expression="" defaultValue="" alwaysStopAt="true" /> |
| 45 | + <variable name="model" expression="" defaultValue="" alwaysStopAt="true" /> |
38 | 46 | <context>
|
39 | 47 | <option name="GO_FILE" value="true" />
|
40 | 48 | </context>
|
|
0 commit comments