Documentation ¶
Index ¶
- func Generate(plugin *protogen.Plugin) error
- func NewGoModel(protoModel *protomodel.Model) (*gomodel.Model, error)
- func NewProtoModel(plugin *protogen.Plugin) (*protomodel.Model, error)
- func NewRESTBinding(methodName string, rule *annotations.HttpRule, index int) (*protomodel.RESTBinding, error)
- func NewRESTRequestPattern(rule *annotations.HttpRule) (*protomodel.RESTRequestPattern, error)
- func NewService(protoPackage string, descriptor *descriptorpb.ServiceDescriptorProto) *protomodel.Service
- func NewServiceBinding(service *protomodel.Service, method *descriptor.MethodDescriptorProto, ...) error
- func NewView(model *gomodel.Model) (*goview.View, error)
- type Namer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGoModel ¶
func NewGoModel(protoModel *protomodel.Model) (*gomodel.Model, error)
NewGoModel creates a new goModel.Model from the given protomodel.Model. It essentially extracts and organizes the data needed to later generate Go source files.
func NewProtoModel ¶
func NewProtoModel(plugin *protogen.Plugin) (*protomodel.Model, error)
NewProtoModel uses the information in `plugin` to create a new protomodel.Model.
func NewRESTBinding ¶
func NewRESTBinding(methodName string, rule *annotations.HttpRule, index int) (*protomodel.RESTBinding, error)
NewRESTBinding creates a new protomodel.RESTBinding using the given methodName, rule, and index.
func NewRESTRequestPattern ¶
func NewRESTRequestPattern(rule *annotations.HttpRule) (*protomodel.RESTRequestPattern, error)
NewRESTRequestPattern creates a new protomodel.RESTRequestPattern by analyzing the rule provided.
func NewService ¶
func NewService(protoPackage string, descriptor *descriptorpb.ServiceDescriptorProto) *protomodel.Service
NewService creates a protomodel.Service from the given descriptor.
func NewServiceBinding ¶
func NewServiceBinding(service *protomodel.Service, method *descriptor.MethodDescriptorProto, rule *annotations.HttpRule, index int) error
NewServiceBinding adds `rule` (as the `index`th binding for `method`) to the specified `service`.
func NewView ¶
NewView creates a a new goview.View (a series of files to be output) from a gomodel.Model. The current approach is to generate one file per service, with that file containing all the service's RPCs. An additional file `genrest.go` is also created to register all these handlers with a gorilla/mux dispatcher.