Documentation
¶
Index ¶
- type Annotation
- type CommentSet
- type Comments
- type Descriptor
- type Enum
- type EnumValue
- type Extension
- type ExtensionType
- type Field
- type FieldNumber
- type File
- type FileInfo
- type FullName
- type GeneratedCodeInfo
- type GeneratedFile
- func (g *GeneratedFile) Annotate(symbol string, loc Location)
- func (g *GeneratedFile) AnnotateSymbol(symbol string, info Annotation)
- func (g *GeneratedFile) Content() ([]byte, error)
- func (g *GeneratedFile) Import(importPath GoImportPath)
- func (g *GeneratedFile) P(v ...interface{})
- func (g *GeneratedFile) QualifiedGoIdent(ident GoIdent) string
- func (g *GeneratedFile) Skip()
- func (g *GeneratedFile) Unskip()
- func (g *GeneratedFile) Write(p []byte) (n int, err error)
- type GoIdent
- type GoImportPath
- type GoPackageName
- type Location
- type Message
- type Method
- type Oneof
- type Options
- type Plugin
- type Service
- type Types
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct {
// 位置是元素的来源. proto 文件。
Location Location
}
type CommentSet ¶
type Descriptor ¶
type Descriptor string
type Enum ¶
type Enum struct {
Desc string
GoIdent GoIdent // Go 类型
Values []*EnumValue // 价值申报
Location Location // 此enum 的位置
Comments CommentSet // 与本集相关的评论
}
type EnumValue ¶
type EnumValue struct {
Desc string
GoIdent GoIdent // 生成的 Go 声明名称
Parent *Enum // 声明此值的千兆
Location Location // 此enum 值的位置
Comments CommentSet // 与此宏值相关的注释
}
type ExtensionType ¶
type ExtensionType struct{}
type Field ¶
type Field struct {
Desc string
GoName string // 例如, “ 字段Name”
GoIdent GoIdent // 例如, “ 邮件Name_ fieldName”
Parent *Message // 声明此字段的信息; 如果最高扩展
Oneof *Oneof // 含有; 如果不是其中之一的一部分,则无
Extendee *Message // 扩展字段的扩展消息;其他无
Enum *Enum // 输入字段的类型类型; 无效
Message *Message // 用于信件或组字段或组字段的类型;否则为零
Location Location // 此字段位置
Comments CommentSet // 与此字段相关的评论意见
}
type FieldNumber ¶
type FieldNumber string
type File ¶
type File struct {
GoDescriptorIdent GoIdent // 文件描述符的 Go 名称变量
GoPackageName GoPackageName // 此文件的 Go 软件包的名称
GoImportPath GoImportPath // 此文件的 Go 软件包导入路径
Enums []*Enum // 高层全体全体宣言
Messages []*Message // 最高一级信息公告
Extensions []*Extension // 最高一级延期声明
Services []*Service // 最高一级服务
Generate bool // 如果我们为此文件生成代码, 是否真实
// 生成的FilenamePrefix 用于构建与此源文件相关的生成文件的文件名。 例如, 源文件“ dir/ foo. proto” 可能有“ dir/ foo” 的文件名前缀。 附加的“. pb.go” 产生一个“ dir/ foo. pb.go. ” 输出文件 。
// files associated with this source file.
//
// For example, the source file "dir/foo.proto" might have a filename prefix
// of "dir/foo". Appending ".pb.go" produces an output file of "dir/foo.pb.go".
GeneratedFilenamePrefix string
// contains filtered or unexported fields
}
type GeneratedCodeInfo ¶
type GeneratedCodeInfo struct{}
type GeneratedFile ¶
type GeneratedFile struct {
// contains filtered or unexported fields
}
func (*GeneratedFile) Annotate ¶
func (g *GeneratedFile) Annotate(symbol string, loc Location)
func (*GeneratedFile) AnnotateSymbol ¶
func (g *GeneratedFile) AnnotateSymbol(symbol string, info Annotation)
func (*GeneratedFile) Content ¶
func (g *GeneratedFile) Content() ([]byte, error)
func (*GeneratedFile) Import ¶
func (g *GeneratedFile) Import(importPath GoImportPath)
func (*GeneratedFile) P ¶
func (g *GeneratedFile) P(v ...interface{})
func (*GeneratedFile) QualifiedGoIdent ¶
func (g *GeneratedFile) QualifiedGoIdent(ident GoIdent) string
func (*GeneratedFile) Skip ¶
func (g *GeneratedFile) Skip()
func (*GeneratedFile) Unskip ¶
func (g *GeneratedFile) Unskip()
type GoIdent ¶
type GoIdent struct {
GoName string
GoImportPath GoImportPath
}
type GoImportPath ¶
type GoImportPath string
func (GoImportPath) Ident ¶
func (p GoImportPath) Ident(s string) GoIdent
func (GoImportPath) String ¶
func (p GoImportPath) String() string
type GoPackageName ¶
type GoPackageName string
type Options ¶
type Options struct {
ParamFunc func(name, value string) error
ImportRewriteFunc func(GoImportPath) GoImportPath
}
type Plugin ¶
type Plugin struct {
// 请求是原程序提供的代码操作请求 。
Request string
// 文件是要生成的文件集及其导入的所有文件集。 文件以表层顺序显示, 所以每个文件都出现在任何导入文件之前 。
// Files appear in topological order, so each file appears before any
// file that imports it.
Files []*File
FilesByPath map[string]*File
SupportedFeatures uint64
// contains filtered or unexported fields
}
func (*Plugin) NewGeneratedFile ¶
func (gen *Plugin) NewGeneratedFile(filename string, goImportPath GoImportPath) *GeneratedFile
Click to show internal directories.
Click to hide internal directories.