![]() Methods.go proto.go source.go source_gen.go type.go value.go value_equal.go value_union.go value_unsafe.go type Cardinality ¶ func (p1 SourcePath) Equal(p2 SourcePath) bool.func (n FullName) Append(s Name) FullName.May not always be an ExtensionTypeDescriptor. An ExtensionDescriptor describes an abstract protobuf extension field and.An ExtensionTypeDescriptor is an ExtensionDescriptor.It has an ExtensionTypeDescriptor and can convert to/from An ExtensionType describes a concrete Go implementation of an extension.║ ExtensionType ║ ║ ExtensionTypeDescriptor ║ ║ ExtensionDescriptor ║ ![]() Using Go reflection as an analogy, the ProtoReflect method is similar toĬalling reflect.ValueOf, and the Message.Interface method is similar to Just as how Go's reflect.Value is a reflective view over a Go value,Ī Message is a reflective view over a concrete protobuf message instance. Generated messages implement ProtoMessage, which can convert to a Message. A Message is a reflective view over a concrete message instance.Or constructing a dynamic MessageType using dynamicpb.NewMessageType. In order to construct a MessageTypeįrom just a MessageDescriptor, you can consider looking up the message type A MessageDescriptor describes an abstract protobuf message type.Just as how Go's reflect.Type is a reflective description of a Go type,Ī MessageType is a reflective description of a Go type for a protobuf message. It has a MessageDescriptor and can construct a Message instance. A MessageType describes a concrete Go message type.║ MessageType ║ ║ MessageDescriptor ║ ║ Message ║ ║ ProtoMessage ║ An EnumDescriptor describes an abstract protobuf enum type.It has an EnumDescriptor and can construct an Enum instance. An EnumType describes a concrete Go enum type. ![]() ║ EnumType ║ ║ EnumDescriptor ║ ║ Enum ║ ║ EnumNumber ║ ![]() The following diagrams demonstrate the relationships between To obtain a reflective view on older messages. The "/golang/protobuf/proto".MessageReflect function can be used V2 message interface, it may not be present on older message implementations. Since the ProtoReflect method is new to the To convert a proto.Message to a protoreflect.Message, use theįormer's ProtoReflect method. The ability to access or manipulate fields of the message. The enum value number for any concrete enum type. For enums, it provides the ability to retrieve The Enum and Message interfaces provide a reflective view over anĮnum or message instance. The "/protobuf/types/dynamicpb" package can be used toĬreate Go type descriptors from protobuf descriptors. Where the Type and ProtoReflect.Type accessors respectively Go type descriptors, but it can potentially be a one-to-many relationship. There is commonly a one-to-one relationship between protobuf descriptors and messages and protobuf descriptors.Ī type descriptor (e.g., EnumType or MessageType) is a constructor forĪ concrete Go type that represents the associated protobuf descriptor. The "/protobuf/reflect/protodesc" package converts between User code since they might need to be extended in the future to support The protobuf descriptor interfaces are not meant to be implemented by Return the protobuf descriptor for the values. Where the Descriptor and ProtoReflect.Descriptor accessors respectively Protobuf descriptors alone lack any information regarding Go types.Įnums and messages generated by this module implement Enum and ProtoMessage, They are wrappers around the messages declared in descriptor.proto. Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor)Īre immutable objects that represent protobuf type information. This package includes type descriptors which describe the structure of typesĭefined in proto source files and value interfaces which provide theĪbility to examine and manipulate the contents of messages. Package protoreflect provides interfaces to dynamically manipulate messages. protobuf / reflect / protoreflect Index | Files package protoreflect
0 Comments
Leave a Reply. |