compiler

package
v0.0.0-...-020c65a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

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

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

func MapEntryField(name string, number int32, t *parser.Type, scope []string, types *types) *pb.FieldDescriptorProto

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL