소스 검색

chore: rename service context from ctx to svcCtx (#1299)

Kevin Wan 3 년 전
부모
커밋
0240fa131a
2개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 2
      tools/goctl/api/gogen/genhandlers.go
  2. 0 2
      tools/goctl/api/parser/g4/gen/api/apiparser_parser.go

+ 2 - 2
tools/goctl/api/gogen/genhandlers.go

@@ -24,7 +24,7 @@ import (
 	{{.ImportPackages}}
 	{{.ImportPackages}}
 )
 )
 
 
-func {{.HandlerName}}(ctx *svc.ServiceContext) http.HandlerFunc {
+func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
 	return func(w http.ResponseWriter, r *http.Request) {
 		{{if .HasRequest}}var req types.{{.RequestType}}
 		{{if .HasRequest}}var req types.{{.RequestType}}
 		if err := httpx.Parse(r, &req); err != nil {
 		if err := httpx.Parse(r, &req); err != nil {
@@ -32,7 +32,7 @@ func {{.HandlerName}}(ctx *svc.ServiceContext) http.HandlerFunc {
 			return
 			return
 		}
 		}
 
 
-		{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), ctx)
+		{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
 		{{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}req{{end}})
 		{{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}req{{end}})
 		if err != nil {
 		if err != nil {
 			httpx.Error(w, err)
 			httpx.Error(w, err)

+ 0 - 2
tools/goctl/api/parser/g4/gen/api/apiparser_parser.go

@@ -628,5 +628,3 @@ func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, in
 
 
 	return p
 	return p
 }
 }
-
-