-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtemplate.go
33 lines (31 loc) · 862 Bytes
/
template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
var protoTemplate = `// Code generated by go2proto. DO NOT EDIT.
syntax = "proto3";
{{- range $v := .Imports}}
import "{{$v}}";
{{- end -}}
{{- if .ImportTime}}
import "google/protobuf/timestamp.proto";
{{end}}
package {{.PackageName}};
{{ if .Service.Name}}
service {{.Service.Name}} {
{{- range .Service.ServiceFunctions}}
{{- if .PingPong}}
rpc {{.Name}} (stream {{.ParamType}}) returns (stream {{.ResultType}}) {} {{.Comment}}
{{- else if .Stream}}
rpc {{.Name}} ({{.ParamType}}) returns (stream {{.ResultType}}) {} {{.Comment}}
{{- else}}
rpc {{.Name}} ({{.ParamType}}) returns ({{.ResultType}}) {} {{.Comment}}
{{- end}}
{{- end}}
}
{{end -}}
{{range .Messages}}
message {{.Name}} {
{{- range .MessageFields}}
{{.FieldType}} {{.FieldName}} = {{.Index}}; {{.Comment}}
{{- end}}
}
{{end -}}
`