|
|
@ -12,7 +12,6 @@ import (
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util"
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util"
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/format"
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/format"
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/vars"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const defaultLogicPackage = "logic"
|
|
|
|
const defaultLogicPackage = "logic"
|
|
|
@ -48,16 +47,15 @@ func genHandler(dir, rootPkg string, cfg *config.Config, group spec.Group, route
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return doGenToFile(dir, handler, cfg, group, route, handlerInfo{
|
|
|
|
return doGenToFile(dir, handler, cfg, group, route, handlerInfo{
|
|
|
|
PkgName: pkgName,
|
|
|
|
PkgName: pkgName,
|
|
|
|
ImportPackages: genHandlerImports(group, route, parentPkg),
|
|
|
|
ImportPackages: genHandlerImports(group, route, parentPkg),
|
|
|
|
ImportHttpxPackage: fmt.Sprintf("\"%s/rest/httpx\"", vars.ProjectOpenSourceURL),
|
|
|
|
HandlerName: handler,
|
|
|
|
HandlerName: handler,
|
|
|
|
RequestType: util.Title(route.RequestTypeName()),
|
|
|
|
RequestType: util.Title(route.RequestTypeName()),
|
|
|
|
LogicName: logicName,
|
|
|
|
LogicName: logicName,
|
|
|
|
LogicType: strings.Title(getLogicName(route)),
|
|
|
|
LogicType: strings.Title(getLogicName(route)),
|
|
|
|
Call: strings.Title(strings.TrimSuffix(handler, "Handler")),
|
|
|
|
Call: strings.Title(strings.TrimSuffix(handler, "Handler")),
|
|
|
|
HasResp: len(route.ResponseTypeName()) > 0,
|
|
|
|
HasResp: len(route.ResponseTypeName()) > 0,
|
|
|
|
HasRequest: len(route.RequestTypeName()) > 0,
|
|
|
|
HasRequest: len(route.RequestTypeName()) > 0,
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|