1
2
3
4
5
6
7 package enumcustomname
8
9 import (
10 fmt "fmt"
11 _ "github.com/gogo/protobuf/gogoproto"
12 proto "github.com/gogo/protobuf/proto"
13 test "github.com/gogo/protobuf/test"
14 math "math"
15 strconv "strconv"
16 )
17
18
19 var _ = proto.Marshal
20 var _ = fmt.Errorf
21 var _ = math.Inf
22
23
24
25
26
27 const _ = proto.GoGoProtoPackageIsVersion3
28
29 type MyCustomEnum int32
30
31 const (
32
33
34 MyCustomEnum_MyBetterNameA MyCustomEnum = 0
35 MyCustomEnum_B MyCustomEnum = 1
36 )
37
38 var MyCustomEnum_name = map[int32]string{
39 0: "A",
40 1: "B",
41 }
42
43 var MyCustomEnum_value = map[string]int32{
44 "A": 0,
45 "B": 1,
46 }
47
48 func (x MyCustomEnum) Enum() *MyCustomEnum {
49 p := new(MyCustomEnum)
50 *p = x
51 return p
52 }
53
54 func (x MyCustomEnum) String() string {
55 return proto.EnumName(MyCustomEnum_name, int32(x))
56 }
57
58 func (x *MyCustomEnum) UnmarshalJSON(data []byte) error {
59 value, err := proto.UnmarshalJSONEnum(MyCustomEnum_value, data, "MyCustomEnum")
60 if err != nil {
61 return err
62 }
63 *x = MyCustomEnum(value)
64 return nil
65 }
66
67 func (MyCustomEnum) EnumDescriptor() ([]byte, []int) {
68 return fileDescriptor_49eed3c955d68b51, []int{0}
69 }
70
71 type MyCustomUnprefixedEnum int32
72
73 const (
74 MyBetterNameUnprefixedA MyCustomUnprefixedEnum = 0
75 UNPREFIXED_B MyCustomUnprefixedEnum = 1
76 )
77
78 var MyCustomUnprefixedEnum_name = map[int32]string{
79 0: "UNPREFIXED_A",
80 1: "UNPREFIXED_B",
81 }
82
83 var MyCustomUnprefixedEnum_value = map[string]int32{
84 "UNPREFIXED_A": 0,
85 "UNPREFIXED_B": 1,
86 }
87
88 func (x MyCustomUnprefixedEnum) Enum() *MyCustomUnprefixedEnum {
89 p := new(MyCustomUnprefixedEnum)
90 *p = x
91 return p
92 }
93
94 func (x MyCustomUnprefixedEnum) MarshalJSON() ([]byte, error) {
95 return proto.MarshalJSONEnum(MyCustomUnprefixedEnum_name, int32(x))
96 }
97
98 func (x *MyCustomUnprefixedEnum) UnmarshalJSON(data []byte) error {
99 value, err := proto.UnmarshalJSONEnum(MyCustomUnprefixedEnum_value, data, "MyCustomUnprefixedEnum")
100 if err != nil {
101 return err
102 }
103 *x = MyCustomUnprefixedEnum(value)
104 return nil
105 }
106
107 func (MyCustomUnprefixedEnum) EnumDescriptor() ([]byte, []int) {
108 return fileDescriptor_49eed3c955d68b51, []int{1}
109 }
110
111 type MyEnumWithEnumStringer int32
112
113 const (
114 MyEnumWithEnumStringer_EnumValueStringerA MyEnumWithEnumStringer = 0
115 MyEnumWithEnumStringer_STRINGER_B MyEnumWithEnumStringer = 1
116 )
117
118 var MyEnumWithEnumStringer_name = map[int32]string{
119 0: "STRINGER_A",
120 1: "STRINGER_B",
121 }
122
123 var MyEnumWithEnumStringer_value = map[string]int32{
124 "STRINGER_A": 0,
125 "STRINGER_B": 1,
126 }
127
128 func (x MyEnumWithEnumStringer) Enum() *MyEnumWithEnumStringer {
129 p := new(MyEnumWithEnumStringer)
130 *p = x
131 return p
132 }
133
134 func (x MyEnumWithEnumStringer) MarshalJSON() ([]byte, error) {
135 return proto.MarshalJSONEnum(MyEnumWithEnumStringer_name, int32(x))
136 }
137
138 func (x *MyEnumWithEnumStringer) UnmarshalJSON(data []byte) error {
139 value, err := proto.UnmarshalJSONEnum(MyEnumWithEnumStringer_value, data, "MyEnumWithEnumStringer")
140 if err != nil {
141 return err
142 }
143 *x = MyEnumWithEnumStringer(value)
144 return nil
145 }
146
147 func (MyEnumWithEnumStringer) EnumDescriptor() ([]byte, []int) {
148 return fileDescriptor_49eed3c955d68b51, []int{2}
149 }
150
151 type OnlyEnums struct {
152 MyEnum *MyCustomEnum `protobuf:"varint,1,opt,name=my_enum,json=myEnum,enum=enumcustomname.MyCustomEnum" json:"my_enum,omitempty"`
153 MyEnumDefaultA *MyCustomEnum `protobuf:"varint,2,opt,name=my_enum_default_a,json=myEnumDefaultA,enum=enumcustomname.MyCustomEnum,def=0" json:"my_enum_default_a,omitempty"`
154 MyEnumDefaultB *MyCustomEnum `protobuf:"varint,3,opt,name=my_enum_default_b,json=myEnumDefaultB,enum=enumcustomname.MyCustomEnum,def=1" json:"my_enum_default_b,omitempty"`
155 MyUnprefixedEnum *MyCustomUnprefixedEnum `protobuf:"varint,4,opt,name=my_unprefixed_enum,json=myUnprefixedEnum,enum=enumcustomname.MyCustomUnprefixedEnum" json:"my_unprefixed_enum,omitempty"`
156 MyUnprefixedEnumDefaultA *MyCustomUnprefixedEnum `protobuf:"varint,5,opt,name=my_unprefixed_enum_default_a,json=myUnprefixedEnumDefaultA,enum=enumcustomname.MyCustomUnprefixedEnum,def=0" json:"my_unprefixed_enum_default_a,omitempty"`
157 MyUnprefixedEnumDefaultB *MyCustomUnprefixedEnum `protobuf:"varint,6,opt,name=my_unprefixed_enum_default_b,json=myUnprefixedEnumDefaultB,enum=enumcustomname.MyCustomUnprefixedEnum,def=1" json:"my_unprefixed_enum_default_b,omitempty"`
158 YetAnotherTestEnum *test.YetAnotherTestEnum `protobuf:"varint,7,opt,name=yet_another_test_enum,json=yetAnotherTestEnum,enum=test.YetAnotherTestEnum" json:"yet_another_test_enum,omitempty"`
159 YetAnotherTestEnumDefaultAa *test.YetAnotherTestEnum `protobuf:"varint,8,opt,name=yet_another_test_enum_default_aa,json=yetAnotherTestEnumDefaultAa,enum=test.YetAnotherTestEnum,def=0" json:"yet_another_test_enum_default_aa,omitempty"`
160 YetAnotherTestEnumDefaultBb *test.YetAnotherTestEnum `protobuf:"varint,9,opt,name=yet_another_test_enum_default_bb,json=yetAnotherTestEnumDefaultBb,enum=test.YetAnotherTestEnum,def=1" json:"yet_another_test_enum_default_bb,omitempty"`
161 YetYetAnotherTestEnum *test.YetYetAnotherTestEnum `protobuf:"varint,10,opt,name=yet_yet_another_test_enum,json=yetYetAnotherTestEnum,enum=test.YetYetAnotherTestEnum" json:"yet_yet_another_test_enum,omitempty"`
162 YetYetAnotherTestEnumDefaultCc *test.YetYetAnotherTestEnum `protobuf:"varint,11,opt,name=yet_yet_another_test_enum_default_cc,json=yetYetAnotherTestEnumDefaultCc,enum=test.YetYetAnotherTestEnum,def=0" json:"yet_yet_another_test_enum_default_cc,omitempty"`
163 YetYetAnotherTestEnumDefaultDd *test.YetYetAnotherTestEnum `protobuf:"varint,12,opt,name=yet_yet_another_test_enum_default_dd,json=yetYetAnotherTestEnumDefaultDd,enum=test.YetYetAnotherTestEnum,def=1" json:"yet_yet_another_test_enum_default_dd,omitempty"`
164 XXX_NoUnkeyedLiteral struct{} `json:"-"`
165 XXX_unrecognized []byte `json:"-"`
166 XXX_sizecache int32 `json:"-"`
167 }
168
169 func (m *OnlyEnums) Reset() { *m = OnlyEnums{} }
170 func (m *OnlyEnums) String() string { return proto.CompactTextString(m) }
171 func (*OnlyEnums) ProtoMessage() {}
172 func (*OnlyEnums) Descriptor() ([]byte, []int) {
173 return fileDescriptor_49eed3c955d68b51, []int{0}
174 }
175 func (m *OnlyEnums) XXX_Unmarshal(b []byte) error {
176 return xxx_messageInfo_OnlyEnums.Unmarshal(m, b)
177 }
178 func (m *OnlyEnums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
179 return xxx_messageInfo_OnlyEnums.Marshal(b, m, deterministic)
180 }
181 func (m *OnlyEnums) XXX_Merge(src proto.Message) {
182 xxx_messageInfo_OnlyEnums.Merge(m, src)
183 }
184 func (m *OnlyEnums) XXX_Size() int {
185 return xxx_messageInfo_OnlyEnums.Size(m)
186 }
187 func (m *OnlyEnums) XXX_DiscardUnknown() {
188 xxx_messageInfo_OnlyEnums.DiscardUnknown(m)
189 }
190
191 var xxx_messageInfo_OnlyEnums proto.InternalMessageInfo
192
193 const Default_OnlyEnums_MyEnumDefaultA MyCustomEnum = MyCustomEnum_MyBetterNameA
194 const Default_OnlyEnums_MyEnumDefaultB MyCustomEnum = MyCustomEnum_B
195 const Default_OnlyEnums_MyUnprefixedEnumDefaultA MyCustomUnprefixedEnum = MyBetterNameUnprefixedA
196 const Default_OnlyEnums_MyUnprefixedEnumDefaultB MyCustomUnprefixedEnum = UNPREFIXED_B
197 const Default_OnlyEnums_YetAnotherTestEnumDefaultAa test.YetAnotherTestEnum = test.AA
198 const Default_OnlyEnums_YetAnotherTestEnumDefaultBb test.YetAnotherTestEnum = test.BetterYetBB
199 const Default_OnlyEnums_YetYetAnotherTestEnumDefaultCc test.YetYetAnotherTestEnum = test.YetYetAnotherTestEnum_CC
200 const Default_OnlyEnums_YetYetAnotherTestEnumDefaultDd test.YetYetAnotherTestEnum = test.YetYetAnotherTestEnum_BetterYetDD
201
202 func (m *OnlyEnums) GetMyEnum() MyCustomEnum {
203 if m != nil && m.MyEnum != nil {
204 return *m.MyEnum
205 }
206 return MyCustomEnum_MyBetterNameA
207 }
208
209 func (m *OnlyEnums) GetMyEnumDefaultA() MyCustomEnum {
210 if m != nil && m.MyEnumDefaultA != nil {
211 return *m.MyEnumDefaultA
212 }
213 return Default_OnlyEnums_MyEnumDefaultA
214 }
215
216 func (m *OnlyEnums) GetMyEnumDefaultB() MyCustomEnum {
217 if m != nil && m.MyEnumDefaultB != nil {
218 return *m.MyEnumDefaultB
219 }
220 return Default_OnlyEnums_MyEnumDefaultB
221 }
222
223 func (m *OnlyEnums) GetMyUnprefixedEnum() MyCustomUnprefixedEnum {
224 if m != nil && m.MyUnprefixedEnum != nil {
225 return *m.MyUnprefixedEnum
226 }
227 return MyBetterNameUnprefixedA
228 }
229
230 func (m *OnlyEnums) GetMyUnprefixedEnumDefaultA() MyCustomUnprefixedEnum {
231 if m != nil && m.MyUnprefixedEnumDefaultA != nil {
232 return *m.MyUnprefixedEnumDefaultA
233 }
234 return Default_OnlyEnums_MyUnprefixedEnumDefaultA
235 }
236
237 func (m *OnlyEnums) GetMyUnprefixedEnumDefaultB() MyCustomUnprefixedEnum {
238 if m != nil && m.MyUnprefixedEnumDefaultB != nil {
239 return *m.MyUnprefixedEnumDefaultB
240 }
241 return Default_OnlyEnums_MyUnprefixedEnumDefaultB
242 }
243
244 func (m *OnlyEnums) GetYetAnotherTestEnum() test.YetAnotherTestEnum {
245 if m != nil && m.YetAnotherTestEnum != nil {
246 return *m.YetAnotherTestEnum
247 }
248 return test.AA
249 }
250
251 func (m *OnlyEnums) GetYetAnotherTestEnumDefaultAa() test.YetAnotherTestEnum {
252 if m != nil && m.YetAnotherTestEnumDefaultAa != nil {
253 return *m.YetAnotherTestEnumDefaultAa
254 }
255 return Default_OnlyEnums_YetAnotherTestEnumDefaultAa
256 }
257
258 func (m *OnlyEnums) GetYetAnotherTestEnumDefaultBb() test.YetAnotherTestEnum {
259 if m != nil && m.YetAnotherTestEnumDefaultBb != nil {
260 return *m.YetAnotherTestEnumDefaultBb
261 }
262 return Default_OnlyEnums_YetAnotherTestEnumDefaultBb
263 }
264
265 func (m *OnlyEnums) GetYetYetAnotherTestEnum() test.YetYetAnotherTestEnum {
266 if m != nil && m.YetYetAnotherTestEnum != nil {
267 return *m.YetYetAnotherTestEnum
268 }
269 return test.YetYetAnotherTestEnum_CC
270 }
271
272 func (m *OnlyEnums) GetYetYetAnotherTestEnumDefaultCc() test.YetYetAnotherTestEnum {
273 if m != nil && m.YetYetAnotherTestEnumDefaultCc != nil {
274 return *m.YetYetAnotherTestEnumDefaultCc
275 }
276 return Default_OnlyEnums_YetYetAnotherTestEnumDefaultCc
277 }
278
279 func (m *OnlyEnums) GetYetYetAnotherTestEnumDefaultDd() test.YetYetAnotherTestEnum {
280 if m != nil && m.YetYetAnotherTestEnumDefaultDd != nil {
281 return *m.YetYetAnotherTestEnumDefaultDd
282 }
283 return Default_OnlyEnums_YetYetAnotherTestEnumDefaultDd
284 }
285
286 func init() {
287 proto.RegisterEnum("enumcustomname.MyCustomEnum", MyCustomEnum_name, MyCustomEnum_value)
288 proto.RegisterEnum("enumcustomname.MyCustomUnprefixedEnum", MyCustomUnprefixedEnum_name, MyCustomUnprefixedEnum_value)
289 proto.RegisterEnum("enumcustomname.MyEnumWithEnumStringer", MyEnumWithEnumStringer_name, MyEnumWithEnumStringer_value)
290 proto.RegisterType((*OnlyEnums)(nil), "enumcustomname.OnlyEnums")
291 }
292
293 func init() { proto.RegisterFile("enumcustomname.proto", fileDescriptor_49eed3c955d68b51) }
294
295 var fileDescriptor_49eed3c955d68b51 = []byte{
296
297 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x8f, 0xd2, 0x40,
298 0x18, 0xc6, 0x29, 0xba, 0x2c, 0x3b, 0x22, 0xe9, 0x4e, 0x14, 0x47, 0x30, 0x4d, 0xb3, 0x31, 0xc6,
299 0x60, 0x16, 0x12, 0x8f, 0x78, 0x9a, 0x52, 0x34, 0x1b, 0x03, 0x9a, 0xee, 0xe2, 0xbf, 0x4b, 0xd3,
300 0x96, 0xe1, 0x4f, 0xc2, 0xb4, 0x9b, 0x32, 0x8d, 0xf6, 0x1b, 0x18, 0xbe, 0x03, 0x27, 0x39, 0x78,
301 0xf4, 0xbc, 0x67, 0x3f, 0x98, 0x99, 0xe9, 0xc2, 0x42, 0x5b, 0x0a, 0xf1, 0x34, 0xed, 0x9b, 0xe7,
302 0x7d, 0x7e, 0xf3, 0x3e, 0x79, 0x07, 0x3c, 0x22, 0x6e, 0x40, 0x9d, 0x60, 0xc6, 0x3c, 0xea, 0x5a,
303 0x94, 0x34, 0xae, 0x7d, 0x8f, 0x79, 0xb0, 0xbc, 0x5d, 0xad, 0x9e, 0x8f, 0x26, 0x6c, 0x1c, 0xd8,
304 0x0d, 0xc7, 0xa3, 0xcd, 0x91, 0x37, 0xf2, 0x9a, 0x42, 0x66, 0x07, 0x43, 0xf1, 0x27, 0x7e, 0xc4,
305 0x57, 0xd4, 0x5e, 0x7d, 0xb5, 0x53, 0xce, 0xc8, 0x8c, 0x35, 0xd9, 0x98, 0xf0, 0x33, 0x12, 0x9f,
306 0xfd, 0x2d, 0x82, 0x93, 0x0f, 0xee, 0x34, 0xec, 0xb8, 0x01, 0x9d, 0xc1, 0x26, 0x38, 0xa6, 0xa1,
307 0xc9, 0xf1, 0x48, 0x52, 0xa5, 0x97, 0xe5, 0xd7, 0x95, 0x46, 0xec, 0x86, 0x5d, 0xa1, 0x34, 0x0a,
308 0x54, 0x9c, 0x50, 0x07, 0xa7, 0xb7, 0x0d, 0xe6, 0x80, 0x0c, 0xad, 0x60, 0xca, 0x4c, 0x0b, 0xe5,
309 0xb3, 0x5a, 0x5b, 0x12, 0x36, 0xca, 0x51, 0xb7, 0x1e, 0x75, 0xe0, 0x34, 0x17, 0x1b, 0xdd, 0xcb,
310 0x76, 0xd1, 0x62, 0x2e, 0x1a, 0xec, 0x01, 0x48, 0x43, 0x33, 0x70, 0xaf, 0x7d, 0x32, 0x9c, 0xfc,
311 0x20, 0x83, 0x68, 0x8e, 0xfb, 0xc2, 0x46, 0x4d, 0xda, 0xf4, 0xd7, 0x42, 0x31, 0x91, 0x4c, 0x63,
312 0x15, 0xe8, 0x82, 0x67, 0x49, 0xbf, 0x8d, 0x31, 0x8f, 0x0e, 0x73, 0x6e, 0x95, 0xfa, 0xbd, 0x8f,
313 0x46, 0xe7, 0xed, 0xc5, 0x97, 0x8e, 0x6e, 0x62, 0x03, 0xc5, 0x39, 0xeb, 0x14, 0xb2, 0x79, 0x36,
314 0x2a, 0xfc, 0x07, 0x4f, 0xdb, 0xc9, 0xd3, 0xe0, 0x7b, 0xf0, 0x38, 0x24, 0xcc, 0xb4, 0x5c, 0x8f,
315 0x8d, 0x89, 0x6f, 0xf2, 0xa5, 0x88, 0x22, 0x3b, 0x16, 0x20, 0xd4, 0x10, 0x6b, 0xf2, 0x95, 0x30,
316 0x1c, 0x29, 0xae, 0xc8, 0x8c, 0x89, 0xa8, 0x60, 0x98, 0xa8, 0x41, 0x07, 0xa8, 0xa9, 0x66, 0x77,
317 0x79, 0x59, 0xa8, 0x98, 0xed, 0x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, 0x97, 0x57, 0xc6, 0x45, 0xef, 0x5d, 0xc7,
329 0x10, 0xf0, 0xca, 0x7c, 0xa1, 0x42, 0xae, 0xf8, 0x64, 0x4d, 0x03, 0xb2, 0x92, 0x61, 0x58, 0xde,
330 0xd0, 0x71, 0x6a, 0x91, 0x13, 0xff, 0x2c, 0x15, 0xe9, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbe,
331 0x65, 0x55, 0xe7, 0xdb, 0x05, 0x00, 0x00,
332 }
333
334 func (x MyEnumWithEnumStringer) String() string {
335 s, ok := MyEnumWithEnumStringer_name[int32(x)]
336 if ok {
337 return s
338 }
339 return strconv.Itoa(int(x))
340 }
341
View as plain text