Skip to content

Commit

Permalink
WebrpcMethods(), var methods indentation (#77)
Browse files Browse the repository at this point in the history
* methods function

* examples

* Methods() -> WebrpcMethods()
  • Loading branch information
david-littlefarmer authored Nov 6, 2024
1 parent d45f5a4 commit 27970f3
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 67 deletions.
73 changes: 40 additions & 33 deletions _examples/golang-basics/example.gen.go

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

43 changes: 25 additions & 18 deletions _examples/golang-imports/api.gen.go

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

35 changes: 19 additions & 16 deletions types.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,26 @@

{{- end }}

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

func WebrpcMethods() map[string]method {
res := make(map[string]method, len(methods))
for k, v := range methods {
res[k] = v
}
)

return res
}

var WebRPCServices = map[string][]string{
{{- range $_, $service := $services}}
Expand Down

0 comments on commit 27970f3

Please sign in to comment.