1
2
3
4
5 package nullable
6
7 import (
8 "google.golang.org/protobuf/encoding/prototext"
9 "google.golang.org/protobuf/encoding/protowire"
10 "google.golang.org/protobuf/runtime/protoimpl"
11 "google.golang.org/protobuf/types/descriptorpb"
12 )
13
14 type Proto2 struct {
15 OptionalBool bool `protobuf:"varint,100,opt,name=optional_bool"`
16 OptionalInt32 int32 `protobuf:"varint,101,opt,name=optional_int32"`
17 OptionalInt64 int64 `protobuf:"varint,102,opt,name=optional_int64"`
18 OptionalUint32 uint32 `protobuf:"varint,103,opt,name=optional_uint32"`
19 OptionalUint64 uint64 `protobuf:"varint,104,opt,name=optional_uint64"`
20 OptionalFloat float32 `protobuf:"fixed32,105,opt,name=optional_float"`
21 OptionalDouble float64 `protobuf:"fixed64,106,opt,name=optional_double"`
22 OptionalString string `protobuf:"bytes,107,opt,name=optional_string"`
23 OptionalBytes []byte `protobuf:"bytes,108,opt,name=optional_bytes"`
24 OptionalEnum descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,109,req,name=optional_enum"`
25 OptionalMessage descriptorpb.FieldOptions `protobuf:"bytes,110,req,name=optional_message"`
26
27 RepeatedBool []bool `protobuf:"varint,200,rep,name=repeated_bool"`
28 RepeatedInt32 []int32 `protobuf:"varint,201,rep,name=repeated_int32"`
29 RepeatedInt64 []int64 `protobuf:"varint,202,rep,name=repeated_int64"`
30 RepeatedUint32 []uint32 `protobuf:"varint,203,rep,name=repeated_uint32"`
31 RepeatedUint64 []uint64 `protobuf:"varint,204,rep,name=repeated_uint64"`
32 RepeatedFloat []float32 `protobuf:"fixed32,205,rep,name=repeated_float"`
33 RepeatedDouble []float64 `protobuf:"fixed64,206,rep,name=repeated_double"`
34 RepeatedString []string `protobuf:"bytes,207,rep,name=repeated_string"`
35 RepeatedBytes [][]byte `protobuf:"bytes,208,rep,name=repeated_bytes"`
36 RepeatedEnum []descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,209,rep,name=repeated_enum"`
37 RepeatedMessage []descriptorpb.FieldOptions `protobuf:"bytes,210,rep,name=repeated_message"`
38
39 MapBool map[string]bool `protobuf:"bytes,300,rep,name=map_bool" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
40 MapInt32 map[string]int32 `protobuf:"bytes,301,rep,name=map_int32" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
41 MapInt64 map[string]int64 `protobuf:"bytes,302,rep,name=map_int64" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
42 MapUint32 map[string]uint32 `protobuf:"bytes,303,rep,name=map_uint32" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
43 MapUint64 map[string]uint64 `protobuf:"bytes,304,rep,name=map_uint64" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
44 MapFloat map[string]float32 `protobuf:"bytes,305,rep,name=map_float" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"fixed32,2,opt,name=value"`
45 MapDouble map[string]float64 `protobuf:"bytes,306,rep,name=map_double" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"fixed64,2,opt,name=value"`
46 MapString map[string]string `protobuf:"bytes,307,rep,name=map_string" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
47 MapBytes map[string][]byte `protobuf:"bytes,308,rep,name=map_bytes" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
48 MapEnum map[string]descriptorpb.FieldDescriptorProto_Type `protobuf:"bytes,309,rep,name=map_enum" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
49 MapMessage map[string]descriptorpb.FieldOptions `protobuf:"bytes,310,rep,name=map_message" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
50
51 OneofUnion isProto2_OneofUnion `protobuf_oneof:"oneof_union"`
52 }
53
54 func (x *Proto2) ProtoMessage() {}
55 func (x *Proto2) Reset() { *x = Proto2{} }
56 func (x *Proto2) String() string { return prototext.Format(protoimpl.X.ProtoMessageV2Of(x)) }
57 func (x *Proto2) XXX_OneofWrappers() []interface{} {
58 return []interface{}{
59 (*Proto2_OneofBool)(nil),
60 (*Proto2_OneofInt32)(nil),
61 (*Proto2_OneofInt64)(nil),
62 (*Proto2_OneofUint32)(nil),
63 (*Proto2_OneofUint64)(nil),
64 (*Proto2_OneofFloat)(nil),
65 (*Proto2_OneofDouble)(nil),
66 (*Proto2_OneofString)(nil),
67 (*Proto2_OneofBytes)(nil),
68 (*Proto2_OneofEnum)(nil),
69 (*Proto2_OneofMessage)(nil),
70 }
71 }
72
73 type isProto2_OneofUnion interface{ isProto2_OneofUnion() }
74
75 type Proto2_OneofBool struct {
76 OneofBool bool `protobuf:"varint,400,opt,name=oneof_bool,oneof"`
77 }
78 type Proto2_OneofInt32 struct {
79 OneofInt32 int32 `protobuf:"varint,401,opt,name=oneof_int32,oneof"`
80 }
81 type Proto2_OneofInt64 struct {
82 OneofInt64 int64 `protobuf:"varint,402,opt,name=oneof_int64,oneof"`
83 }
84 type Proto2_OneofUint32 struct {
85 OneofUint32 uint32 `protobuf:"varint,403,opt,name=oneof_uint32,oneof"`
86 }
87 type Proto2_OneofUint64 struct {
88 OneofUint64 uint64 `protobuf:"varint,404,opt,name=oneof_uint64,oneof"`
89 }
90 type Proto2_OneofFloat struct {
91 OneofFloat float32 `protobuf:"fixed32,405,opt,name=oneof_float,oneof"`
92 }
93 type Proto2_OneofDouble struct {
94 OneofDouble float64 `protobuf:"fixed64,406,opt,name=oneof_double,oneof"`
95 }
96 type Proto2_OneofString struct {
97 OneofString string `protobuf:"bytes,407,opt,name=oneof_string,oneof"`
98 }
99 type Proto2_OneofBytes struct {
100 OneofBytes []byte `protobuf:"bytes,408,opt,name=oneof_bytes,oneof"`
101 }
102 type Proto2_OneofEnum struct {
103 OneofEnum descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,409,opt,name=oneof_enum,oneof"`
104 }
105 type Proto2_OneofMessage struct {
106 OneofMessage descriptorpb.FieldOptions `protobuf:"bytes,410,opt,name=oneof_message,oneof"`
107 }
108
109 func (*Proto2_OneofBool) isProto2_OneofUnion() {}
110 func (*Proto2_OneofInt32) isProto2_OneofUnion() {}
111 func (*Proto2_OneofInt64) isProto2_OneofUnion() {}
112 func (*Proto2_OneofUint32) isProto2_OneofUnion() {}
113 func (*Proto2_OneofUint64) isProto2_OneofUnion() {}
114 func (*Proto2_OneofFloat) isProto2_OneofUnion() {}
115 func (*Proto2_OneofDouble) isProto2_OneofUnion() {}
116 func (*Proto2_OneofString) isProto2_OneofUnion() {}
117 func (*Proto2_OneofBytes) isProto2_OneofUnion() {}
118 func (*Proto2_OneofEnum) isProto2_OneofUnion() {}
119 func (*Proto2_OneofMessage) isProto2_OneofUnion() {}
120
121 type Proto3 struct {
122 OptionalBool bool `protobuf:"varint,100,opt,name=optional_bool,proto3"`
123 OptionalInt32 int32 `protobuf:"varint,101,opt,name=optional_int32,proto3"`
124 OptionalInt64 int64 `protobuf:"varint,102,opt,name=optional_int64,proto3"`
125 OptionalUint32 uint32 `protobuf:"varint,103,opt,name=optional_uint32,proto3"`
126 OptionalUint64 uint64 `protobuf:"varint,104,opt,name=optional_uint64,proto3"`
127 OptionalFloat float32 `protobuf:"fixed32,105,opt,name=optional_float,proto3"`
128 OptionalDouble float64 `protobuf:"fixed64,106,opt,name=optional_double,proto3"`
129 OptionalString string `protobuf:"bytes,107,opt,name=optional_string,proto3"`
130 OptionalBytes []byte `protobuf:"bytes,108,opt,name=optional_bytes,proto3"`
131 OptionalEnum descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,109,req,name=optional_enum,proto3"`
132 OptionalMessage descriptorpb.FieldOptions `protobuf:"bytes,110,req,name=optional_message,proto3"`
133
134 RepeatedBool []bool `protobuf:"varint,200,rep,name=repeated_bool,proto3"`
135 RepeatedInt32 []int32 `protobuf:"varint,201,rep,name=repeated_int32,proto3"`
136 RepeatedInt64 []int64 `protobuf:"varint,202,rep,name=repeated_int64,proto3"`
137 RepeatedUint32 []uint32 `protobuf:"varint,203,rep,name=repeated_uint32,proto3"`
138 RepeatedUint64 []uint64 `protobuf:"varint,204,rep,name=repeated_uint64,proto3"`
139 RepeatedFloat []float32 `protobuf:"fixed32,205,rep,name=repeated_float,proto3"`
140 RepeatedDouble []float64 `protobuf:"fixed64,206,rep,name=repeated_double,proto3"`
141 RepeatedString []string `protobuf:"bytes,207,rep,name=repeated_string,proto3"`
142 RepeatedBytes [][]byte `protobuf:"bytes,208,rep,name=repeated_bytes,proto3"`
143 RepeatedEnum []descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,209,rep,name=repeated_enum,proto3"`
144 RepeatedMessage []descriptorpb.FieldOptions `protobuf:"bytes,210,rep,name=repeated_message,proto3"`
145
146 MapBool map[string]bool `protobuf:"bytes,300,rep,name=map_bool,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
147 MapInt32 map[string]int32 `protobuf:"bytes,301,rep,name=map_int32,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
148 MapInt64 map[string]int64 `protobuf:"bytes,302,rep,name=map_int64,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
149 MapUint32 map[string]uint32 `protobuf:"bytes,303,rep,name=map_uint32,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
150 MapUint64 map[string]uint64 `protobuf:"bytes,304,rep,name=map_uint64,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
151 MapFloat map[string]float32 `protobuf:"bytes,305,rep,name=map_float,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
152 MapDouble map[string]float64 `protobuf:"bytes,306,rep,name=map_double,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
153 MapString map[string]string `protobuf:"bytes,307,rep,name=map_string,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
154 MapBytes map[string][]byte `protobuf:"bytes,308,rep,name=map_bytes,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
155 MapEnum map[string]descriptorpb.FieldDescriptorProto_Type `protobuf:"bytes,309,rep,name=map_enum,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
156 MapMessage map[string]descriptorpb.FieldOptions `protobuf:"bytes,310,rep,name=map_message,proto3" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
157
158 OneofUnion isProto3_OneofUnion `protobuf_oneof:"oneof_union"`
159 }
160
161 func (x *Proto3) ProtoMessage() {}
162 func (x *Proto3) Reset() { *x = Proto3{} }
163 func (x *Proto3) String() string { return prototext.Format(protoimpl.X.ProtoMessageV2Of(x)) }
164 func (x *Proto3) XXX_OneofWrappers() []interface{} {
165 return []interface{}{
166 (*Proto3_OneofBool)(nil),
167 (*Proto3_OneofInt32)(nil),
168 (*Proto3_OneofInt64)(nil),
169 (*Proto3_OneofUint32)(nil),
170 (*Proto3_OneofUint64)(nil),
171 (*Proto3_OneofFloat)(nil),
172 (*Proto3_OneofDouble)(nil),
173 (*Proto3_OneofString)(nil),
174 (*Proto3_OneofBytes)(nil),
175 (*Proto3_OneofEnum)(nil),
176 (*Proto3_OneofMessage)(nil),
177 }
178 }
179
180 type isProto3_OneofUnion interface{ isProto3_OneofUnion() }
181
182 type Proto3_OneofBool struct {
183 OneofBool bool `protobuf:"varint,400,opt,name=oneof_bool,proto3,oneof"`
184 }
185 type Proto3_OneofInt32 struct {
186 OneofInt32 int32 `protobuf:"varint,401,opt,name=oneof_int32,proto3,oneof"`
187 }
188 type Proto3_OneofInt64 struct {
189 OneofInt64 int64 `protobuf:"varint,402,opt,name=oneof_int64,proto3,oneof"`
190 }
191 type Proto3_OneofUint32 struct {
192 OneofUint32 uint32 `protobuf:"varint,403,opt,name=oneof_uint32,proto3,oneof"`
193 }
194 type Proto3_OneofUint64 struct {
195 OneofUint64 uint64 `protobuf:"varint,404,opt,name=oneof_uint64,proto3,oneof"`
196 }
197 type Proto3_OneofFloat struct {
198 OneofFloat float32 `protobuf:"fixed32,405,opt,name=oneof_float,proto3,oneof"`
199 }
200 type Proto3_OneofDouble struct {
201 OneofDouble float64 `protobuf:"fixed64,406,opt,name=oneof_double,proto3,oneof"`
202 }
203 type Proto3_OneofString struct {
204 OneofString string `protobuf:"bytes,407,opt,name=oneof_string,proto3,oneof"`
205 }
206 type Proto3_OneofBytes struct {
207 OneofBytes []byte `protobuf:"bytes,408,opt,name=oneof_bytes,proto3,oneof"`
208 }
209 type Proto3_OneofEnum struct {
210 OneofEnum descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,409,opt,name=oneof_enum,proto3,oneof"`
211 }
212 type Proto3_OneofMessage struct {
213 OneofMessage descriptorpb.FieldOptions `protobuf:"bytes,410,opt,name=oneof_message,proto3,oneof"`
214 }
215
216 func (*Proto3_OneofBool) isProto3_OneofUnion() {}
217 func (*Proto3_OneofInt32) isProto3_OneofUnion() {}
218 func (*Proto3_OneofInt64) isProto3_OneofUnion() {}
219 func (*Proto3_OneofUint32) isProto3_OneofUnion() {}
220 func (*Proto3_OneofUint64) isProto3_OneofUnion() {}
221 func (*Proto3_OneofFloat) isProto3_OneofUnion() {}
222 func (*Proto3_OneofDouble) isProto3_OneofUnion() {}
223 func (*Proto3_OneofString) isProto3_OneofUnion() {}
224 func (*Proto3_OneofBytes) isProto3_OneofUnion() {}
225 func (*Proto3_OneofEnum) isProto3_OneofUnion() {}
226 func (*Proto3_OneofMessage) isProto3_OneofUnion() {}
227
228 type Methods struct {
229 OptionalInt32 int32 `protobuf:"varint,101,opt,name=optional_int32"`
230 }
231
232 func (x *Methods) ProtoMessage() {}
233 func (x *Methods) Reset() { *x = Methods{} }
234 func (x *Methods) String() string { return prototext.Format(protoimpl.X.ProtoMessageV2Of(x)) }
235
236 func (x *Methods) Marshal() ([]byte, error) {
237 var b []byte
238 b = protowire.AppendTag(b, 101, protowire.VarintType)
239 b = protowire.AppendVarint(b, uint64(x.OptionalInt32))
240 return b, nil
241 }
242
243 func (x *Methods) Unmarshal(b []byte) error {
244 for len(b) > 0 {
245 num, typ, n := protowire.ConsumeTag(b)
246 if n < 0 {
247 return protowire.ParseError(n)
248 }
249 b = b[n:]
250 if num != 101 || typ != protowire.VarintType {
251 n = protowire.ConsumeFieldValue(num, typ, b)
252 if n < 0 {
253 return protowire.ParseError(n)
254 }
255 b = b[n:]
256 continue
257 }
258 v, n := protowire.ConsumeVarint(b)
259 if n < 0 {
260 return protowire.ParseError(n)
261 }
262 b = b[n:]
263 x.OptionalInt32 = int32(v)
264 }
265 return nil
266 }
267
View as plain text