New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hope gf gen ctrl supports controller template customization #3524
Comments
Package that You wish to enhance github.com/gogf/gf/cmd/gf/v2 Enhancement description The gf ctrl command adds a parameter to specify the template used when generating the controller file. In the current template, the controller method template content is: func (c *{CtrlName}) {MethodName}(ctx context.Context, req *{Version}.{MethodName}Req) (res *{Version}.{MethodName}Res, err error) { In actual business, there is a lot of boilerplate syntax in this method, so we hope that the users can customize the template according to their needs. Additional |
Package that You wish to enhance
github.com/gogf/gf/cmd/gf/v2
Enhancement description
gf ctrl命令增加一个参数,可以指定生成controller文件时使用的模板。
目前模板中,controller方法模板内容为:
func (c *{CtrlName}) {MethodName}(ctx context.Context, req *{Version}.{MethodName}Req) (res *{Version}.{MethodName}Res, err error) {
// 这里其实可以写一些样板语法,比如:链路追踪的代码
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
实际业务中,这个方法中有大量的样板语法,所以希望可以由使用的人来根据需要定制模板
Additional
The text was updated successfully, but these errors were encountered: