Documentation ¶
Overview ¶
Package registry provides a type on top of protoregistry.Files that can be used as a protoregistry.ExtensionTypeResolver and a protoregistry.MessageTypeResolver. This allows a protoregistry.Files to be used as Resolver for protobuf encoding marshaling options.
Index ¶
- func AddDynamicTypes(t *protoregistry.Types, fds *descriptorpb.FileDescriptorSet) error
- func CloneTypes(in *protoregistry.Types) *protoregistry.Types
- type Files
- func (f *Files) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
- func (f *Files) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
- func (f *Files) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)
- func (f *Files) FindMessageByURL(url string) (protoreflect.MessageType, error)
- func (f *Files) GetExtensionsOfMessage(message protoreflect.FullName) []protoreflect.ExtensionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDynamicTypes ¶ added in v0.0.16
func AddDynamicTypes(t *protoregistry.Types, fds *descriptorpb.FileDescriptorSet) error
AddDynamicTypes adds dynamicpb types to the given Types registry for all Messages, Enums and Extensions in the given FileDescriptorSet. If a type already exists in the Types registry, the dynamic type will not be added to replace it, and instead will be ignored.
func CloneTypes ¶ added in v0.0.16
func CloneTypes(in *protoregistry.Types) *protoregistry.Types
CloneTypes returns a clone of the given protoregistry.Types registry. It may panic if any of the messages, enums or extensions in the given registry cannot be added to the clone, however that should never happen.
Types ¶
type Files ¶
type Files struct {
protoregistry.Files
}
func NewFiles ¶
func NewFiles(fds *descriptorpb.FileDescriptorSet) (*Files, error)
func (*Files) FindExtensionByName ¶
func (f *Files) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
func (*Files) FindExtensionByNumber ¶
func (f *Files) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
func (*Files) FindMessageByName ¶
func (f *Files) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)
func (*Files) FindMessageByURL ¶
func (f *Files) FindMessageByURL(url string) (protoreflect.MessageType, error)
func (*Files) GetExtensionsOfMessage ¶
func (f *Files) GetExtensionsOfMessage(message protoreflect.FullName) []protoreflect.ExtensionType