Documentation ¶
Overview ¶
Package pbinfo provides convenience types for looking up protobuf elements.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FullyQualifiedType ¶
fullyQualifiedType constructs a fully-qualified type name suitable for use with pbinfo.Info.
func ReduceServName ¶
ReduceServName removes redundant components from the service name. For example, FooServiceV2 -> Foo. The returned name is used as part of longer names, like FooClient. If the package name and the service name is the same, ReduceServName returns empty string, so we get foo.Client instead of foo.FooClient.
Types ¶
type ImportSpec ¶
type ImportSpec struct {
Name, Path string
}
type Info ¶
type Info struct { // Maps services and messages to the file containing them, // so we can figure out the import. ParentFile map[proto.Message]*descriptor.FileDescriptorProto // Maps a protobuf element to the enclosing scope. // If enum E is defined in message M which is in file F, // ParentElement[E]=M, ParentElement[M]=nil, and ParentFile[M]=F ParentElement map[ProtoType]ProtoType // Maps type names to their messages. Type map[string]ProtoType // Maps service names to their descriptors. Serv map[string]*descriptor.ServiceDescriptorProto }
Info provides lookup tables for various protobuf properties. For example, we can look up a type by name without iterating the entire descriptor.
func Of ¶
func Of(files []*descriptor.FileDescriptorProto) Info
Of creates Info from given protobuf files.
func (*Info) ImportSpec ¶
func (in *Info) ImportSpec(e ProtoType) (ImportSpec, error)
ImportSpec reports the ImportSpec for package containing protobuf element e. Deprecated: Use NameSpec instead.