protoerrno

package
v0.12.10 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Identity               = "errno"
	Attribute_Name_Status  = "status"
	Attribute_Name_Code    = "code"
	Attribute_Name_Message = "message"
)

annotation const value

Variables

This section is empty.

Functions

This section is empty.

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) []*Enum

IntoEnums generates the errors definitions, excluding the package statement.

func IntoEnumsFromMessage

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

IntoEnumsFromMessage generates the errors definitions, excluding the package statement.

type EnumValue

type EnumValue struct {
	Number      int    // 编号
	Value       string // 值,例: Status_Enabled
	CamelValue  string // 驼峰值,例: StatusEnabled
	Comment     string // 注释
	IsDuplicate bool   // 是否是副本
	Status      int    // 状态码
	Code        int    // 错误码
	Message     string // 错误信息
}

EnumValue 枚举的枚举项

type ErrnoDerive

type ErrnoDerive struct {
	Enabled bool
	Status  int
}

type ErrnoValueDerive

type ErrnoValueDerive struct {
	Status  int
	Code    int
	Message string
}

func ParseDeriveErrnoValue

func ParseDeriveErrnoValue(status, code int, s protogen.Comments) (*ErrnoValueDerive, protoutil.CommentLines)

Jump to

Keyboard shortcuts

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