signald-go/tools/generator/structs.go.tmpl

21 lines
782 B
Cheetah

package {{.Version}}
// DO NOT EDIT: this file is automatically generated by ./tools/generator in this repo
{{if gt (.ImportVersions | len) 0}}
import (
{{range $version := .ImportVersions}}
"gitlab.com/signald/signald-go/signald/client-protocol/{{$version}}"{{end}}
)
{{end}}
type Request struct {
ID string `json:"id"`
Version string `json:"version"`
Type string `json:"type"`
}
{{ range $structName, $type := .Types }}{{if ne $type.Doc ""}}// {{$structName}}: {{$type.Doc}}{{end}}
type {{ $structName }} struct {
{{if $type.Request}} Request{{end}}
{{ range $fieldName, $field := $type.Fields }}{{ $field.FieldName }} {{if $field.List}}[]{{end}}{{ $field.Type }} `json:"{{$fieldName}},omitempty"`{{if ne $field.Doc ""}} // {{$field.Doc}}{{end}}
{{ end }}}
{{ end }}