Documentation
¶
Overview ¶
Package compiler creates FileDescriptorSets from a *.proto input and FileDescriptors for *parser.Proto input. It is assumed that the parse result is semantically correct and would compile with protoc.
Index ¶
- func Compile(files, importPaths []string, includeImports bool) (*pb.FileDescriptorSet, error)
- func MapEntryField(name string, number int32, t *parser.Type, scope []string, types *types) *pb.FieldDescriptorProto
- type Registry
- func (f *Registry) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
- func (f *Registry) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
- func (f *Registry) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)
- func (f *Registry) FindMessageByURL(url string) (protoreflect.MessageType, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
func Compile(files, importPaths []string, includeImports bool) (*pb.FileDescriptorSet, error)
Compile creates a FileDescriptorSet similar to protoc:
protoc -o filedescriptorset.pb -I importPath1 -I importPath2 --include_imports file1.proto file2.proto
A FileDescriptorSet contains an array of FileDescriptorProtos, each of which a proto representation of the source proto files. The FileDescriptorSet is the intermediary representation typically passed to proto plugins.
func MapEntryField ¶
Types ¶
type Registry ¶
type Registry struct {
protoregistry.Files
}
func NewRegistry ¶
func NewRegistry(fds *descriptorpb.FileDescriptorSet) (*Registry, error)
func (*Registry) FindExtensionByName ¶
func (f *Registry) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
FindExtensionByName implements protoregistry.ExtensionTypeResolver.
func (*Registry) FindExtensionByNumber ¶
func (f *Registry) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
FindExtensionByNumber implements protoregistry.ExtensionTypeResolver.
func (*Registry) FindMessageByName ¶
func (f *Registry) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)
FindMessageByName implements protoregistry.MessageTypeResolver.
func (*Registry) FindMessageByURL ¶
func (f *Registry) FindMessageByURL(url string) (protoreflect.MessageType, error)
FindMessageByURL implements protoregistry.MessageTypeResolver.