Documentation
¶
Index ¶
Constants ¶
View Source
const ControllerStr = "controller"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
Name string
Desc string
Method string
URL string
TargetFile string
Request *Message
Response *Message
}
API represents a rpc definition in a proto file, corresponding to a gin controller.
type Controller ¶
type Controller struct {
Module string
PackageName string // 包名
PbPath string // pb文件路径
Import string // pb文件import
Func ControllerFunc
}
type ControllerFunc ¶
type Field ¶
Field represents a field definition in a proto message. We only need its inline comment to modify go tags so we don't parse the comment.
type Generator ¶
type Generator struct {
GoModule string
ProtoPath string
ProtoFiles []string
PbPath string
PbFiles []string
ControllerPath string
RouterFile string
ThirdPartyPath []string
SwaggerPath string
ServiceNodeMap map[string]string
// contains filtered or unexported fields
}
Generator is responsible to init project and generates codes from proto.
var (
Gender *Generator
)
func (*Generator) FormatSwaggerFile ¶ added in v1.0.3
FormatSwaggerFile 编辑 api/swagger.json的info.description
func (*Generator) GenController ¶ added in v1.0.3
GenController 生产controller
func (*Generator) HandlePbDir ¶ added in v1.0.3
HandlePbDir 处理pb文件夹
func (*Generator) HandleTagGen ¶ added in v1.0.3
HandleTagGen 使用inject_tag处理pb的tag : github.com/favadi/protoc-go-inject-tag
type Message ¶
type Message struct {
Name string
// File is the proto file where it's defined.
File string
Fields []*Field
}
Message represents a message definition in a proto file.
type Project ¶
func (*Project) GenerateTemplateFile ¶
Click to show internal directories.
Click to hide internal directories.