Skip to content

Commit

Permalink
render map[string]MethodCtx in template
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Sep 30, 2024
1 parent 2269e08 commit b9066db
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 20 deletions.
40 changes: 32 additions & 8 deletions _examples/golang-basics/example.gen.go

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

28 changes: 20 additions & 8 deletions _examples/golang-imports/api.gen.go

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

12 changes: 8 additions & 4 deletions types.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@
{{- end }}

var (
methodAnnotations = map[string]map[string]string{
methodAnnotations = map[string]MethodCtx{
{{- range $_, $service := $services -}}
{{- range $_, $method := $service.Methods }}
"/rpc/{{$service.Name}}/{{$method.Name}}": {
{{- range $_, $annotation := $method.Annotations -}}
"{{$annotation.AnnotationType}}": "{{$annotation.Value}}",
{{- end -}}
Name: "{{$method.Name}}",
Service: "{{$service.Name}}",
Annotations: map[string]string{
{{- range $_, $annotation := $method.Annotations -}}
"{{$annotation.AnnotationType}}": "{{$annotation.Value}}",
{{- end -}}
},
},
{{- end -}}
{{ end }}
Expand Down

0 comments on commit b9066db

Please sign in to comment.