Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comments ¶
type Comments struct { // Leading are the comment lines directly above the line of code Leading []string // Leading detached are comment lines above // the line of code but not directly touching LeadingDetached [][]string // Trailing are comment lines directly under the line of code Trailing []string }
Comments holds the set of comments associated with an entity
type Field ¶
type Field struct { // Name is the name from the proto file e.g. email_address Name string // Repeated is true if this field has the repeated label Repeated bool // GoName is the name the field will get in the go struct e.g. EmailAddress GoName string // TypeName is the name of the type e.g. TYPE_STRING TypeName string // Type is the message if TypeName == TYPE_MESSAGE Type *Message // contains filtered or unexported fields }
Field represents a field within a message
func (*Field) GetExtension ¶
func (f *Field) GetExtension(extension *proto.ExtensionDesc) (interface{}, error)
GetExtension can be used to get custom options set on a field
type File ¶
type File struct { // Name is the relative path and filename of the proto file Name string // ProtoPackage is the name defined in the proto's package statement ProtoPackage string // GoImportPath is the go import path of the package as defined by the go_package option GoImportPath string // GoPackage is the name defined by the go_package option GoPackage string // PackageComments are comments on the package definition PackageComments *Comments // Imports is the list of go imports this file needs for its service types Imports []*Import // Services are the services defined in the proto file Services []*Service // Messages are the messages defined in the proto // file and any messages from public imports Messages []*Message // contains filtered or unexported fields }
File represents a parsed proto file
func Parse ¶
func Parse(req *plugin_go.CodeGeneratorRequest) ([]*File, error)
Parse turns a CodeGeneratorRequest into a parsed set of Files
func (*File) GetPackageComments ¶
GetPackageComments is a nil-safe getter for PackageComments
type Import ¶
type Import struct { // Alias is the import alias if one is required Alias string // Path is the path to be imported Path string }
Import describes a go import
type Message ¶
type Message struct { // Name is the simple name of the message Name string // ProtoName is the dot-delimited, fully- // qualified protobuf name of the message. ProtoName string // GoTypeName is the name of the go type generated for this message GoTypeName string // Comments defines the comments attached to the message Comments *Comments // Fields are the fields defined in the message Fields []*Field // File is the file in which the message was defined (or the file // in which it was imported in the case of a public import). File *File // Parent is set if the message definition was nested inside another Parent *Message // contains filtered or unexported fields }
Message represents a message type defined in a proto file
func (*Message) GetComments ¶
GetComments is a nil-safe getter for Comments
func (*Message) GetExtension ¶
func (m *Message) GetExtension(extension *proto.ExtensionDesc) (interface{}, error)
GetExtension can be used to get custom options set on a message
type Method ¶
type Method struct { // Name is the simple name for this method Name string // InputType is the message defined as the input type InputType *Message // OutputType is the message defined as the output type OutputType *Message // Comments defines the comments attached to the method Comments *Comments // contains filtered or unexported fields }
Method represents a method defined in a service
func (*Method) GetComments ¶
GetComments is a nil-safe getter for Comments
func (*Method) GetExtension ¶
func (m *Method) GetExtension(extension *proto.ExtensionDesc) (interface{}, error)
GetExtension can be used to get custom options set on a method
type Service ¶
type Service struct { // Name is the simple name of the service Name string // Methods are the methods (RPCs) defined in this service Methods []*Method // Comments defines the comments attached to the service Comments *Comments // contains filtered or unexported fields }
Service represents a service definition in a proto file
func (*Service) GetComments ¶
GetComments is a nil-safe getter for Comments
func (*Service) GetExtension ¶
func (s *Service) GetExtension(extension *proto.ExtensionDesc) (interface{}, error)
GetExtension can be used to get custom options set on a service