Refactor service template.

This commit is contained in:
John Beisley 2022-06-08 07:05:49 +01:00
parent ef53d14055
commit 9b16826229

View File

@ -1,5 +1,5 @@
{{define "service"}}
{{- $Imps := .Imps}}
{{- $Imps := .Imps -}}
package {{.Manifest.Package}}
import (
@ -13,18 +13,19 @@ import (
{{end}}
{{define "action"}}
type {{.Action.Name}}Request struct {
{{- template "args" args "Args" .Action.InArgs "Imps" .Imps}}
}
{{- $Imps := .Imps}}
type {{.Action.Name}}Request struct
{{- template "args" args "Args" .Action.InArgs "Imps" $Imps}}
type {{.Action.Name}}Response struct {
{{- template "args" args "Args" .Action.OutArgs "Imps" .Imps}}
}
type {{.Action.Name}}Response struct
{{- template "args" args "Args" .Action.OutArgs "Imps" $Imps}}
{{- end}}
{{define "args"}}
{{- $Imps := .Imps}}
{{- range .Args}}
{{- $Imps := .Imps -}}
{ {{- with .Args}}
{{- range .}}
{{.Name}} {{index $Imps.TypeRefByTypeName .RelatedStateVariable.DataType}}
{{- end}}
{{end -}} }
{{- end}}