mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-13 18:00:00 +08:00
feat: Support projectPkg template variables in config, handler, logic, main, and svc template files (#4939)
This commit is contained in:
@@ -17,7 +17,7 @@ const contextFilename = "service_context"
|
||||
//go:embed svc.tpl
|
||||
var contextTemplate string
|
||||
|
||||
func genServiceContext(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) error {
|
||||
func genServiceContext(dir, rootPkg, projectPkg string, cfg *config.Config, api *spec.ApiSpec) error {
|
||||
filename, err := format.FileNamingFormat(cfg.NamingFormat, contextFilename)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -53,6 +53,7 @@ func genServiceContext(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpe
|
||||
"config": "config.Config",
|
||||
"middleware": middlewareStr,
|
||||
"middlewareAssignment": middlewareAssignment,
|
||||
"projectPkg": projectPkg,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user