Documentation
¶
Overview ¶
Package protogenlite provides a minimal protoc plugin model for generators that only need file/service/method metadata and Go import qualification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
Proto *descriptorpb.FileDescriptorProto
Desc *FileDesc
Generate bool
GoImportPath GoImportPath
GoPackageName string
GeneratedFilenamePrefix string
Messages []*Message
Services []*Service
}
File stores the minimal generated view of a proto file.
type FileDesc ¶
type FileDesc struct {
// contains filtered or unexported fields
}
FileDesc exposes the minimal file descriptor helpers used by generators.
type GeneratedFile ¶
type GeneratedFile struct {
// contains filtered or unexported fields
}
GeneratedFile accumulates a generated Go source file.
func (*GeneratedFile) Content ¶
func (g *GeneratedFile) Content() ([]byte, error)
Content returns the generated file contents.
func (*GeneratedFile) P ¶
func (g *GeneratedFile) P(args ...any)
P appends a line to the generated output.
func (*GeneratedFile) QualifiedGoIdent ¶
func (g *GeneratedFile) QualifiedGoIdent(id GoIdent) string
QualifiedGoIdent returns the identifier qualified for the current file.
type GoIdent ¶
type GoIdent struct {
GoName string
GoImportPath GoImportPath
}
GoIdent identifies a Go name within a package.
type GoImportPath ¶
type GoImportPath string
GoImportPath identifies a Go package import path.
func (GoImportPath) Ident ¶
func (p GoImportPath) Ident(name string) GoIdent
Ident constructs a Go identifier in the import path.
type Message ¶
type Message struct {
Proto *descriptorpb.DescriptorProto
File *File
FullName string
GoName string
GoIdent GoIdent
Messages []*Message
}
Message stores the minimal generated view of a proto message.
type Method ¶
type Method struct {
Proto *descriptorpb.MethodDescriptorProto
Parent *Service
Desc *MethodDesc
GoName string
Input *Message
Output *Message
Comments Comments
}
Method stores the minimal generated view of a proto method.
type MethodDesc ¶
type MethodDesc struct {
// contains filtered or unexported fields
}
MethodDesc exposes the minimal method descriptor helpers used by generators.
func (*MethodDesc) IsStreamingClient ¶
func (d *MethodDesc) IsStreamingClient() bool
IsStreamingClient reports whether the method accepts a client stream.
func (*MethodDesc) IsStreamingServer ¶
func (d *MethodDesc) IsStreamingServer() bool
IsStreamingServer reports whether the method returns a server stream.
type Plugin ¶
type Plugin struct {
Request *pluginpb.CodeGeneratorRequest
Files []*File
SupportedFeatures uint64
SupportedEditionsMinimum descriptorpb.Edition
SupportedEditionsMaximum descriptorpb.Edition
// contains filtered or unexported fields
}
Plugin stores a protoc plugin invocation.
func (*Plugin) NewGeneratedFile ¶
func (p *Plugin) NewGeneratedFile(filename string, importPath GoImportPath) *GeneratedFile
NewGeneratedFile allocates a generated file in the plugin response.
func (*Plugin) Response ¶
func (p *Plugin) Response() *pluginpb.CodeGeneratorResponse
Response builds the code generator response.
type Service ¶
type Service struct {
Proto *descriptorpb.ServiceDescriptorProto
File *File
Desc *ServiceDesc
GoName string
Methods []*Method
Comments Comments
}
Service stores the minimal generated view of a proto service.
type ServiceDesc ¶
type ServiceDesc struct {
// contains filtered or unexported fields
}
ServiceDesc exposes the minimal service descriptor helpers used by generators.
func (*ServiceDesc) FullName ¶
func (d *ServiceDesc) FullName() string
FullName returns the fully-qualified proto service name.