Helper function to return start and end time as an int in YYYYMM format Defaults to 0 for Start and 999999 for End
(timeRange *database.TimeRange)
| 619 | // Helper function to return start and end time as an int in YYYYMM format |
| 620 | // Defaults to 0 for Start and 999999 for End |
| 621 | func timeRangeToInt(timeRange *database.TimeRange) (int, int) { |
| 622 | var err error |
| 623 | layout := "200601" |
| 624 | |
| 625 | startDefault := 0 |
| 626 | startInt := 0 |
| 627 | endDefault := 999999 |
| 628 | endInt := 999999 |
| 629 | |
| 630 | if timeRange != nil { |
| 631 | if !timeRange.Start.Equal(time.Time{}) { |
| 632 | startInt, err = strconv.Atoi(timeRange.Start.Format(layout)) |
| 633 | if err != nil { |
| 634 | startInt = startDefault |
| 635 | } |
| 636 | } |
| 637 | if !timeRange.End.Equal(time.Time{}) { |
| 638 | endInt, err = strconv.Atoi(timeRange.End.Format(layout)) |
| 639 | if err != nil { |
| 640 | endInt = endDefault |
| 641 | } |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | return startInt, endInt |
| 646 | } |
| 647 | |
| 648 | // Format URL for a specific shard |
| 649 | // Basically, remove start/end if is is before/after shard time |