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 ff11ec7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 18 deletions.
38 changes: 31 additions & 7 deletions _examples/golang-basics/example.gen.go

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

26 changes: 19 additions & 7 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 ff11ec7

Please sign in to comment.