Documentation ¶
Overview ¶
Package plugin implements a plugin for protoc-gen-go that generates RPC stubs for use with the the net/rpc package.
To register the plugin, import this package as follows:
import _ "github.com/kylelemons/go-rpcgen/plugin"
Index ¶
- type Plugin
- func (p *Plugin) Generate(file *generator.FileDescriptor)
- func (p *Plugin) GenerateCommonStubs(svc *descriptor.ServiceDescriptorProto)
- func (p *Plugin) GenerateImports(file *generator.FileDescriptor)
- func (p *Plugin) GenerateRPCStubs(svc *descriptor.ServiceDescriptorProto)
- func (p *Plugin) GenerateWebStubs(svc *descriptor.ServiceDescriptorProto)
- func (p *Plugin) Init(g *generator.Generator)
- func (p *Plugin) Name() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the generator.Plugin interface.
func (*Plugin) Generate ¶
func (p *Plugin) Generate(file *generator.FileDescriptor)
Generate generates the RPC stubs for all plugin in the given FileDescriptorProto.
func (*Plugin) GenerateCommonStubs ¶
func (p *Plugin) GenerateCommonStubs(svc *descriptor.ServiceDescriptorProto)
GenerateCommonStubs is the core of the plugin package. It generates an interface based on the ServiceDescriptorProto that is used by the other two halves of the plugin.
func (*Plugin) GenerateImports ¶
func (p *Plugin) GenerateImports(file *generator.FileDescriptor)
GenerateImports adds the required imports to the output file if the Generate function generated any RPC stubs.
func (*Plugin) GenerateRPCStubs ¶
func (p *Plugin) GenerateRPCStubs(svc *descriptor.ServiceDescriptorProto)
GenerateRPCStubs generates the net/rpc-based stubs. It generates an RPC client implementation of the interface as well as three helper functions to create the Client and Server necessary to utilize the service over RPC.
func (*Plugin) GenerateWebStubs ¶
func (p *Plugin) GenerateWebStubs(svc *descriptor.ServiceDescriptorProto)
GenerateWebStubs generates the webrpc stubs. It generates a webrpc client implementation of the interface as well as webrpc handlers and a helper function.