1
2
3
4 package types
5
6 import (
7 bytes "bytes"
8 fmt "fmt"
9 proto "github.com/gogo/protobuf/proto"
10 io "io"
11 math "math"
12 math_bits "math/bits"
13 reflect "reflect"
14 strings "strings"
15 )
16
17
18 var _ = proto.Marshal
19 var _ = fmt.Errorf
20 var _ = math.Inf
21
22
23
24
25
26 const _ = proto.GoGoProtoPackageIsVersion3
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 type Duration struct {
89
90
91
92 Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
93
94
95
96
97
98
99 Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
100 XXX_NoUnkeyedLiteral struct{} `json:"-"`
101 XXX_unrecognized []byte `json:"-"`
102 XXX_sizecache int32 `json:"-"`
103 }
104
105 func (m *Duration) Reset() { *m = Duration{} }
106 func (*Duration) ProtoMessage() {}
107 func (*Duration) Descriptor() ([]byte, []int) {
108 return fileDescriptor_23597b2ebd7ac6c5, []int{0}
109 }
110 func (*Duration) XXX_WellKnownType() string { return "Duration" }
111 func (m *Duration) XXX_Unmarshal(b []byte) error {
112 return m.Unmarshal(b)
113 }
114 func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
115 if deterministic {
116 return xxx_messageInfo_Duration.Marshal(b, m, deterministic)
117 } else {
118 b = b[:cap(b)]
119 n, err := m.MarshalToSizedBuffer(b)
120 if err != nil {
121 return nil, err
122 }
123 return b[:n], nil
124 }
125 }
126 func (m *Duration) XXX_Merge(src proto.Message) {
127 xxx_messageInfo_Duration.Merge(m, src)
128 }
129 func (m *Duration) XXX_Size() int {
130 return m.Size()
131 }
132 func (m *Duration) XXX_DiscardUnknown() {
133 xxx_messageInfo_Duration.DiscardUnknown(m)
134 }
135
136 var xxx_messageInfo_Duration proto.InternalMessageInfo
137
138 func (m *Duration) GetSeconds() int64 {
139 if m != nil {
140 return m.Seconds
141 }
142 return 0
143 }
144
145 func (m *Duration) GetNanos() int32 {
146 if m != nil {
147 return m.Nanos
148 }
149 return 0
150 }
151
152 func (*Duration) XXX_MessageName() string {
153 return "google.protobuf.Duration"
154 }
155 func init() {
156 proto.RegisterType((*Duration)(nil), "google.protobuf.Duration")
157 }
158
159 func init() { proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_23597b2ebd7ac6c5) }
160
161 var fileDescriptor_23597b2ebd7ac6c5 = []byte{
162
163 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
164 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a,
165 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56,
166 0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5,
167 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e,
168 0x7e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x84, 0xe3, 0x54, 0x7f, 0xe3, 0xa1, 0x1c,
169 0xc3, 0x87, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91,
170 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x78, 0x24, 0xc7, 0xb8, 0xe2,
171 0xb1, 0x1c, 0xe3, 0x89, 0xc7, 0x72, 0x8c, 0x5c, 0xc2, 0xc9, 0xf9, 0xb9, 0x7a, 0x68, 0x56, 0x3b,
172 0xf1, 0xc2, 0x2c, 0x0e, 0x00, 0x89, 0x04, 0x30, 0x46, 0xb1, 0x96, 0x54, 0x16, 0xa4, 0x16, 0xff,
173 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0xa2, 0x25, 0x00,
174 0xaa, 0x45, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, 0x2f, 0x04, 0xa4, 0x32, 0x89,
175 0x0d, 0x6c, 0x96, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x1c, 0x64, 0x4e, 0xf6, 0x00, 0x00,
176 0x00,
177 }
178
179 func (this *Duration) Compare(that interface{}) int {
180 if that == nil {
181 if this == nil {
182 return 0
183 }
184 return 1
185 }
186
187 that1, ok := that.(*Duration)
188 if !ok {
189 that2, ok := that.(Duration)
190 if ok {
191 that1 = &that2
192 } else {
193 return 1
194 }
195 }
196 if that1 == nil {
197 if this == nil {
198 return 0
199 }
200 return 1
201 } else if this == nil {
202 return -1
203 }
204 if this.Seconds != that1.Seconds {
205 if this.Seconds < that1.Seconds {
206 return -1
207 }
208 return 1
209 }
210 if this.Nanos != that1.Nanos {
211 if this.Nanos < that1.Nanos {
212 return -1
213 }
214 return 1
215 }
216 if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 {
217 return c
218 }
219 return 0
220 }
221 func (this *Duration) Equal(that interface{}) bool {
222 if that == nil {
223 return this == nil
224 }
225
226 that1, ok := that.(*Duration)
227 if !ok {
228 that2, ok := that.(Duration)
229 if ok {
230 that1 = &that2
231 } else {
232 return false
233 }
234 }
235 if that1 == nil {
236 return this == nil
237 } else if this == nil {
238 return false
239 }
240 if this.Seconds != that1.Seconds {
241 return false
242 }
243 if this.Nanos != that1.Nanos {
244 return false
245 }
246 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
247 return false
248 }
249 return true
250 }
251 func (this *Duration) GoString() string {
252 if this == nil {
253 return "nil"
254 }
255 s := make([]string, 0, 6)
256 s = append(s, "&types.Duration{")
257 s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n")
258 s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n")
259 if this.XXX_unrecognized != nil {
260 s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
261 }
262 s = append(s, "}")
263 return strings.Join(s, "")
264 }
265 func valueToGoStringDuration(v interface{}, typ string) string {
266 rv := reflect.ValueOf(v)
267 if rv.IsNil() {
268 return "nil"
269 }
270 pv := reflect.Indirect(rv).Interface()
271 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
272 }
273 func (m *Duration) Marshal() (dAtA []byte, err error) {
274 size := m.Size()
275 dAtA = make([]byte, size)
276 n, err := m.MarshalToSizedBuffer(dAtA[:size])
277 if err != nil {
278 return nil, err
279 }
280 return dAtA[:n], nil
281 }
282
283 func (m *Duration) MarshalTo(dAtA []byte) (int, error) {
284 size := m.Size()
285 return m.MarshalToSizedBuffer(dAtA[:size])
286 }
287
288 func (m *Duration) MarshalToSizedBuffer(dAtA []byte) (int, error) {
289 i := len(dAtA)
290 _ = i
291 var l int
292 _ = l
293 if m.XXX_unrecognized != nil {
294 i -= len(m.XXX_unrecognized)
295 copy(dAtA[i:], m.XXX_unrecognized)
296 }
297 if m.Nanos != 0 {
298 i = encodeVarintDuration(dAtA, i, uint64(m.Nanos))
299 i--
300 dAtA[i] = 0x10
301 }
302 if m.Seconds != 0 {
303 i = encodeVarintDuration(dAtA, i, uint64(m.Seconds))
304 i--
305 dAtA[i] = 0x8
306 }
307 return len(dAtA) - i, nil
308 }
309
310 func encodeVarintDuration(dAtA []byte, offset int, v uint64) int {
311 offset -= sovDuration(v)
312 base := offset
313 for v >= 1<<7 {
314 dAtA[offset] = uint8(v&0x7f | 0x80)
315 v >>= 7
316 offset++
317 }
318 dAtA[offset] = uint8(v)
319 return base
320 }
321 func (m *Duration) Size() (n int) {
322 if m == nil {
323 return 0
324 }
325 var l int
326 _ = l
327 if m.Seconds != 0 {
328 n += 1 + sovDuration(uint64(m.Seconds))
329 }
330 if m.Nanos != 0 {
331 n += 1 + sovDuration(uint64(m.Nanos))
332 }
333 if m.XXX_unrecognized != nil {
334 n += len(m.XXX_unrecognized)
335 }
336 return n
337 }
338
339 func sovDuration(x uint64) (n int) {
340 return (math_bits.Len64(x|1) + 6) / 7
341 }
342 func sozDuration(x uint64) (n int) {
343 return sovDuration(uint64((x << 1) ^ uint64((int64(x) >> 63))))
344 }
345 func (m *Duration) Unmarshal(dAtA []byte) error {
346 l := len(dAtA)
347 iNdEx := 0
348 for iNdEx < l {
349 preIndex := iNdEx
350 var wire uint64
351 for shift := uint(0); ; shift += 7 {
352 if shift >= 64 {
353 return ErrIntOverflowDuration
354 }
355 if iNdEx >= l {
356 return io.ErrUnexpectedEOF
357 }
358 b := dAtA[iNdEx]
359 iNdEx++
360 wire |= uint64(b&0x7F) << shift
361 if b < 0x80 {
362 break
363 }
364 }
365 fieldNum := int32(wire >> 3)
366 wireType := int(wire & 0x7)
367 if wireType == 4 {
368 return fmt.Errorf("proto: Duration: wiretype end group for non-group")
369 }
370 if fieldNum <= 0 {
371 return fmt.Errorf("proto: Duration: illegal tag %d (wire type %d)", fieldNum, wire)
372 }
373 switch fieldNum {
374 case 1:
375 if wireType != 0 {
376 return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType)
377 }
378 m.Seconds = 0
379 for shift := uint(0); ; shift += 7 {
380 if shift >= 64 {
381 return ErrIntOverflowDuration
382 }
383 if iNdEx >= l {
384 return io.ErrUnexpectedEOF
385 }
386 b := dAtA[iNdEx]
387 iNdEx++
388 m.Seconds |= int64(b&0x7F) << shift
389 if b < 0x80 {
390 break
391 }
392 }
393 case 2:
394 if wireType != 0 {
395 return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType)
396 }
397 m.Nanos = 0
398 for shift := uint(0); ; shift += 7 {
399 if shift >= 64 {
400 return ErrIntOverflowDuration
401 }
402 if iNdEx >= l {
403 return io.ErrUnexpectedEOF
404 }
405 b := dAtA[iNdEx]
406 iNdEx++
407 m.Nanos |= int32(b&0x7F) << shift
408 if b < 0x80 {
409 break
410 }
411 }
412 default:
413 iNdEx = preIndex
414 skippy, err := skipDuration(dAtA[iNdEx:])
415 if err != nil {
416 return err
417 }
418 if (skippy < 0) || (iNdEx+skippy) < 0 {
419 return ErrInvalidLengthDuration
420 }
421 if (iNdEx + skippy) > l {
422 return io.ErrUnexpectedEOF
423 }
424 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
425 iNdEx += skippy
426 }
427 }
428
429 if iNdEx > l {
430 return io.ErrUnexpectedEOF
431 }
432 return nil
433 }
434 func skipDuration(dAtA []byte) (n int, err error) {
435 l := len(dAtA)
436 iNdEx := 0
437 depth := 0
438 for iNdEx < l {
439 var wire uint64
440 for shift := uint(0); ; shift += 7 {
441 if shift >= 64 {
442 return 0, ErrIntOverflowDuration
443 }
444 if iNdEx >= l {
445 return 0, io.ErrUnexpectedEOF
446 }
447 b := dAtA[iNdEx]
448 iNdEx++
449 wire |= (uint64(b) & 0x7F) << shift
450 if b < 0x80 {
451 break
452 }
453 }
454 wireType := int(wire & 0x7)
455 switch wireType {
456 case 0:
457 for shift := uint(0); ; shift += 7 {
458 if shift >= 64 {
459 return 0, ErrIntOverflowDuration
460 }
461 if iNdEx >= l {
462 return 0, io.ErrUnexpectedEOF
463 }
464 iNdEx++
465 if dAtA[iNdEx-1] < 0x80 {
466 break
467 }
468 }
469 case 1:
470 iNdEx += 8
471 case 2:
472 var length int
473 for shift := uint(0); ; shift += 7 {
474 if shift >= 64 {
475 return 0, ErrIntOverflowDuration
476 }
477 if iNdEx >= l {
478 return 0, io.ErrUnexpectedEOF
479 }
480 b := dAtA[iNdEx]
481 iNdEx++
482 length |= (int(b) & 0x7F) << shift
483 if b < 0x80 {
484 break
485 }
486 }
487 if length < 0 {
488 return 0, ErrInvalidLengthDuration
489 }
490 iNdEx += length
491 case 3:
492 depth++
493 case 4:
494 if depth == 0 {
495 return 0, ErrUnexpectedEndOfGroupDuration
496 }
497 depth--
498 case 5:
499 iNdEx += 4
500 default:
501 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
502 }
503 if iNdEx < 0 {
504 return 0, ErrInvalidLengthDuration
505 }
506 if depth == 0 {
507 return iNdEx, nil
508 }
509 }
510 return 0, io.ErrUnexpectedEOF
511 }
512
513 var (
514 ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling")
515 ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow")
516 ErrUnexpectedEndOfGroupDuration = fmt.Errorf("proto: unexpected end of group")
517 )
518
View as plain text