1
2
3
4
5
6
7 package protoexample
8
9 import (
10 protoreflect "google.golang.org/protobuf/reflect/protoreflect"
11 protoimpl "google.golang.org/protobuf/runtime/protoimpl"
12 reflect "reflect"
13 sync "sync"
14 )
15
16 const (
17
18 _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
19
20 _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
21 )
22
23 type FOO int32
24
25 const (
26 FOO_X FOO = 17
27 )
28
29
30 var (
31 FOO_name = map[int32]string{
32 17: "X",
33 }
34 FOO_value = map[string]int32{
35 "X": 17,
36 }
37 )
38
39 func (x FOO) Enum() *FOO {
40 p := new(FOO)
41 *p = x
42 return p
43 }
44
45 func (x FOO) String() string {
46 return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
47 }
48
49 func (FOO) Descriptor() protoreflect.EnumDescriptor {
50 return file_test_proto_enumTypes[0].Descriptor()
51 }
52
53 func (FOO) Type() protoreflect.EnumType {
54 return &file_test_proto_enumTypes[0]
55 }
56
57 func (x FOO) Number() protoreflect.EnumNumber {
58 return protoreflect.EnumNumber(x)
59 }
60
61
62 func (x *FOO) UnmarshalJSON(b []byte) error {
63 num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
64 if err != nil {
65 return err
66 }
67 *x = FOO(num)
68 return nil
69 }
70
71
72 func (FOO) EnumDescriptor() ([]byte, []int) {
73 return file_test_proto_rawDescGZIP(), []int{0}
74 }
75
76 type Test struct {
77 state protoimpl.MessageState
78 sizeCache protoimpl.SizeCache
79 unknownFields protoimpl.UnknownFields
80
81 Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"`
82 Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"`
83 Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"`
84 Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup,json=optionalgroup" json:"optionalgroup,omitempty"`
85 }
86
87
88 const (
89 Default_Test_Type = int32(77)
90 )
91
92 func (x *Test) Reset() {
93 *x = Test{}
94 if protoimpl.UnsafeEnabled {
95 mi := &file_test_proto_msgTypes[0]
96 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
97 ms.StoreMessageInfo(mi)
98 }
99 }
100
101 func (x *Test) String() string {
102 return protoimpl.X.MessageStringOf(x)
103 }
104
105 func (*Test) ProtoMessage() {}
106
107 func (x *Test) ProtoReflect() protoreflect.Message {
108 mi := &file_test_proto_msgTypes[0]
109 if protoimpl.UnsafeEnabled && x != nil {
110 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
111 if ms.LoadMessageInfo() == nil {
112 ms.StoreMessageInfo(mi)
113 }
114 return ms
115 }
116 return mi.MessageOf(x)
117 }
118
119
120 func (*Test) Descriptor() ([]byte, []int) {
121 return file_test_proto_rawDescGZIP(), []int{0}
122 }
123
124 func (x *Test) GetLabel() string {
125 if x != nil && x.Label != nil {
126 return *x.Label
127 }
128 return ""
129 }
130
131 func (x *Test) GetType() int32 {
132 if x != nil && x.Type != nil {
133 return *x.Type
134 }
135 return Default_Test_Type
136 }
137
138 func (x *Test) GetReps() []int64 {
139 if x != nil {
140 return x.Reps
141 }
142 return nil
143 }
144
145 func (x *Test) GetOptionalgroup() *Test_OptionalGroup {
146 if x != nil {
147 return x.Optionalgroup
148 }
149 return nil
150 }
151
152 type Test_OptionalGroup struct {
153 state protoimpl.MessageState
154 sizeCache protoimpl.SizeCache
155 unknownFields protoimpl.UnknownFields
156
157 RequiredField *string `protobuf:"bytes,5,req,name=RequiredField" json:"RequiredField,omitempty"`
158 }
159
160 func (x *Test_OptionalGroup) Reset() {
161 *x = Test_OptionalGroup{}
162 if protoimpl.UnsafeEnabled {
163 mi := &file_test_proto_msgTypes[1]
164 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
165 ms.StoreMessageInfo(mi)
166 }
167 }
168
169 func (x *Test_OptionalGroup) String() string {
170 return protoimpl.X.MessageStringOf(x)
171 }
172
173 func (*Test_OptionalGroup) ProtoMessage() {}
174
175 func (x *Test_OptionalGroup) ProtoReflect() protoreflect.Message {
176 mi := &file_test_proto_msgTypes[1]
177 if protoimpl.UnsafeEnabled && x != nil {
178 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
179 if ms.LoadMessageInfo() == nil {
180 ms.StoreMessageInfo(mi)
181 }
182 return ms
183 }
184 return mi.MessageOf(x)
185 }
186
187
188 func (*Test_OptionalGroup) Descriptor() ([]byte, []int) {
189 return file_test_proto_rawDescGZIP(), []int{0, 0}
190 }
191
192 func (x *Test_OptionalGroup) GetRequiredField() string {
193 if x != nil && x.RequiredField != nil {
194 return *x.RequiredField
195 }
196 return ""
197 }
198
199 var File_test_proto protoreflect.FileDescriptor
200
201 var file_test_proto_rawDesc = []byte{
202 0x0a, 0x0a, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72,
203 0x6f, 0x74, 0x6f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0xc7, 0x01, 0x0a, 0x04, 0x54,
204 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x02,
205 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x04, 0x74, 0x79, 0x70,
206 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x02, 0x37, 0x37, 0x52, 0x04, 0x74, 0x79, 0x70,
207 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x65, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52,
208 0x04, 0x72, 0x65, 0x70, 0x73, 0x12, 0x46, 0x0a, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61,
209 0x6c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0a, 0x32, 0x20, 0x2e, 0x70,
210 0x72, 0x6f, 0x74, 0x6f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x54, 0x65, 0x73, 0x74,
211 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0d,
212 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x35, 0x0a,
213 0x0d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x24,
214 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18,
215 0x05, 0x20, 0x02, 0x28, 0x09, 0x52, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x46,
216 0x69, 0x65, 0x6c, 0x64, 0x2a, 0x0c, 0x0a, 0x03, 0x46, 0x4f, 0x4f, 0x12, 0x05, 0x0a, 0x01, 0x58,
217 0x10, 0x11,
218 }
219
220 var (
221 file_test_proto_rawDescOnce sync.Once
222 file_test_proto_rawDescData = file_test_proto_rawDesc
223 )
224
225 func file_test_proto_rawDescGZIP() []byte {
226 file_test_proto_rawDescOnce.Do(func() {
227 file_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_proto_rawDescData)
228 })
229 return file_test_proto_rawDescData
230 }
231
232 var file_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
233 var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
234 var file_test_proto_goTypes = []any{
235 (FOO)(0),
236 (*Test)(nil),
237 (*Test_OptionalGroup)(nil),
238 }
239 var file_test_proto_depIdxs = []int32{
240 2,
241 1,
242 1,
243 1,
244 1,
245 0,
246 }
247
248 func init() { file_test_proto_init() }
249 func file_test_proto_init() {
250 if File_test_proto != nil {
251 return
252 }
253 if !protoimpl.UnsafeEnabled {
254 file_test_proto_msgTypes[0].Exporter = func(v any, i int) any {
255 switch v := v.(*Test); i {
256 case 0:
257 return &v.state
258 case 1:
259 return &v.sizeCache
260 case 2:
261 return &v.unknownFields
262 default:
263 return nil
264 }
265 }
266 file_test_proto_msgTypes[1].Exporter = func(v any, i int) any {
267 switch v := v.(*Test_OptionalGroup); i {
268 case 0:
269 return &v.state
270 case 1:
271 return &v.sizeCache
272 case 2:
273 return &v.unknownFields
274 default:
275 return nil
276 }
277 }
278 }
279 type x struct{}
280 out := protoimpl.TypeBuilder{
281 File: protoimpl.DescBuilder{
282 GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
283 RawDescriptor: file_test_proto_rawDesc,
284 NumEnums: 1,
285 NumMessages: 2,
286 NumExtensions: 0,
287 NumServices: 0,
288 },
289 GoTypes: file_test_proto_goTypes,
290 DependencyIndexes: file_test_proto_depIdxs,
291 EnumInfos: file_test_proto_enumTypes,
292 MessageInfos: file_test_proto_msgTypes,
293 }.Build()
294 File_test_proto = out.File
295 file_test_proto_rawDesc = nil
296 file_test_proto_goTypes = nil
297 file_test_proto_depIdxs = nil
298 }
299
View as plain text