protoenum

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntoEnumComment

func IntoEnumComment(pe *protogen.Enum, disableOrComment bool) string

IntoEnumComment generates enum comment if it exists disableOrComment mapping 值不存在, 则使用注释

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}}

func IntoEnums

func IntoEnums(nestedMessageName string, protoEnums []*protogen.Enum, disableOrComment bool) []*Enum

IntoEnums generates the errors definitions, excluding the package statement.

func IntoEnumsFromMessage

func IntoEnumsFromMessage(nestedMessageName string, protoMessages []*protogen.Message, disableOrComment bool) []*Enum

IntoEnumsFromMessage generates the errors definitions, excluding the package statement.

type EnumValue

type EnumValue struct {
	Number     int    // 编号
	Value      string // 值
	CamelValue string // 驼峰值
	Mapping    string // 映射值
	Comment    string // 注释
}

EnumValue 枚举的枚举项

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL