mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-29 09:32:38 +00:00
d7e97bc71b
The marshaler, unmarshaler, and sizer functions are unused ever since the underlying implementation was switched to be table-driven. Change the function to only return the wrapper structs. This change: * enables generated protos to drop dependencies on certain proto types * reduces the size of generated protos * simplifies the implementation of oneofs in protoc-gen-go Updates #708 Change-Id: I845c9009bc0236d1b51d34b014dc3e184303c0f2 Reviewed-on: https://go-review.googlesource.com/c/151357 Reviewed-by: Damien Neil <dneil@google.com>
378 lines
14 KiB
Go
378 lines
14 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// source: proto2/enum.proto
|
|
|
|
package proto2
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
math "math"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// 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.
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
// EnumType1 comment.
|
|
type EnumType1 int32
|
|
|
|
const (
|
|
// EnumType1_ONE comment.
|
|
EnumType1_ONE EnumType1 = 1
|
|
// EnumType1_TWO comment.
|
|
EnumType1_TWO EnumType1 = 2
|
|
)
|
|
|
|
var EnumType1_name = map[int32]string{
|
|
1: "ONE",
|
|
2: "TWO",
|
|
}
|
|
|
|
var EnumType1_value = map[string]int32{
|
|
"ONE": 1,
|
|
"TWO": 2,
|
|
}
|
|
|
|
func (x EnumType1) Enum() *EnumType1 {
|
|
p := new(EnumType1)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x EnumType1) String() string {
|
|
return proto.EnumName(EnumType1_name, int32(x))
|
|
}
|
|
|
|
func (x *EnumType1) UnmarshalJSON(data []byte) error {
|
|
value, err := proto.UnmarshalJSONEnum(EnumType1_value, data, "EnumType1")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*x = EnumType1(value)
|
|
return nil
|
|
}
|
|
|
|
func (EnumType1) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{0}
|
|
}
|
|
|
|
type EnumType2 int32
|
|
|
|
const (
|
|
EnumType2_duplicate1 EnumType2 = 1
|
|
EnumType2_duplicate2 EnumType2 = 1
|
|
)
|
|
|
|
var EnumType2_name = map[int32]string{
|
|
1: "duplicate1",
|
|
// Duplicate value: 1: "duplicate2",
|
|
}
|
|
|
|
var EnumType2_value = map[string]int32{
|
|
"duplicate1": 1,
|
|
"duplicate2": 1,
|
|
}
|
|
|
|
func (x EnumType2) Enum() *EnumType2 {
|
|
p := new(EnumType2)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x EnumType2) String() string {
|
|
return proto.EnumName(EnumType2_name, int32(x))
|
|
}
|
|
|
|
func (x *EnumType2) UnmarshalJSON(data []byte) error {
|
|
value, err := proto.UnmarshalJSONEnum(EnumType2_value, data, "EnumType2")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*x = EnumType2(value)
|
|
return nil
|
|
}
|
|
|
|
func (EnumType2) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{1}
|
|
}
|
|
|
|
// NestedEnumType1A comment.
|
|
type EnumContainerMessage1_NestedEnumType1A int32
|
|
|
|
const (
|
|
// NestedEnumType1A_VALUE comment.
|
|
EnumContainerMessage1_NESTED_1A_VALUE EnumContainerMessage1_NestedEnumType1A = 0
|
|
)
|
|
|
|
var EnumContainerMessage1_NestedEnumType1A_name = map[int32]string{
|
|
0: "NESTED_1A_VALUE",
|
|
}
|
|
|
|
var EnumContainerMessage1_NestedEnumType1A_value = map[string]int32{
|
|
"NESTED_1A_VALUE": 0,
|
|
}
|
|
|
|
func (x EnumContainerMessage1_NestedEnumType1A) Enum() *EnumContainerMessage1_NestedEnumType1A {
|
|
p := new(EnumContainerMessage1_NestedEnumType1A)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x EnumContainerMessage1_NestedEnumType1A) String() string {
|
|
return proto.EnumName(EnumContainerMessage1_NestedEnumType1A_name, int32(x))
|
|
}
|
|
|
|
func (x *EnumContainerMessage1_NestedEnumType1A) UnmarshalJSON(data []byte) error {
|
|
value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_NestedEnumType1A_value, data, "EnumContainerMessage1_NestedEnumType1A")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*x = EnumContainerMessage1_NestedEnumType1A(value)
|
|
return nil
|
|
}
|
|
|
|
func (EnumContainerMessage1_NestedEnumType1A) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{0, 0}
|
|
}
|
|
|
|
type EnumContainerMessage1_NestedEnumType1B int32
|
|
|
|
const (
|
|
EnumContainerMessage1_NESTED_1B_VALUE EnumContainerMessage1_NestedEnumType1B = 0
|
|
)
|
|
|
|
var EnumContainerMessage1_NestedEnumType1B_name = map[int32]string{
|
|
0: "NESTED_1B_VALUE",
|
|
}
|
|
|
|
var EnumContainerMessage1_NestedEnumType1B_value = map[string]int32{
|
|
"NESTED_1B_VALUE": 0,
|
|
}
|
|
|
|
func (x EnumContainerMessage1_NestedEnumType1B) Enum() *EnumContainerMessage1_NestedEnumType1B {
|
|
p := new(EnumContainerMessage1_NestedEnumType1B)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x EnumContainerMessage1_NestedEnumType1B) String() string {
|
|
return proto.EnumName(EnumContainerMessage1_NestedEnumType1B_name, int32(x))
|
|
}
|
|
|
|
func (x *EnumContainerMessage1_NestedEnumType1B) UnmarshalJSON(data []byte) error {
|
|
value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_NestedEnumType1B_value, data, "EnumContainerMessage1_NestedEnumType1B")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*x = EnumContainerMessage1_NestedEnumType1B(value)
|
|
return nil
|
|
}
|
|
|
|
func (EnumContainerMessage1_NestedEnumType1B) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{0, 1}
|
|
}
|
|
|
|
// NestedEnumType2A comment.
|
|
type EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A int32
|
|
|
|
const (
|
|
// NestedEnumType2A_VALUE comment.
|
|
EnumContainerMessage1_EnumContainerMessage2_NESTED_2A_VALUE EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A = 0
|
|
)
|
|
|
|
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_name = map[int32]string{
|
|
0: "NESTED_2A_VALUE",
|
|
}
|
|
|
|
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_value = map[string]int32{
|
|
"NESTED_2A_VALUE": 0,
|
|
}
|
|
|
|
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) Enum() *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A {
|
|
p := new(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) String() string {
|
|
return proto.EnumName(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_name, int32(x))
|
|
}
|
|
|
|
func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) UnmarshalJSON(data []byte) error {
|
|
value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_value, data, "EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*x = EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A(value)
|
|
return nil
|
|
}
|
|
|
|
func (EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{0, 0, 0}
|
|
}
|
|
|
|
type EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B int32
|
|
|
|
const (
|
|
EnumContainerMessage1_EnumContainerMessage2_NESTED_2B_VALUE EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B = 0
|
|
)
|
|
|
|
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_name = map[int32]string{
|
|
0: "NESTED_2B_VALUE",
|
|
}
|
|
|
|
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_value = map[string]int32{
|
|
"NESTED_2B_VALUE": 0,
|
|
}
|
|
|
|
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) Enum() *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B {
|
|
p := new(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) String() string {
|
|
return proto.EnumName(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_name, int32(x))
|
|
}
|
|
|
|
func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) UnmarshalJSON(data []byte) error {
|
|
value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_value, data, "EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*x = EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B(value)
|
|
return nil
|
|
}
|
|
|
|
func (EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{0, 0, 1}
|
|
}
|
|
|
|
type EnumContainerMessage1 struct {
|
|
DefaultDuplicate1 *EnumType2 `protobuf:"varint,1,opt,name=default_duplicate1,json=defaultDuplicate1,enum=goproto.protoc.proto2.EnumType2,def=1" json:"default_duplicate1,omitempty"`
|
|
DefaultDuplicate2 *EnumType2 `protobuf:"varint,2,opt,name=default_duplicate2,json=defaultDuplicate2,enum=goproto.protoc.proto2.EnumType2,def=1" json:"default_duplicate2,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *EnumContainerMessage1) Reset() { *m = EnumContainerMessage1{} }
|
|
func (m *EnumContainerMessage1) String() string { return proto.CompactTextString(m) }
|
|
func (*EnumContainerMessage1) ProtoMessage() {}
|
|
func (*EnumContainerMessage1) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{0}
|
|
}
|
|
|
|
func (m *EnumContainerMessage1) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_EnumContainerMessage1.Unmarshal(m, b)
|
|
}
|
|
func (m *EnumContainerMessage1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_EnumContainerMessage1.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *EnumContainerMessage1) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_EnumContainerMessage1.Merge(m, src)
|
|
}
|
|
func (m *EnumContainerMessage1) XXX_Size() int {
|
|
return xxx_messageInfo_EnumContainerMessage1.Size(m)
|
|
}
|
|
func (m *EnumContainerMessage1) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_EnumContainerMessage1.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_EnumContainerMessage1 proto.InternalMessageInfo
|
|
|
|
const Default_EnumContainerMessage1_DefaultDuplicate1 EnumType2 = EnumType2_duplicate1
|
|
const Default_EnumContainerMessage1_DefaultDuplicate2 EnumType2 = EnumType2_duplicate2
|
|
|
|
func (m *EnumContainerMessage1) GetDefaultDuplicate1() EnumType2 {
|
|
if m != nil && m.DefaultDuplicate1 != nil {
|
|
return *m.DefaultDuplicate1
|
|
}
|
|
return Default_EnumContainerMessage1_DefaultDuplicate1
|
|
}
|
|
|
|
func (m *EnumContainerMessage1) GetDefaultDuplicate2() EnumType2 {
|
|
if m != nil && m.DefaultDuplicate2 != nil {
|
|
return *m.DefaultDuplicate2
|
|
}
|
|
return Default_EnumContainerMessage1_DefaultDuplicate2
|
|
}
|
|
|
|
type EnumContainerMessage1_EnumContainerMessage2 struct {
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *EnumContainerMessage1_EnumContainerMessage2) Reset() {
|
|
*m = EnumContainerMessage1_EnumContainerMessage2{}
|
|
}
|
|
func (m *EnumContainerMessage1_EnumContainerMessage2) String() string {
|
|
return proto.CompactTextString(m)
|
|
}
|
|
func (*EnumContainerMessage1_EnumContainerMessage2) ProtoMessage() {}
|
|
func (*EnumContainerMessage1_EnumContainerMessage2) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_de9f68860d540858, []int{0, 0}
|
|
}
|
|
|
|
func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Unmarshal(m, b)
|
|
}
|
|
func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Merge(m, src)
|
|
}
|
|
func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Size() int {
|
|
return xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Size(m)
|
|
}
|
|
func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2 proto.InternalMessageInfo
|
|
|
|
func init() {
|
|
proto.RegisterEnum("goproto.protoc.proto2.EnumType1", EnumType1_name, EnumType1_value)
|
|
proto.RegisterEnum("goproto.protoc.proto2.EnumType2", EnumType2_name, EnumType2_value)
|
|
proto.RegisterEnum("goproto.protoc.proto2.EnumContainerMessage1_NestedEnumType1A", EnumContainerMessage1_NestedEnumType1A_name, EnumContainerMessage1_NestedEnumType1A_value)
|
|
proto.RegisterEnum("goproto.protoc.proto2.EnumContainerMessage1_NestedEnumType1B", EnumContainerMessage1_NestedEnumType1B_name, EnumContainerMessage1_NestedEnumType1B_value)
|
|
proto.RegisterEnum("goproto.protoc.proto2.EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A", EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_name, EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_value)
|
|
proto.RegisterEnum("goproto.protoc.proto2.EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B", EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_name, EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_value)
|
|
proto.RegisterType((*EnumContainerMessage1)(nil), "goproto.protoc.proto2.EnumContainerMessage1")
|
|
proto.RegisterType((*EnumContainerMessage1_EnumContainerMessage2)(nil), "goproto.protoc.proto2.EnumContainerMessage1.EnumContainerMessage2")
|
|
}
|
|
|
|
func init() { proto.RegisterFile("proto2/enum.proto", fileDescriptor_de9f68860d540858) }
|
|
|
|
var fileDescriptor_de9f68860d540858 = []byte{
|
|
// 296 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0xd0, 0xc1, 0x4b, 0xfb, 0x30,
|
|
0x14, 0x07, 0xf0, 0x5f, 0xb6, 0xc3, 0x0f, 0x73, 0x98, 0x59, 0x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