Documentation
¶
Overview ¶
Package protodesc provides for converting descriptorpb.FileDescriptorProto to/from the reflective protoreflect.FileDescriptor.
Copyright 2019 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- func NewFile(fd *descriptorpb.FileDescriptorProto, r *protoregistry.Files) (protoreflect.FileDescriptor, error)
- func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto
- func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto
- func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto
- func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto
- func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto
- func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto
- func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto
- func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFile ¶
func NewFile(fd *descriptorpb.FileDescriptorProto, r *protoregistry.Files) (protoreflect.FileDescriptor, error)
NewFile creates a new protoreflect.FileDescriptor from the provided file descriptor message. The file must represent a valid proto file according to protobuf semantics.
Any import files, enum types, or message types referenced in the file are resolved using the provided registry. When looking up an import file path, the path must be unique. The newly created file descriptor is not registered back into the provided file registry.
The caller must relinquish full ownership of the input fd and must not access or mutate any fields.
func ToDescriptorProto ¶
func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto
ToDescriptorProto converts a MessageDescriptor to a google.protobuf.DescriptorProto.
func ToEnumDescriptorProto ¶
func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto
ToEnumDescriptorProto converts a EnumDescriptor to a google.protobuf.EnumDescriptorProto.
func ToEnumValueDescriptorProto ¶
func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto
ToEnumValueDescriptorProto converts a EnumValueDescriptor to a google.protobuf.EnumValueDescriptorProto.
func ToFieldDescriptorProto ¶
func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto
ToFieldDescriptorProto converts a FieldDescriptor to a google.protobuf.FieldDescriptorProto.
func ToFileDescriptorProto ¶
func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto
ToFileDescriptorProto converts a FileDescriptor to a google.protobuf.FileDescriptorProto.
func ToMethodDescriptorProto ¶
func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto
ToMethodDescriptorProto converts a MethodDescriptor to a google.protobuf.MethodDescriptorProto.
func ToOneofDescriptorProto ¶
func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto
ToOneofDescriptorProto converts a OneofDescriptor to a google.protobuf.OneofDescriptorProto.
func ToServiceDescriptorProto ¶
func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto
ToServiceDescriptorProto converts a ServiceDescriptor to a google.protobuf.ServiceDescriptorProto.
Types ¶
This section is empty.