Documentation
¶
Index ¶
Constants ¶
View Source
const ( Identity = "enum" Attribute_Name_Mapping = "mapping" )
annotation const value
Variables ¶
This section is empty.
Functions ¶
func IntoEnumComment ¶
IntoEnumComment generates enum comment if it exists format: @EnumValue[xxx]
Types ¶
type Enum ¶
type Enum struct {
MessageName string // 嵌套消息名
Name string // 名称
Comment string // 注释
Values []*EnumValue // 枚举项
}
Enum 枚举 NOTE:
如果 MessageName 为空, 表明枚举独立, 枚举类型为 ${{Name}}, 枚举值为 ${{Name}}_${{Value}}
如果 MessageName 为不为空, 表明枚举嵌套在message里, 枚举类型为 ${{MessageName}}_{{Name}}, 枚举值为 ${{MessageName}}_${{Value}}
type EnumDerive ¶
type EnumDerive struct {
Enabled bool
}
func ParseDeriveEnum ¶
func ParseDeriveEnum(s protogen.Comments) (*EnumDerive, proc.CommentLines)
type EnumValue ¶
type EnumValue struct {
Number int // 编号
Value string // 值,例: Status_Enabled
CamelValue string // 驼峰值,例: StatusEnabled
TrimValue string // 值截断EnumName前缀,例: Enabled(EnumName=Status)
Mapping string // 映射值
Comment string // 注释
IsDuplicate bool // 是否是副本
}
EnumValue 枚举的枚举项
type EnumValueDerive ¶
type EnumValueDerive struct {
Mapping string
}
func ParseDeriveEnumValue ¶
func ParseDeriveEnumValue(s protogen.Comments) (*EnumValueDerive, proc.CommentLines)
Click to show internal directories.
Click to hide internal directories.