Skip to content

Commit

Permalink
fix gin template render error
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Mar 6, 2020
1 parent c7b25e9 commit 3fc59a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions internal/generator/templates/gin_iface.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ type {{.TypeName}} interface {
Chain() gin.HandlersChain
{{end}}
{{range .Fields}}{{if notEmptyStr .Comment }} // {{.Comment}}
{{.MethodName}}(*gin.Context){{else}} {{.MethodName}}(*gin.Context){{end}}{{end}}
{{.MethodName}}(*gin.Context){{else}} {{.MethodName}}(*gin.Context){{end}}
{{end}}
}

// Register{{.TypeName}}Servant register {{.TypeName}} servant to gin
Expand All @@ -23,5 +24,6 @@ func Register{{.TypeName}}Servant(e *gin.Engine, s {{.TypeName}}) {
router.Use(middlewares...)
{{end}}
// register routes info to router
{{range .Fields}}{{if notHttpAny .HttpMethod }}router.Handle({{.HttpMethod}}, "{{.Path}}", s.{{.MethodName}}){{else}}router.Any("{{.Path}}", s.{{.MethodName}}){{end}}{{end}}
{{range .Fields}}{{if notHttpAny .HttpMethod }}router.Handle({{.HttpMethod}}, "{{.Path}}", s.{{.MethodName}}){{else}}router.Any("{{.Path}}", s.{{.MethodName}}){{end}}
{{end}}
}
8 changes: 4 additions & 4 deletions internal/generator/templates_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3fc59a1

Please sign in to comment.