Documentation ¶
Overview ¶
This code is borrowed from https://github.com/golang/protobuf/blob/master/protoc-gen-go/generator/generator.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCase ¶
CamelCase returns the CamelCased name. If there is an interior underscore followed by a lower case letter, drop the underscore and convert the letter to upper case. There is a remote possibility of this rewrite causing a name collision, but it's so remote we're prepared to pretend it's nonexistent - since the C++ generator lowercases names, it's extremely unlikely to have two fields with different capitalizations. In short, _my_field_name_2 becomes XMyFieldName_2.
func CamelCaseSlice ¶
CamelCaseSlice is like CamelCase, but the argument is a slice of strings to be joined with "_".
Types ¶
type FileInfo ¶
type FileInfo struct { FileName string StructInfos []StructInfo HasEnum bool }
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
func (*Generator) ParseGoContent ¶
func (g *Generator) ParseGoContent(outerFile *pluginpb.CodeGeneratorResponse_File)
ParseGoContent analyzes the single package constructed from the patterns and tags. ParseGoContent exits if there is an error.
type GoFile ¶
type GoFile struct {
// contains filtered or unexported fields
}
GoFile holds a single parsed astFile and associated data.
func (*GoFile) FoundProtoMessage ¶
func (g *GoFile) FoundProtoMessage(typ string) (StructInfo, bool)
type StructInfo ¶
func WalkDescriptorProto ¶
func WalkDescriptorProto(g *protogen.Plugin, dp *descriptor.DescriptorProto, typeNames []string) []StructInfo