descutil

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package descutil contains utility functions for protobuf descriptor messages.

Index

Constants

View Source
const (
	// FileDescriptorProtoPackageTag is the number of package field
	// in FileDescriptorProto message.
	FileDescriptorProtoPackageTag = 2
	// FileDescriptorProtoMessageTag is the number of message field
	// in FileDescriptorProto message.
	FileDescriptorProtoMessageTag = 4
	// FileDescriptorProtoEnumTag is the number of enum field
	// in FileDescriptorProto message.
	FileDescriptorProtoEnumTag = 5
	// FileDescriptorProtoServiceTag is the number of service field
	// in FileDescriptorProto message.
	FileDescriptorProtoServiceTag = 6

	// ServiceDescriptorProtoMethodTag is the number of method field
	// in ServiceDescriptorProto message.
	ServiceDescriptorProtoMethodTag = 2

	// DescriptorProtoFieldTag is the number of field field
	// in DescriptorProto message.
	DescriptorProtoFieldTag = 2
	// DescriptorProtoNestedTypeTag is the number of nested_type field
	// in DescriptorProto message.
	DescriptorProtoNestedTypeTag = 3
	// DescriptorProtoEnumTypeTag is the number of enum_type field
	// in DescriptorProto message.
	DescriptorProtoEnumTypeTag = 4
	// DescriptorProtoOneOfTag is the number of oneof_decl field
	// in DescriptorProto message.
	DescriptorProtoOneOfTag = 8

	// EnumDescriptorProtoValueTag is the number of value field
	// in EnumDescriptorProto message.
	EnumDescriptorProtoValueTag = 2
)

These constnats correspond to tag values in the respective "descriptor.proto" message types. These constants' tag matches are asserted in the "TestTagsMatchProto" unit test.

Variables

This section is empty.

Functions

func FindEnum

func FindEnum(d *pb.DescriptorProto, name string) int

FindEnum searches for a nested EnumDescriptorProto by name.

func FindEnumForFile

func FindEnumForFile(f *pb.FileDescriptorProto, name string) int

FindEnumForFile searches for an EnumDescriptorProto by name.

func FindEnumValue

func FindEnumValue(e *pb.EnumDescriptorProto, name string) int

FindEnumValue searches for an EnumValueDescriptorProto by name.

func FindField

func FindField(d *pb.DescriptorProto, name string) int

FindField searches for a FieldDescriptorProto by name.

func FindFile

func FindFile(s *pb.FileDescriptorSet, name string) int

FindFile searches for a FileDescriptorProto by name.

func FindLocation

func FindLocation(s *pb.SourceCodeInfo, path []int) *pb.SourceCodeInfo_Location

FindLocation searches for a location by path.

func FindMessage

func FindMessage(d *pb.DescriptorProto, name string) int

FindMessage searches for a nested DescriptorProto by name.

func FindMessageForFile

func FindMessageForFile(f *pb.FileDescriptorProto, name string) int

FindMessageForFile searches for a DescriptorProto by name.

func FindMethodForService

func FindMethodForService(s *pb.ServiceDescriptorProto, name string) int

FindMethodForService searches for a MethodDescriptorProto by name.

func FindOneOf

func FindOneOf(d *pb.DescriptorProto, name string) int

FindOneOf searches for a nested OneofDescriptorProto by name.

func FindService

func FindService(s *pb.FileDescriptorSet, fullName string) (file *pb.FileDescriptorProto, serviceIndex int)

FindService searches for a service by full name.

func FindServiceForFile

func FindServiceForFile(f *pb.FileDescriptorProto, name string) int

FindServiceForFile searches for a FileDescriptorProto by name.

func FindValueByNumber

func FindValueByNumber(e *pb.EnumDescriptorProto, number int32) int

FindValueByNumber searches for an EnumValueDescriptorProto by number.

func Repeated

func Repeated(f *pb.FieldDescriptorProto) bool

Repeated returns true if the field is repeated.

func Resolve

func Resolve(s *pb.FileDescriptorSet, fullName string) (file *pb.FileDescriptorProto, obj interface{}, path []int)

Resolve searches for an object by full name. obj can be one of *ServiceDescriptorProto, *MethodDescriptorProto, *DescriptorProto, *FieldDescriptorProto, *DescriptorProto, *EnumDescriptorProto, *EnumValueDescriptorProto or nil

For path, see comment in SourceCodeInfo message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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