Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cli.Command{
Name: "pbgen",
Usage: "根据 proto 文件生成代码",
Flags: flags,
Action: action,
}
Command 定义了 pbgen 子命令,用于根据 proto 文件生成代码
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Name string // 字段名称
Type string // 字段类型
IsArray bool // 是否是数组类型
Comment string // 字段注释
IsEnum bool // 是否是枚举类型
}
Field 表示 protobuf 消息中的字段定义
type Method ¶
type Method struct {
Name string // 方法名称
FieldName string // 字段名称(小写)
InputType string // 输入参数类型
OutputType string // 输出参数类型
HTTPPath string // HTTP 路径
Comment string // 方法注释
Request *Message // 请求消息类型
Response *Message // 响应消息类型
}
Method 表示 protobuf 服务中的方法定义
type PbInfo ¶
type PbInfo struct {
ProtoFile string // proto 文件路径
Package string // proto 包名
ServiceName string // 服务名称
Methods []Method // 服务方法列表
GoPackage string // go 包路径
GoModPath string // go mod 路径
EndpointPath string // endpoint 代码生成路径
PkgName string // go_package 的最后一个路径
EndpointPkgName string // endpoint 包名,使用 epath 的最后一个路径
Messages map[string]*Message // 消息类型映射表
Enums map[string]*Enum // 枚举类型映射表
}
PbInfo 包含解析 proto 文件后的所有信息
Click to show internal directories.
Click to hide internal directories.