Documentation
¶
Overview ¶
Package protogen provides string manipulation functionality specific to protobuf.
Index ¶
- func EnumValueName(s string) string
- func FieldGoType(field protoreflect.FieldDescriptor) (string, bool)
- func GoCamelCase(s string) string
- func GoSanitized(s string) string
- func JSONCamelCase(s string) string
- func JSONSnakeCase(s string) string
- func MapEntryName(s string) string
- func TrimEnumPrefix(s, prefix string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnumValueName ¶
EnumValueName derives the camel-cased enum value name. See protoc v3.8.0: src/google/protobuf/descriptor.cc:297-313
func FieldGoType ¶
func FieldGoType(field protoreflect.FieldDescriptor) (string, bool)
FieldGoType returns the Go type used for a field.
If it returns pointer=true, the struct field is a pointer to the type.
func GoCamelCase ¶
GoCamelCase camel-cases a protobuf name for use as a Go identifier.
If there is an interior underscore followed by a lower case letter, drop the underscore and convert the letter to upper case.
func GoSanitized ¶
GoSanitized converts a string to a valid Go identifier.
func JSONCamelCase ¶
JSONCamelCase converts a snake_case identifier to a camelCase identifier, according to the protobuf JSON specification.
func JSONSnakeCase ¶
JSONSnakeCase converts a camelCase identifier to a snake_case identifier, according to the protobuf JSON specification.
func MapEntryName ¶
MapEntryName derives the name of the map entry message given the field name. See protoc v3.8.0: src/google/protobuf/descriptor.cc:254-276,6057
func TrimEnumPrefix ¶
TrimEnumPrefix trims the enum name prefix from an enum value name, where the prefix is all lowercase without underscores. See protoc v3.8.0: src/google/protobuf/descriptor.cc:330-375
Types ¶
This section is empty.