1// Code generated by protoc-gen-gogo. DO NOT EDIT. 2// source: google/type/date.proto 3 4package google_type 5 6import ( 7 fmt "fmt" 8 proto "github.com/gogo/protobuf/proto" 9 io "io" 10 math "math" 11 math_bits "math/bits" 12 reflect "reflect" 13 strings "strings" 14) 15 16// Reference imports to suppress errors if they are not otherwise used. 17var _ = proto.Marshal 18var _ = fmt.Errorf 19var _ = math.Inf 20 21// This is a compile-time assertion to ensure that this generated file 22// is compatible with the proto package it is being compiled against. 23// A compilation error at this line likely means your copy of the 24// proto package needs to be updated. 25const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 26 27// Represents a whole or partial calendar date, e.g. a birthday. The time of day 28// and time zone are either specified elsewhere or are not significant. The date 29// is relative to the Proleptic Gregorian Calendar. This can represent: 30// 31// * A full date, with non-zero year, month and day values 32// * A month and day value, with a zero year, e.g. an anniversary 33// * A year on its own, with zero month and day values 34// * A year and month value, with a zero day, e.g. a credit card expiration date 35// 36// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. 37type Date struct { 38 // Year of date. Must be from 1 to 9999, or 0 if specifying a date without 39 // a year. 40 Year int32 `protobuf:"varint,1,opt,name=year,proto3" json:"year,omitempty"` 41 // Month of year. Must be from 1 to 12, or 0 if specifying a year without a 42 // month and day. 43 Month int32 `protobuf:"varint,2,opt,name=month,proto3" json:"month,omitempty"` 44 // Day of month. Must be from 1 to 31 and valid for the year and month, or 0 45 // if specifying a year by itself or a year and month where the day is not 46 // significant. 47 Day int32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"` 48} 49 50func (m *Date) Reset() { *m = Date{} } 51func (*Date) ProtoMessage() {} 52func (*Date) Descriptor() ([]byte, []int) { 53 return fileDescriptor_92c30699df886e3f, []int{0} 54} 55func (m *Date) XXX_Unmarshal(b []byte) error { 56 return m.Unmarshal(b) 57} 58func (m *Date) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 59 if deterministic { 60 return xxx_messageInfo_Date.Marshal(b, m, deterministic) 61 } else { 62 b = b[:cap(b)] 63 n, err := m.MarshalToSizedBuffer(b) 64 if err != nil { 65 return nil, err 66 } 67 return b[:n], nil 68 } 69} 70func (m *Date) XXX_Merge(src proto.Message) { 71 xxx_messageInfo_Date.Merge(m, src) 72} 73func (m *Date) XXX_Size() int { 74 return m.Size() 75} 76func (m *Date) XXX_DiscardUnknown() { 77 xxx_messageInfo_Date.DiscardUnknown(m) 78} 79 80var xxx_messageInfo_Date proto.InternalMessageInfo 81 82func (m *Date) GetYear() int32 { 83 if m != nil { 84 return m.Year 85 } 86 return 0 87} 88 89func (m *Date) GetMonth() int32 { 90 if m != nil { 91 return m.Month 92 } 93 return 0 94} 95 96func (m *Date) GetDay() int32 { 97 if m != nil { 98 return m.Day 99 } 100 return 0 101} 102 103func init() { 104 proto.RegisterType((*Date)(nil), "google.type.Date") 105} 106 107func init() { proto.RegisterFile("google/type/date.proto", fileDescriptor_92c30699df886e3f) } 108 109var fileDescriptor_92c30699df886e3f = []byte{ 110 // 196 bytes of a gzipped FileDescriptorProto 111 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xcf, 0xcf, 0x4f, 112 0xcf, 0x49, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x4f, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28, 0xca, 113 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x88, 0xeb, 0x81, 0xc4, 0x95, 0x9c, 0xb8, 0x58, 0x5c, 0x12, 0x4b, 114 0x52, 0x85, 0x84, 0xb8, 0x58, 0x2a, 0x53, 0x13, 0x8b, 0x24, 0x18, 0x15, 0x18, 0x35, 0x58, 0x83, 115 0xc0, 0x6c, 0x21, 0x11, 0x2e, 0xd6, 0xdc, 0xfc, 0xbc, 0x92, 0x0c, 0x09, 0x26, 0xb0, 0x20, 0x84, 116 0x23, 0x24, 0xc0, 0xc5, 0x9c, 0x92, 0x58, 0x29, 0xc1, 0x0c, 0x16, 0x03, 0x31, 0x9d, 0xa2, 0x2f, 117 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0x50, 0x8e, 0xe1, 0xc3, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 118 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 119 0x8c, 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 120 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x70, 0xf1, 0x27, 0xe7, 0xe7, 0xea, 0x21, 0x39, 0xc5, 0x89, 121 0x13, 0xe4, 0x90, 0x00, 0x90, 0x13, 0x03, 0x18, 0x7f, 0x30, 0x32, 0x2e, 0x62, 0x62, 0x76, 0x0f, 122 0x09, 0x48, 0x62, 0x03, 0x3b, 0xda, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xa2, 0xef, 0x4e, 0xfa, 123 0xce, 0x00, 0x00, 0x00, 124} 125 126func (this *Date) Equal(that interface{}) bool { 127 if that == nil { 128 return this == nil 129 } 130 131 that1, ok := that.(*Date) 132 if !ok { 133 that2, ok := that.(Date) 134 if ok { 135 that1 = &that2 136 } else { 137 return false 138 } 139 } 140 if that1 == nil { 141 return this == nil 142 } else if this == nil { 143 return false 144 } 145 if this.Year != that1.Year { 146 return false 147 } 148 if this.Month != that1.Month { 149 return false 150 } 151 if this.Day != that1.Day { 152 return false 153 } 154 return true 155} 156func (this *Date) GoString() string { 157 if this == nil { 158 return "nil" 159 } 160 s := make([]string, 0, 7) 161 s = append(s, "&google_type.Date{") 162 s = append(s, "Year: "+fmt.Sprintf("%#v", this.Year)+",\n") 163 s = append(s, "Month: "+fmt.Sprintf("%#v", this.Month)+",\n") 164 s = append(s, "Day: "+fmt.Sprintf("%#v", this.Day)+",\n") 165 s = append(s, "}") 166 return strings.Join(s, "") 167} 168func valueToGoStringDate(v interface{}, typ string) string { 169 rv := reflect.ValueOf(v) 170 if rv.IsNil() { 171 return "nil" 172 } 173 pv := reflect.Indirect(rv).Interface() 174 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 175} 176func (m *Date) Marshal() (dAtA []byte, err error) { 177 size := m.Size() 178 dAtA = make([]byte, size) 179 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 180 if err != nil { 181 return nil, err 182 } 183 return dAtA[:n], nil 184} 185 186func (m *Date) MarshalTo(dAtA []byte) (int, error) { 187 size := m.Size() 188 return m.MarshalToSizedBuffer(dAtA[:size]) 189} 190 191func (m *Date) MarshalToSizedBuffer(dAtA []byte) (int, error) { 192 i := len(dAtA) 193 _ = i 194 var l int 195 _ = l 196 if m.Day != 0 { 197 i = encodeVarintDate(dAtA, i, uint64(m.Day)) 198 i-- 199 dAtA[i] = 0x18 200 } 201 if m.Month != 0 { 202 i = encodeVarintDate(dAtA, i, uint64(m.Month)) 203 i-- 204 dAtA[i] = 0x10 205 } 206 if m.Year != 0 { 207 i = encodeVarintDate(dAtA, i, uint64(m.Year)) 208 i-- 209 dAtA[i] = 0x8 210 } 211 return len(dAtA) - i, nil 212} 213 214func encodeVarintDate(dAtA []byte, offset int, v uint64) int { 215 offset -= sovDate(v) 216 base := offset 217 for v >= 1<<7 { 218 dAtA[offset] = uint8(v&0x7f | 0x80) 219 v >>= 7 220 offset++ 221 } 222 dAtA[offset] = uint8(v) 223 return base 224} 225func (m *Date) Size() (n int) { 226 if m == nil { 227 return 0 228 } 229 var l int 230 _ = l 231 if m.Year != 0 { 232 n += 1 + sovDate(uint64(m.Year)) 233 } 234 if m.Month != 0 { 235 n += 1 + sovDate(uint64(m.Month)) 236 } 237 if m.Day != 0 { 238 n += 1 + sovDate(uint64(m.Day)) 239 } 240 return n 241} 242 243func sovDate(x uint64) (n int) { 244 return (math_bits.Len64(x|1) + 6) / 7 245} 246func sozDate(x uint64) (n int) { 247 return sovDate(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 248} 249func (this *Date) String() string { 250 if this == nil { 251 return "nil" 252 } 253 s := strings.Join([]string{`&Date{`, 254 `Year:` + fmt.Sprintf("%v", this.Year) + `,`, 255 `Month:` + fmt.Sprintf("%v", this.Month) + `,`, 256 `Day:` + fmt.Sprintf("%v", this.Day) + `,`, 257 `}`, 258 }, "") 259 return s 260} 261func valueToStringDate(v interface{}) string { 262 rv := reflect.ValueOf(v) 263 if rv.IsNil() { 264 return "nil" 265 } 266 pv := reflect.Indirect(rv).Interface() 267 return fmt.Sprintf("*%v", pv) 268} 269func (m *Date) Unmarshal(dAtA []byte) error { 270 l := len(dAtA) 271 iNdEx := 0 272 for iNdEx < l { 273 preIndex := iNdEx 274 var wire uint64 275 for shift := uint(0); ; shift += 7 { 276 if shift >= 64 { 277 return ErrIntOverflowDate 278 } 279 if iNdEx >= l { 280 return io.ErrUnexpectedEOF 281 } 282 b := dAtA[iNdEx] 283 iNdEx++ 284 wire |= uint64(b&0x7F) << shift 285 if b < 0x80 { 286 break 287 } 288 } 289 fieldNum := int32(wire >> 3) 290 wireType := int(wire & 0x7) 291 if wireType == 4 { 292 return fmt.Errorf("proto: Date: wiretype end group for non-group") 293 } 294 if fieldNum <= 0 { 295 return fmt.Errorf("proto: Date: illegal tag %d (wire type %d)", fieldNum, wire) 296 } 297 switch fieldNum { 298 case 1: 299 if wireType != 0 { 300 return fmt.Errorf("proto: wrong wireType = %d for field Year", wireType) 301 } 302 m.Year = 0 303 for shift := uint(0); ; shift += 7 { 304 if shift >= 64 { 305 return ErrIntOverflowDate 306 } 307 if iNdEx >= l { 308 return io.ErrUnexpectedEOF 309 } 310 b := dAtA[iNdEx] 311 iNdEx++ 312 m.Year |= int32(b&0x7F) << shift 313 if b < 0x80 { 314 break 315 } 316 } 317 case 2: 318 if wireType != 0 { 319 return fmt.Errorf("proto: wrong wireType = %d for field Month", wireType) 320 } 321 m.Month = 0 322 for shift := uint(0); ; shift += 7 { 323 if shift >= 64 { 324 return ErrIntOverflowDate 325 } 326 if iNdEx >= l { 327 return io.ErrUnexpectedEOF 328 } 329 b := dAtA[iNdEx] 330 iNdEx++ 331 m.Month |= int32(b&0x7F) << shift 332 if b < 0x80 { 333 break 334 } 335 } 336 case 3: 337 if wireType != 0 { 338 return fmt.Errorf("proto: wrong wireType = %d for field Day", wireType) 339 } 340 m.Day = 0 341 for shift := uint(0); ; shift += 7 { 342 if shift >= 64 { 343 return ErrIntOverflowDate 344 } 345 if iNdEx >= l { 346 return io.ErrUnexpectedEOF 347 } 348 b := dAtA[iNdEx] 349 iNdEx++ 350 m.Day |= int32(b&0x7F) << shift 351 if b < 0x80 { 352 break 353 } 354 } 355 default: 356 iNdEx = preIndex 357 skippy, err := skipDate(dAtA[iNdEx:]) 358 if err != nil { 359 return err 360 } 361 if skippy < 0 { 362 return ErrInvalidLengthDate 363 } 364 if (iNdEx + skippy) < 0 { 365 return ErrInvalidLengthDate 366 } 367 if (iNdEx + skippy) > l { 368 return io.ErrUnexpectedEOF 369 } 370 iNdEx += skippy 371 } 372 } 373 374 if iNdEx > l { 375 return io.ErrUnexpectedEOF 376 } 377 return nil 378} 379func skipDate(dAtA []byte) (n int, err error) { 380 l := len(dAtA) 381 iNdEx := 0 382 for iNdEx < l { 383 var wire uint64 384 for shift := uint(0); ; shift += 7 { 385 if shift >= 64 { 386 return 0, ErrIntOverflowDate 387 } 388 if iNdEx >= l { 389 return 0, io.ErrUnexpectedEOF 390 } 391 b := dAtA[iNdEx] 392 iNdEx++ 393 wire |= (uint64(b) & 0x7F) << shift 394 if b < 0x80 { 395 break 396 } 397 } 398 wireType := int(wire & 0x7) 399 switch wireType { 400 case 0: 401 for shift := uint(0); ; shift += 7 { 402 if shift >= 64 { 403 return 0, ErrIntOverflowDate 404 } 405 if iNdEx >= l { 406 return 0, io.ErrUnexpectedEOF 407 } 408 iNdEx++ 409 if dAtA[iNdEx-1] < 0x80 { 410 break 411 } 412 } 413 return iNdEx, nil 414 case 1: 415 iNdEx += 8 416 return iNdEx, nil 417 case 2: 418 var length int 419 for shift := uint(0); ; shift += 7 { 420 if shift >= 64 { 421 return 0, ErrIntOverflowDate 422 } 423 if iNdEx >= l { 424 return 0, io.ErrUnexpectedEOF 425 } 426 b := dAtA[iNdEx] 427 iNdEx++ 428 length |= (int(b) & 0x7F) << shift 429 if b < 0x80 { 430 break 431 } 432 } 433 if length < 0 { 434 return 0, ErrInvalidLengthDate 435 } 436 iNdEx += length 437 if iNdEx < 0 { 438 return 0, ErrInvalidLengthDate 439 } 440 return iNdEx, nil 441 case 3: 442 for { 443 var innerWire uint64 444 var start int = iNdEx 445 for shift := uint(0); ; shift += 7 { 446 if shift >= 64 { 447 return 0, ErrIntOverflowDate 448 } 449 if iNdEx >= l { 450 return 0, io.ErrUnexpectedEOF 451 } 452 b := dAtA[iNdEx] 453 iNdEx++ 454 innerWire |= (uint64(b) & 0x7F) << shift 455 if b < 0x80 { 456 break 457 } 458 } 459 innerWireType := int(innerWire & 0x7) 460 if innerWireType == 4 { 461 break 462 } 463 next, err := skipDate(dAtA[start:]) 464 if err != nil { 465 return 0, err 466 } 467 iNdEx = start + next 468 if iNdEx < 0 { 469 return 0, ErrInvalidLengthDate 470 } 471 } 472 return iNdEx, nil 473 case 4: 474 return iNdEx, nil 475 case 5: 476 iNdEx += 4 477 return iNdEx, nil 478 default: 479 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 480 } 481 } 482 panic("unreachable") 483} 484 485var ( 486 ErrInvalidLengthDate = fmt.Errorf("proto: negative length found during unmarshaling") 487 ErrIntOverflowDate = fmt.Errorf("proto: integer overflow") 488) 489