signald-go/tools/generator/structs.go.tmpl
2021-01-30 19:16:27 -08:00

21 lines
851 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" yaml:"id"`
Version string `json:"version" yaml:"version"`
Type string `json:"type" yaml:"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" yaml:"{{$fieldName}},omitempty"`{{if ne $field.Doc ""}} // {{$field.Doc}}{{end}}
{{ end }}}
{{ end }}