goupnp/v2alpha/srv/srv.gotemplate

32 lines
689 B
Plaintext
Raw Normal View History

2022-06-06 17:00:39 +00:00
{{define "service"}}
2022-06-08 06:05:49 +00:00
{{- $Imps := .Imps -}}
package {{.Manifest.Package}}
2022-06-06 17:00:39 +00:00
import (
{{- range .Imps.ImportLines}}
{{quote .Alias}} {{.Path}}
{{- end}}
)
{{range .SCPD.SortedActions}}
{{- template "action" args "Action" . "Imps" $Imps}}
{{end}}
{{end}}
{{define "action"}}
2022-06-08 06:05:49 +00:00
{{- $Imps := .Imps}}
type {{.Action.Name}}Request struct
{{- template "args" args "Args" .Action.InArgs "Imps" $Imps}}
2022-06-06 17:00:39 +00:00
2022-06-08 06:05:49 +00:00
type {{.Action.Name}}Response struct
{{- template "args" args "Args" .Action.OutArgs "Imps" $Imps}}
2022-06-06 17:00:39 +00:00
{{- end}}
{{define "args"}}
2022-06-08 06:05:49 +00:00
{{- $Imps := .Imps -}}
{ {{- with .Args}}
{{- range .}}
2022-06-06 17:00:39 +00:00
{{.Name}} {{index $Imps.TypeRefByTypeName .RelatedStateVariable.DataType}}
{{- end}}
2022-06-08 06:05:49 +00:00
{{end -}} }
2022-06-06 17:00:39 +00:00
{{- end}}