2016-11-04 21:45:25 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/golang/protobuf/protoc-gen-go/descriptor"
|
|
|
|
"github.com/golang/protobuf/protoc-gen-go/plugin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type GenericTemplateBasedEncoder struct {
|
|
|
|
service *descriptor.ServiceDescriptorProto
|
|
|
|
file *descriptor.FileDescriptorProto
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewGenericTemplateBasedEncoder(service *descriptor.ServiceDescriptorProto, file *descriptor.FileDescriptorProto) (e *GenericTemplateBasedEncoder) {
|
|
|
|
e = &GenericTemplateBasedEncoder{
|
|
|
|
service: service,
|
|
|
|
file: file,
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *GenericTemplateBasedEncoder) Files() []*plugin_go.CodeGeneratorResponse_File {
|
2016-11-05 21:08:41 +01:00
|
|
|
//log.Printf("file: %v\n", e.file)
|
|
|
|
//log.Printf("service: %v\n", e.service)
|
2016-11-04 21:45:25 +01:00
|
|
|
var content string = "hello world"
|
|
|
|
var fileName string = "test.txt"
|
|
|
|
return []*plugin_go.CodeGeneratorResponse_File{
|
|
|
|
&plugin_go.CodeGeneratorResponse_File{
|
|
|
|
Content: &content,
|
|
|
|
Name: &fileName,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|