2018-09-10 12:26:21 -07:00
|
|
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
|
|
// source: proto3/fields.proto
|
|
|
|
|
|
|
|
package proto3
|
|
|
|
|
2018-09-13 13:12:36 -07:00
|
|
|
import (
|
|
|
|
proto "github.com/golang/protobuf/proto"
|
cmd/protoc-gen-go: add support for protobuf reflection
Implement support in protoc-gen-go for generating messages and enums
that satisfy the v2 protobuf reflection interfaces. Specifically, the following
are added:
* top-level variable representing the file descriptor
* ProtoReflect method on enums (to implement protoV2.Enum)
* ProtoReflect method on messages (to implement protoV2.Message)
The following are not supported yet:
* resolving transitive dependencies for file imports
* Extension descriptors
* Service descriptors
The implementation approach creates a single array for all the message and enum
declarations and references sections of that array to complete dependencies.
Since protobuf declarations can form a graph (a message may depend on itself),
it is difficult to construct a graph as a single literal. One way is to use
placeholder descriptors, but that is not efficient as it requires encoding
the full name of each dependent enum and message and then later resolving it;
thus, both expanding the binary size and also increasing initialization cost.
Instead, we add a prototype.{Enum,Message}.Reference method to obtain a
descriptor reference for the purposes for satisfying dependencies.
As such, nested declarations and dependencies are populated in an init function.
Other changes to support the implementation:
* Added a protoimpl package to expose the MessageType type and also the
MessageTypeOf and EnumTypeOf helper functions.
* Added a protogen.File.GoIdent field to provide a suggested variable name
for the file descriptor.
* Added prototype.{Enum,Message}.Reference that provides a descriptor reference
for the purposes for satisfying cyclic dependencies.
* Added protoreflect.{Syntax,Cardinality,Kind}.GoString to obtain a Go source
identifier that represents the given constant.
Change-Id: I9455764882dee6ad10f251901e7d419091e8bf1d
Reviewed-on: https://go-review.googlesource.com/c/150074
Reviewed-by: Damien Neil <dneil@google.com>
2018-11-15 14:44:37 -08:00
|
|
|
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
|
|
|
prototype "github.com/golang/protobuf/v2/reflect/prototype"
|
|
|
|
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
2018-09-13 13:12:36 -07:00
|
|
|
)
|
|
|
|
|
2018-09-12 11:13:49 -07:00
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
|
|
// is compatible with the proto package it is being compiled against.
|
|
|
|
// A compilation error at this line likely means your copy of the
|
|
|
|
// proto package needs to be updated.
|
2018-11-26 12:57:27 -08:00
|
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
2018-09-12 11:13:49 -07:00
|
|
|
|
2018-09-10 12:26:21 -07:00
|
|
|
type FieldTestMessage_Enum int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
FieldTestMessage_ZERO FieldTestMessage_Enum = 0
|
|
|
|
)
|
|
|
|
|
cmd/protoc-gen-go: add support for protobuf reflection
Implement support in protoc-gen-go for generating messages and enums
that satisfy the v2 protobuf reflection interfaces. Specifically, the following
are added:
* top-level variable representing the file descriptor
* ProtoReflect method on enums (to implement protoV2.Enum)
* ProtoReflect method on messages (to implement protoV2.Message)
The following are not supported yet:
* resolving transitive dependencies for file imports
* Extension descriptors
* Service descriptors
The implementation approach creates a single array for all the message and enum
declarations and references sections of that array to complete dependencies.
Since protobuf declarations can form a graph (a message may depend on itself),
it is difficult to construct a graph as a single literal. One way is to use
placeholder descriptors, but that is not efficient as it requires encoding
the full name of each dependent enum and message and then later resolving it;
thus, both expanding the binary size and also increasing initialization cost.
Instead, we add a prototype.{Enum,Message}.Reference method to obtain a
descriptor reference for the purposes for satisfying dependencies.
As such, nested declarations and dependencies are populated in an init function.
Other changes to support the implementation:
* Added a protoimpl package to expose the MessageType type and also the
MessageTypeOf and EnumTypeOf helper functions.
* Added a protogen.File.GoIdent field to provide a suggested variable name
for the file descriptor.
* Added prototype.{Enum,Message}.Reference that provides a descriptor reference
for the purposes for satisfying cyclic dependencies.
* Added protoreflect.{Syntax,Cardinality,Kind}.GoString to obtain a Go source
identifier that represents the given constant.
Change-Id: I9455764882dee6ad10f251901e7d419091e8bf1d
Reviewed-on: https://go-review.googlesource.com/c/150074
Reviewed-by: Damien Neil <dneil@google.com>
2018-11-15 14:44:37 -08:00
|
|
|
type xxx_FieldTestMessage_Enum FieldTestMessage_Enum
|
|
|
|
|
|
|
|
func (e FieldTestMessage_Enum) ProtoReflect() protoreflect.Enum {
|
|
|
|
return (xxx_FieldTestMessage_Enum)(e)
|
|
|
|
}
|
|
|
|
func (e xxx_FieldTestMessage_Enum) Type() protoreflect.EnumType {
|
|
|
|
return xxx_Fields_ProtoFile_EnumTypes[0]
|
|
|
|
}
|
|
|
|
func (e xxx_FieldTestMessage_Enum) Number() protoreflect.EnumNumber {
|
|
|
|
return protoreflect.EnumNumber(e)
|
|
|
|
}
|
|
|
|
|
2018-09-10 12:26:21 -07:00
|
|
|
var FieldTestMessage_Enum_name = map[int32]string{
|
|
|
|
0: "ZERO",
|
|
|
|
}
|
|
|
|
|
|
|
|
var FieldTestMessage_Enum_value = map[string]int32{
|
|
|
|
"ZERO": 0,
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x FieldTestMessage_Enum) String() string {
|
|
|
|
return proto.EnumName(FieldTestMessage_Enum_name, int32(x))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (FieldTestMessage_Enum) EnumDescriptor() ([]byte, []int) {
|
|
|
|
return fileDescriptor_f1e3ea068187307c, []int{0, 0}
|
|
|
|
}
|
|
|
|
|
|
|
|
type FieldTestMessage struct {
|
2018-09-13 15:07:10 -07:00
|
|
|
OptionalBool string `protobuf:"bytes,1,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"`
|
|
|
|
OptionalEnum FieldTestMessage_Enum `protobuf:"varint,2,opt,name=optional_enum,json=optionalEnum,proto3,enum=goproto.protoc.proto3.FieldTestMessage_Enum" json:"optional_enum,omitempty"`
|
|
|
|
OptionalInt32 int32 `protobuf:"varint,3,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"`
|
|
|
|
OptionalSint32 int32 `protobuf:"zigzag32,4,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"`
|
|
|
|
OptionalUint32 uint32 `protobuf:"varint,5,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"`
|
|
|
|
OptionalInt64 int64 `protobuf:"varint,6,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"`
|
|
|
|
OptionalSint64 int64 `protobuf:"zigzag64,7,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"`
|
|
|
|
OptionalUint64 uint64 `protobuf:"varint,8,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"`
|
|
|
|
OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"`
|
|
|
|
OptionalFixed32 uint32 `protobuf:"fixed32,10,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"`
|
|
|
|
OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"`
|
|
|
|
OptionalSfixed64 int64 `protobuf:"fixed64,12,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"`
|
|
|
|
OptionalFixed64 uint64 `protobuf:"fixed64,13,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"`
|
|
|
|
OptionalDouble float64 `protobuf:"fixed64,14,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"`
|
|
|
|
OptionalString string `protobuf:"bytes,15,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"`
|
|
|
|
OptionalBytes []byte `protobuf:"bytes,16,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"`
|
|
|
|
Optional_Message *FieldTestMessage_Message `protobuf:"bytes,17,opt,name=optional_Message,json=optionalMessage,proto3" json:"optional_Message,omitempty"`
|
2018-09-19 11:43:35 -07:00
|
|
|
RepeatedBool []bool `protobuf:"varint,201,rep,packed,name=repeated_bool,json=repeatedBool,proto3" json:"repeated_bool,omitempty"`
|
|
|
|
RepeatedEnum []FieldTestMessage_Enum `protobuf:"varint,202,rep,packed,name=repeated_enum,json=repeatedEnum,proto3,enum=goproto.protoc.proto3.FieldTestMessage_Enum" json:"repeated_enum,omitempty"`
|
|
|
|
RepeatedInt32 []int32 `protobuf:"varint,203,rep,packed,name=repeated_int32,json=repeatedInt32,proto3" json:"repeated_int32,omitempty"`
|
|
|
|
RepeatedSint32 []int32 `protobuf:"zigzag32,204,rep,packed,name=repeated_sint32,json=repeatedSint32,proto3" json:"repeated_sint32,omitempty"`
|
|
|
|
RepeatedUint32 []uint32 `protobuf:"varint,205,rep,packed,name=repeated_uint32,json=repeatedUint32,proto3" json:"repeated_uint32,omitempty"`
|
|
|
|
RepeatedInt64 []int64 `protobuf:"varint,206,rep,packed,name=repeated_int64,json=repeatedInt64,proto3" json:"repeated_int64,omitempty"`
|
|
|
|
RepeatedSint64 []int64 `protobuf:"zigzag64,207,rep,packed,name=repeated_sint64,json=repeatedSint64,proto3" json:"repeated_sint64,omitempty"`
|
|
|
|
RepeatedUint64 []uint64 `protobuf:"varint,208,rep,packed,name=repeated_uint64,json=repeatedUint64,proto3" json:"repeated_uint64,omitempty"`
|
|
|
|
RepeatedSfixed32 []int32 `protobuf:"fixed32,209,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32,proto3" json:"repeated_sfixed32,omitempty"`
|
|
|
|
RepeatedFixed32 []uint32 `protobuf:"fixed32,210,rep,packed,name=repeated_fixed32,json=repeatedFixed32,proto3" json:"repeated_fixed32,omitempty"`
|
|
|
|
RepeatedFloat []float32 `protobuf:"fixed32,211,rep,packed,name=repeated_float,json=repeatedFloat,proto3" json:"repeated_float,omitempty"`
|
|
|
|
RepeatedSfixed64 []int64 `protobuf:"fixed64,212,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64,proto3" json:"repeated_sfixed64,omitempty"`
|
|
|
|
RepeatedFixed64 []uint64 `protobuf:"fixed64,213,rep,packed,name=repeated_fixed64,json=repeatedFixed64,proto3" json:"repeated_fixed64,omitempty"`
|
|
|
|
RepeatedDouble []float64 `protobuf:"fixed64,214,rep,packed,name=repeated_double,json=repeatedDouble,proto3" json:"repeated_double,omitempty"`
|
|
|
|
RepeatedString []string `protobuf:"bytes,215,rep,name=repeated_string,json=repeatedString,proto3" json:"repeated_string,omitempty"`
|
|
|
|
RepeatedBytes [][]byte `protobuf:"bytes,216,rep,name=repeated_bytes,json=repeatedBytes,proto3" json:"repeated_bytes,omitempty"`
|
|
|
|
Repeated_Message []*FieldTestMessage_Message `protobuf:"bytes,217,rep,name=repeated_Message,json=repeatedMessage,proto3" json:"repeated_Message,omitempty"`
|
2018-09-13 15:07:10 -07:00
|
|
|
MapInt32Int64 map[int32]int64 `protobuf:"bytes,500,rep,name=map_int32_int64,json=mapInt32Int64,proto3" json:"map_int32_int64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
|
|
|
MapStringMessage map[string]*FieldTestMessage_Message `protobuf:"bytes,501,rep,name=map_string_message,json=mapStringMessage,proto3" json:"map_string_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
|
|
MapFixed64Enum map[uint64]FieldTestMessage_Enum `protobuf:"bytes,502,rep,name=map_fixed64_enum,json=mapFixed64Enum,proto3" json:"map_fixed64_enum,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=goproto.protoc.proto3.FieldTestMessage_Enum"`
|
|
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
|
|
XXX_unrecognized []byte `json:"-"`
|
|
|
|
XXX_sizecache int32 `json:"-"`
|
2018-09-10 12:26:21 -07:00
|
|
|
}
|
|
|
|
|
cmd/protoc-gen-go: add support for protobuf reflection
Implement support in protoc-gen-go for generating messages and enums
that satisfy the v2 protobuf reflection interfaces. Specifically, the following
are added:
* top-level variable representing the file descriptor
* ProtoReflect method on enums (to implement protoV2.Enum)
* ProtoReflect method on messages (to implement protoV2.Message)
The following are not supported yet:
* resolving transitive dependencies for file imports
* Extension descriptors
* Service descriptors
The implementation approach creates a single array for all the message and enum
declarations and references sections of that array to complete dependencies.
Since protobuf declarations can form a graph (a message may depend on itself),
it is difficult to construct a graph as a single literal. One way is to use
placeholder descriptors, but that is not efficient as it requires encoding
the full name of each dependent enum and message and then later resolving it;
thus, both expanding the binary size and also increasing initialization cost.
Instead, we add a prototype.{Enum,Message}.Reference method to obtain a
descriptor reference for the purposes for satisfying dependencies.
As such, nested declarations and dependencies are populated in an init function.
Other changes to support the implementation:
* Added a protoimpl package to expose the MessageType type and also the
MessageTypeOf and EnumTypeOf helper functions.
* Added a protogen.File.GoIdent field to provide a suggested variable name
for the file descriptor.
* Added prototype.{Enum,Message}.Reference that provides a descriptor reference
for the purposes for satisfying cyclic dependencies.
* Added protoreflect.{Syntax,Cardinality,Kind}.GoString to obtain a Go source
identifier that represents the given constant.
Change-Id: I9455764882dee6ad10f251901e7d419091e8bf1d
Reviewed-on: https://go-review.googlesource.com/c/150074
Reviewed-by: Damien Neil <dneil@google.com>
2018-11-15 14:44:37 -08:00
|
|
|
type xxx_FieldTestMessage struct{ m *FieldTestMessage }
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) ProtoReflect() protoreflect.Message {
|
|
|
|
return xxx_FieldTestMessage{m}
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage) Type() protoreflect.MessageType {
|
|
|
|
return xxx_Fields_ProtoFile_MessageTypes[0].Type
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage) KnownFields() protoreflect.KnownFields {
|
|
|
|
return xxx_Fields_ProtoFile_MessageTypes[0].KnownFieldsOf(m.m)
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage) UnknownFields() protoreflect.UnknownFields {
|
|
|
|
return xxx_Fields_ProtoFile_MessageTypes[0].UnknownFieldsOf(m.m)
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage) Interface() protoreflect.ProtoMessage {
|
|
|
|
return m.m
|
|
|
|
}
|
|
|
|
|
2018-09-12 13:36:34 -07:00
|
|
|
func (m *FieldTestMessage) Reset() { *m = FieldTestMessage{} }
|
|
|
|
func (m *FieldTestMessage) String() string { return proto.CompactTextString(m) }
|
|
|
|
func (*FieldTestMessage) ProtoMessage() {}
|
|
|
|
func (*FieldTestMessage) Descriptor() ([]byte, []int) {
|
|
|
|
return fileDescriptor_f1e3ea068187307c, []int{0}
|
|
|
|
}
|
2018-09-14 15:41:11 -07:00
|
|
|
|
2018-09-12 13:36:34 -07:00
|
|
|
func (m *FieldTestMessage) XXX_Unmarshal(b []byte) error {
|
|
|
|
return xxx_messageInfo_FieldTestMessage.Unmarshal(m, b)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
|
|
return xxx_messageInfo_FieldTestMessage.Marshal(b, m, deterministic)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage) XXX_Merge(src proto.Message) {
|
|
|
|
xxx_messageInfo_FieldTestMessage.Merge(m, src)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage) XXX_Size() int {
|
|
|
|
return xxx_messageInfo_FieldTestMessage.Size(m)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage) XXX_DiscardUnknown() {
|
|
|
|
xxx_messageInfo_FieldTestMessage.DiscardUnknown(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
var xxx_messageInfo_FieldTestMessage proto.InternalMessageInfo
|
|
|
|
|
2018-09-13 10:59:17 -07:00
|
|
|
func (m *FieldTestMessage) GetOptionalBool() string {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalBool
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalEnum() FieldTestMessage_Enum {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalEnum
|
|
|
|
}
|
|
|
|
return FieldTestMessage_ZERO
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalInt32() int32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalInt32
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalSint32() int32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalSint32
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalUint32() uint32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalUint32
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalInt64() int64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalInt64
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalSint64() int64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalSint64
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalUint64() uint64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalUint64
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalSfixed32() int32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalSfixed32
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalFixed32() uint32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalFixed32
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalFloat() float32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalFloat
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalSfixed64() int64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalSfixed64
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalFixed64() uint64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalFixed64
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalDouble() float64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalDouble
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalString() string {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalString
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptionalBytes() []byte {
|
|
|
|
if m != nil {
|
|
|
|
return m.OptionalBytes
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetOptional_Message() *FieldTestMessage_Message {
|
|
|
|
if m != nil {
|
|
|
|
return m.Optional_Message
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-19 11:43:35 -07:00
|
|
|
func (m *FieldTestMessage) GetRepeatedBool() []bool {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedBool
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedEnum() []FieldTestMessage_Enum {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedEnum
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedInt32() []int32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedInt32
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedSint32() []int32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedSint32
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedUint32() []uint32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedUint32
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedInt64() []int64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedInt64
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedSint64() []int64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedSint64
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedUint64() []uint64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedUint64
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedSfixed32() []int32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedSfixed32
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedFixed32() []uint32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedFixed32
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedFloat() []float32 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedFloat
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedSfixed64() []int64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedSfixed64
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedFixed64() []uint64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedFixed64
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedDouble() []float64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedDouble
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedString() []string {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedString
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeatedBytes() [][]byte {
|
|
|
|
if m != nil {
|
|
|
|
return m.RepeatedBytes
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetRepeated_Message() []*FieldTestMessage_Message {
|
|
|
|
if m != nil {
|
|
|
|
return m.Repeated_Message
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-13 15:07:10 -07:00
|
|
|
func (m *FieldTestMessage) GetMapInt32Int64() map[int32]int64 {
|
|
|
|
if m != nil {
|
|
|
|
return m.MapInt32Int64
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetMapStringMessage() map[string]*FieldTestMessage_Message {
|
|
|
|
if m != nil {
|
|
|
|
return m.MapStringMessage
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum {
|
|
|
|
if m != nil {
|
|
|
|
return m.MapFixed64Enum
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-10 12:26:21 -07:00
|
|
|
type FieldTestMessage_Message struct {
|
|
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
|
|
XXX_unrecognized []byte `json:"-"`
|
|
|
|
XXX_sizecache int32 `json:"-"`
|
|
|
|
}
|
|
|
|
|
cmd/protoc-gen-go: add support for protobuf reflection
Implement support in protoc-gen-go for generating messages and enums
that satisfy the v2 protobuf reflection interfaces. Specifically, the following
are added:
* top-level variable representing the file descriptor
* ProtoReflect method on enums (to implement protoV2.Enum)
* ProtoReflect method on messages (to implement protoV2.Message)
The following are not supported yet:
* resolving transitive dependencies for file imports
* Extension descriptors
* Service descriptors
The implementation approach creates a single array for all the message and enum
declarations and references sections of that array to complete dependencies.
Since protobuf declarations can form a graph (a message may depend on itself),
it is difficult to construct a graph as a single literal. One way is to use
placeholder descriptors, but that is not efficient as it requires encoding
the full name of each dependent enum and message and then later resolving it;
thus, both expanding the binary size and also increasing initialization cost.
Instead, we add a prototype.{Enum,Message}.Reference method to obtain a
descriptor reference for the purposes for satisfying dependencies.
As such, nested declarations and dependencies are populated in an init function.
Other changes to support the implementation:
* Added a protoimpl package to expose the MessageType type and also the
MessageTypeOf and EnumTypeOf helper functions.
* Added a protogen.File.GoIdent field to provide a suggested variable name
for the file descriptor.
* Added prototype.{Enum,Message}.Reference that provides a descriptor reference
for the purposes for satisfying cyclic dependencies.
* Added protoreflect.{Syntax,Cardinality,Kind}.GoString to obtain a Go source
identifier that represents the given constant.
Change-Id: I9455764882dee6ad10f251901e7d419091e8bf1d
Reviewed-on: https://go-review.googlesource.com/c/150074
Reviewed-by: Damien Neil <dneil@google.com>
2018-11-15 14:44:37 -08:00
|
|
|
type xxx_FieldTestMessage_Message struct{ m *FieldTestMessage_Message }
|
|
|
|
|
|
|
|
func (m *FieldTestMessage_Message) ProtoReflect() protoreflect.Message {
|
|
|
|
return xxx_FieldTestMessage_Message{m}
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage_Message) Type() protoreflect.MessageType {
|
|
|
|
return xxx_Fields_ProtoFile_MessageTypes[4].Type
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage_Message) KnownFields() protoreflect.KnownFields {
|
|
|
|
return xxx_Fields_ProtoFile_MessageTypes[4].KnownFieldsOf(m.m)
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage_Message) UnknownFields() protoreflect.UnknownFields {
|
|
|
|
return xxx_Fields_ProtoFile_MessageTypes[4].UnknownFieldsOf(m.m)
|
|
|
|
}
|
|
|
|
func (m xxx_FieldTestMessage_Message) Interface() protoreflect.ProtoMessage {
|
|
|
|
return m.m
|
|
|
|
}
|
|
|
|
|
2018-09-12 13:36:34 -07:00
|
|
|
func (m *FieldTestMessage_Message) Reset() { *m = FieldTestMessage_Message{} }
|
|
|
|
func (m *FieldTestMessage_Message) String() string { return proto.CompactTextString(m) }
|
|
|
|
func (*FieldTestMessage_Message) ProtoMessage() {}
|
|
|
|
func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {
|
2018-09-13 15:07:10 -07:00
|
|
|
return fileDescriptor_f1e3ea068187307c, []int{0, 3}
|
2018-09-12 13:36:34 -07:00
|
|
|
}
|
2018-09-14 15:41:11 -07:00
|
|
|
|
2018-09-12 13:36:34 -07:00
|
|
|
func (m *FieldTestMessage_Message) XXX_Unmarshal(b []byte) error {
|
|
|
|
return xxx_messageInfo_FieldTestMessage_Message.Unmarshal(m, b)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
|
|
return xxx_messageInfo_FieldTestMessage_Message.Marshal(b, m, deterministic)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage_Message) XXX_Merge(src proto.Message) {
|
|
|
|
xxx_messageInfo_FieldTestMessage_Message.Merge(m, src)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage_Message) XXX_Size() int {
|
|
|
|
return xxx_messageInfo_FieldTestMessage_Message.Size(m)
|
|
|
|
}
|
|
|
|
func (m *FieldTestMessage_Message) XXX_DiscardUnknown() {
|
|
|
|
xxx_messageInfo_FieldTestMessage_Message.DiscardUnknown(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
var xxx_messageInfo_FieldTestMessage_Message proto.InternalMessageInfo
|
|
|
|
|
2018-09-10 12:26:21 -07:00
|
|
|
func init() {
|
2018-12-05 15:42:52 -08:00
|
|
|
proto.RegisterFile("proto3/fields.proto", fileDescriptor_f1e3ea068187307c)
|
2018-09-19 13:21:58 -07:00
|
|
|
proto.RegisterEnum("goproto.protoc.proto3.FieldTestMessage_Enum", FieldTestMessage_Enum_name, FieldTestMessage_Enum_value)
|
2018-09-13 15:19:08 -07:00
|
|
|
proto.RegisterType((*FieldTestMessage)(nil), "goproto.protoc.proto3.FieldTestMessage")
|
|
|
|
proto.RegisterMapType((map[uint64]FieldTestMessage_Enum)(nil), "goproto.protoc.proto3.FieldTestMessage.MapFixed64EnumEntry")
|
|
|
|
proto.RegisterMapType((map[int32]int64)(nil), "goproto.protoc.proto3.FieldTestMessage.MapInt32Int64Entry")
|
|
|
|
proto.RegisterMapType((map[string]*FieldTestMessage_Message)(nil), "goproto.protoc.proto3.FieldTestMessage.MapStringMessageEntry")
|
|
|
|
proto.RegisterType((*FieldTestMessage_Message)(nil), "goproto.protoc.proto3.FieldTestMessage.Message")
|
2018-09-10 12:26:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var fileDescriptor_f1e3ea068187307c = []byte{
|
2018-09-19 13:21:58 -07:00
|
|
|
// 832 bytes of a gzipped FileDescriptorProto
|
|
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0xc9, 0x6f, 0xdb, 0x38,
|
|
|
|
0x14, 0xc6, 0x87, 0x5e, 0x63, 0xc6, 0x8b, 0xcc, 0x4c, 0x00, 0x22, 0x27, 0x22, 0xb3, 0x71, 0x66,
|
|
|
|
0x12, 0x1b, 0xb0, 0x05, 0x61, 0x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x2a, 0xfc, 0x07, 0xf6, 0x42, 0xb8, 0xbb,
|
|
|
|
0xb6, 0x29, 0xd5, 0xa4, 0xc6, 0x4d, 0x86, 0xaa, 0xc9, 0x15, 0x1e, 0xbc, 0x42, 0x0d, 0xe0, 0xce,
|
|
|
|
0x9a, 0xf6, 0x54, 0x66, 0x85, 0x33, 0x07, 0x2a, 0x73, 0xd3, 0x77, 0xa2, 0x02, 0xac, 0xc1, 0xaa,
|
|
|
|
0xf8, 0x6b, 0x5f, 0x83, 0xa5, 0xf8, 0x1d, 0xb9, 0x05, 0x4b, 0x27, 0x43, 0xf3, 0xae, 0xf6, 0xcb,
|
|
|
|
0xe0, 0xe6, 0xc9, 0x75, 0x67, 0x16, 0x3e, 0x8e, 0x46, 0x9d, 0x71, 0xe0, 0x75, 0x9d, 0xc0, 0xb5,
|
|
|
|
0x7c, 0xa7, 0x1b, 0x3b, 0x8f, 0xa2, 0x69, 0xf7, 0xac, 0xd7, 0x1d, 0x7b, 0x13, 0xbe, 0x1e, 0x1f,
|
|
|
|
0x3a, 0xb6, 0x7f, 0xe8, 0x04, 0xdd, 0xd0, 0x5e, 0x86, 0x13, 0x2b, 0xb4, 0x78, 0xb9, 0x3f, 0xaa,
|
|
|
|
0xf0, 0xeb, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x1c, 0x0b, 0xbf, 0x4a, 0x09, 0x00, 0x00,
|
2018-09-10 12:26:21 -07:00
|
|
|
}
|
cmd/protoc-gen-go: add support for protobuf reflection
Implement support in protoc-gen-go for generating messages and enums
that satisfy the v2 protobuf reflection interfaces. Specifically, the following
are added:
* top-level variable representing the file descriptor
* ProtoReflect method on enums (to implement protoV2.Enum)
* ProtoReflect method on messages (to implement protoV2.Message)
The following are not supported yet:
* resolving transitive dependencies for file imports
* Extension descriptors
* Service descriptors
The implementation approach creates a single array for all the message and enum
declarations and references sections of that array to complete dependencies.
Since protobuf declarations can form a graph (a message may depend on itself),
it is difficult to construct a graph as a single literal. One way is to use
placeholder descriptors, but that is not efficient as it requires encoding
the full name of each dependent enum and message and then later resolving it;
thus, both expanding the binary size and also increasing initialization cost.
Instead, we add a prototype.{Enum,Message}.Reference method to obtain a
descriptor reference for the purposes for satisfying dependencies.
As such, nested declarations and dependencies are populated in an init function.
Other changes to support the implementation:
* Added a protoimpl package to expose the MessageType type and also the
MessageTypeOf and EnumTypeOf helper functions.
* Added a protogen.File.GoIdent field to provide a suggested variable name
for the file descriptor.
* Added prototype.{Enum,Message}.Reference that provides a descriptor reference
for the purposes for satisfying cyclic dependencies.
* Added protoreflect.{Syntax,Cardinality,Kind}.GoString to obtain a Go source
identifier that represents the given constant.
Change-Id: I9455764882dee6ad10f251901e7d419091e8bf1d
Reviewed-on: https://go-review.googlesource.com/c/150074
Reviewed-by: Damien Neil <dneil@google.com>
2018-11-15 14:44:37 -08:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
xxx_Fields_ProtoFile_FileDesc.Messages = xxx_Fields_ProtoFile_MessageDescs[0:1]
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Enums = xxx_Fields_ProtoFile_EnumDescs[0:1]
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Messages = xxx_Fields_ProtoFile_MessageDescs[1:5]
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Fields[1].EnumType = xxx_Fields_ProtoFile_EnumTypes[0]
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Fields[16].MessageType = xxx_Fields_ProtoFile_MessageTypes[4].Type
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Fields[18].EnumType = xxx_Fields_ProtoFile_EnumTypes[0]
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Fields[33].MessageType = xxx_Fields_ProtoFile_MessageTypes[4].Type
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Fields[34].MessageType = xxx_Fields_ProtoFile_MessageDescs[1].Reference()
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Fields[35].MessageType = xxx_Fields_ProtoFile_MessageDescs[2].Reference()
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Fields[36].MessageType = xxx_Fields_ProtoFile_MessageDescs[3].Reference()
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[2].Fields[1].MessageType = xxx_Fields_ProtoFile_MessageTypes[4].Type
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[3].Fields[1].EnumType = xxx_Fields_ProtoFile_EnumTypes[0]
|
|
|
|
var err error
|
|
|
|
Fields_ProtoFile, err = prototype.NewFile(&xxx_Fields_ProtoFile_FileDesc)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
|
|
|
|
|
|
|
|
var Fields_ProtoFile protoreflect.FileDescriptor
|
|
|
|
|
|
|
|
var xxx_Fields_ProtoFile_FileDesc = prototype.File{
|
|
|
|
Syntax: protoreflect.Proto3,
|
|
|
|
Path: "proto3/fields.proto",
|
|
|
|
Package: "goproto.protoc.proto3",
|
|
|
|
}
|
|
|
|
var xxx_Fields_ProtoFile_EnumTypes = [1]protoreflect.EnumType{
|
|
|
|
prototype.GoEnum(
|
|
|
|
xxx_Fields_ProtoFile_EnumDescs[0].Reference(),
|
|
|
|
func(_ protoreflect.EnumType, n protoreflect.EnumNumber) protoreflect.ProtoEnum {
|
|
|
|
return FieldTestMessage_Enum(n)
|
|
|
|
},
|
|
|
|
),
|
|
|
|
}
|
|
|
|
var xxx_Fields_ProtoFile_EnumDescs = [1]prototype.Enum{
|
|
|
|
{
|
|
|
|
Name: "Enum",
|
|
|
|
Values: []prototype.EnumValue{
|
|
|
|
{Name: "ZERO", Number: 0},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
var xxx_Fields_ProtoFile_MessageTypes = [5]protoimpl.MessageType{
|
|
|
|
{Type: prototype.GoMessage(
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[0].Reference(),
|
|
|
|
func(protoreflect.MessageType) protoreflect.ProtoMessage {
|
|
|
|
return new(FieldTestMessage)
|
|
|
|
},
|
|
|
|
)},
|
|
|
|
{ /* no message type for FieldTestMessage_MapInt32Int64Entry */ },
|
|
|
|
{ /* no message type for FieldTestMessage_MapStringMessageEntry */ },
|
|
|
|
{ /* no message type for FieldTestMessage_MapFixed64EnumEntry */ },
|
|
|
|
{Type: prototype.GoMessage(
|
|
|
|
xxx_Fields_ProtoFile_MessageDescs[4].Reference(),
|
|
|
|
func(protoreflect.MessageType) protoreflect.ProtoMessage {
|
|
|
|
return new(FieldTestMessage_Message)
|
|
|
|
},
|
|
|
|
)},
|
|
|
|
}
|
|
|
|
var xxx_Fields_ProtoFile_MessageDescs = [5]prototype.Message{
|
|
|
|
{
|
|
|
|
Name: "FieldTestMessage",
|
|
|
|
Fields: []prototype.Field{
|
|
|
|
{
|
|
|
|
Name: "optional_bool",
|
|
|
|
Number: 1,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.StringKind,
|
|
|
|
JSONName: "optionalBool",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_enum",
|
|
|
|
Number: 2,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.EnumKind,
|
|
|
|
JSONName: "optionalEnum",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_int32",
|
|
|
|
Number: 3,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Int32Kind,
|
|
|
|
JSONName: "optionalInt32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_sint32",
|
|
|
|
Number: 4,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Sint32Kind,
|
|
|
|
JSONName: "optionalSint32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_uint32",
|
|
|
|
Number: 5,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Uint32Kind,
|
|
|
|
JSONName: "optionalUint32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_int64",
|
|
|
|
Number: 6,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Int64Kind,
|
|
|
|
JSONName: "optionalInt64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_sint64",
|
|
|
|
Number: 7,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Sint64Kind,
|
|
|
|
JSONName: "optionalSint64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_uint64",
|
|
|
|
Number: 8,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Uint64Kind,
|
|
|
|
JSONName: "optionalUint64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_sfixed32",
|
|
|
|
Number: 9,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Sfixed32Kind,
|
|
|
|
JSONName: "optionalSfixed32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_fixed32",
|
|
|
|
Number: 10,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Fixed32Kind,
|
|
|
|
JSONName: "optionalFixed32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_float",
|
|
|
|
Number: 11,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.FloatKind,
|
|
|
|
JSONName: "optionalFloat",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_sfixed64",
|
|
|
|
Number: 12,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Sfixed64Kind,
|
|
|
|
JSONName: "optionalSfixed64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_fixed64",
|
|
|
|
Number: 13,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Fixed64Kind,
|
|
|
|
JSONName: "optionalFixed64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_double",
|
|
|
|
Number: 14,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.DoubleKind,
|
|
|
|
JSONName: "optionalDouble",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_string",
|
|
|
|
Number: 15,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.StringKind,
|
|
|
|
JSONName: "optionalString",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_bytes",
|
|
|
|
Number: 16,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.BytesKind,
|
|
|
|
JSONName: "optionalBytes",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "optional_Message",
|
|
|
|
Number: 17,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.MessageKind,
|
|
|
|
JSONName: "optionalMessage",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_bool",
|
|
|
|
Number: 201,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.BoolKind,
|
|
|
|
JSONName: "repeatedBool",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_enum",
|
|
|
|
Number: 202,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.EnumKind,
|
|
|
|
JSONName: "repeatedEnum",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_int32",
|
|
|
|
Number: 203,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Int32Kind,
|
|
|
|
JSONName: "repeatedInt32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_sint32",
|
|
|
|
Number: 204,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Sint32Kind,
|
|
|
|
JSONName: "repeatedSint32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_uint32",
|
|
|
|
Number: 205,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Uint32Kind,
|
|
|
|
JSONName: "repeatedUint32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_int64",
|
|
|
|
Number: 206,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Int64Kind,
|
|
|
|
JSONName: "repeatedInt64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_sint64",
|
|
|
|
Number: 207,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Sint64Kind,
|
|
|
|
JSONName: "repeatedSint64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_uint64",
|
|
|
|
Number: 208,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Uint64Kind,
|
|
|
|
JSONName: "repeatedUint64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_sfixed32",
|
|
|
|
Number: 209,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Sfixed32Kind,
|
|
|
|
JSONName: "repeatedSfixed32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_fixed32",
|
|
|
|
Number: 210,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Fixed32Kind,
|
|
|
|
JSONName: "repeatedFixed32",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_float",
|
|
|
|
Number: 211,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.FloatKind,
|
|
|
|
JSONName: "repeatedFloat",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_sfixed64",
|
|
|
|
Number: 212,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Sfixed64Kind,
|
|
|
|
JSONName: "repeatedSfixed64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_fixed64",
|
|
|
|
Number: 213,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.Fixed64Kind,
|
|
|
|
JSONName: "repeatedFixed64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_double",
|
|
|
|
Number: 214,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.DoubleKind,
|
|
|
|
JSONName: "repeatedDouble",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_string",
|
|
|
|
Number: 215,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.StringKind,
|
|
|
|
JSONName: "repeatedString",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_bytes",
|
|
|
|
Number: 216,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.BytesKind,
|
|
|
|
JSONName: "repeatedBytes",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "repeated_Message",
|
|
|
|
Number: 217,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.MessageKind,
|
|
|
|
JSONName: "repeatedMessage",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "map_int32_int64",
|
|
|
|
Number: 500,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.MessageKind,
|
|
|
|
JSONName: "mapInt32Int64",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "map_string_message",
|
|
|
|
Number: 501,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.MessageKind,
|
|
|
|
JSONName: "mapStringMessage",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "map_fixed64_enum",
|
|
|
|
Number: 502,
|
|
|
|
Cardinality: protoreflect.Repeated,
|
|
|
|
Kind: protoreflect.MessageKind,
|
|
|
|
JSONName: "mapFixed64Enum",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "MapInt32Int64Entry",
|
|
|
|
Fields: []prototype.Field{
|
|
|
|
{
|
|
|
|
Name: "key",
|
|
|
|
Number: 1,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Int32Kind,
|
|
|
|
JSONName: "key",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "value",
|
|
|
|
Number: 2,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Int64Kind,
|
|
|
|
JSONName: "value",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "MapStringMessageEntry",
|
|
|
|
Fields: []prototype.Field{
|
|
|
|
{
|
|
|
|
Name: "key",
|
|
|
|
Number: 1,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.StringKind,
|
|
|
|
JSONName: "key",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "value",
|
|
|
|
Number: 2,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.MessageKind,
|
|
|
|
JSONName: "value",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "MapFixed64EnumEntry",
|
|
|
|
Fields: []prototype.Field{
|
|
|
|
{
|
|
|
|
Name: "key",
|
|
|
|
Number: 1,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.Fixed64Kind,
|
|
|
|
JSONName: "key",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "value",
|
|
|
|
Number: 2,
|
|
|
|
Cardinality: protoreflect.Optional,
|
|
|
|
Kind: protoreflect.EnumKind,
|
|
|
|
JSONName: "value",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Message",
|
|
|
|
},
|
|
|
|
}
|