Documentation
¶
Index ¶
- Variables
- func GetDescriptorText(dsc desc.Descriptor, _ DescriptorSource) (string, error)
- type DescriptorSource
- func DescriptorSourceFromFileDescriptorSet(files *descpb.FileDescriptorSet) (DescriptorSource, error)
- func DescriptorSourceFromFileDescriptors(files ...*desc.FileDescriptor) (DescriptorSource, error)
- func DescriptorSourceFromProtoFiles(importPaths []string, fileNames ...string) (DescriptorSource, error)
- func DescriptorSourceFromProtoSets(fileNames ...string) (DescriptorSource, error)
Constants ¶
This section is empty.
Variables ¶
var ErrReflectionNotSupported = errors.New("server does not support the reflection API")
ErrReflectionNotSupported is returned by DescriptorSource operations that rely on interacting with the reflection service when the source does not actually expose the reflection service. When this occurs, an alternate source (like file descriptor sets) must be used.
Functions ¶
func GetDescriptorText ¶
func GetDescriptorText(dsc desc.Descriptor, _ DescriptorSource) (string, error)
GetDescriptorText returns a string representation of the given descriptor. This returns a snippet of proto source that describes the given element.
Types ¶
type DescriptorSource ¶
type DescriptorSource interface { // ListServices returns a list of fully-qualified service names. It will be all services in a set of // descriptor files or the set of all services exposed by a gRPC server. ListServices() ([]string, error) // FindSymbol returns a descriptor for the given fully-qualified symbol name. FindSymbol(fullyQualifiedName string) (desc.Descriptor, error) // AllExtensionsForType returns all known extension fields that extend the given message type name. AllExtensionsForType(typeName string) ([]*desc.FieldDescriptor, error) Files() map[string]*desc.FileDescriptor }
DescriptorSource is a source of protobuf descriptor information. It can be backed by a FileDescriptorSet proto (like a file generated by protoc) or a remote server that supports the reflection API.
func DescriptorSourceFromFileDescriptorSet ¶
func DescriptorSourceFromFileDescriptorSet(files *descpb.FileDescriptorSet) (DescriptorSource, error)
DescriptorSourceFromFileDescriptorSet creates a DescriptorSource that is backed by the FileDescriptorSet.
func DescriptorSourceFromFileDescriptors ¶
func DescriptorSourceFromFileDescriptors(files ...*desc.FileDescriptor) (DescriptorSource, error)
DescriptorSourceFromFileDescriptors creates a DescriptorSource that is backed by the given file descriptors
func DescriptorSourceFromProtoFiles ¶
func DescriptorSourceFromProtoFiles(importPaths []string, fileNames ...string) (DescriptorSource, error)
DescriptorSourceFromProtoFiles creates a DescriptorSource that is backed by the named files, whose contents are Protocol Buffer source files. The given importPaths are used to locate any imported files.
func DescriptorSourceFromProtoSets ¶
func DescriptorSourceFromProtoSets(fileNames ...string) (DescriptorSource, error)
DescriptorSourceFromProtoSets creates a DescriptorSource that is backed by the named files, whose contents are encoded FileDescriptorSet protos.