(ts TimestampValue)
| 93 | } |
| 94 | |
| 95 | func computeTimestampRange(ts TimestampValue) (floor time.Time, ceiling time.Time) { |
| 96 | t := ts.Time |
| 97 | switch ts.Precision { |
| 98 | case "microseconds": |
| 99 | floor = t.Truncate(time.Microsecond) |
| 100 | ceiling = floor.Add(time.Microsecond) |
| 101 | case "milliseconds": |
| 102 | floor = t.Truncate(time.Millisecond) |
| 103 | ceiling = floor.Add(time.Millisecond) |
| 104 | case "second": |
| 105 | floor = t.Truncate(time.Second) |
| 106 | ceiling = floor.Add(time.Second) |
| 107 | case "minute": |
| 108 | floor = t.Truncate(time.Minute) |
| 109 | ceiling = floor.Add(time.Minute) |
| 110 | case "hour": |
| 111 | floor = t.Truncate(time.Hour) |
| 112 | ceiling = floor.Add(time.Hour) |
| 113 | case "day": |
| 114 | y, m, d := t.Date() |
| 115 | floor = time.Date(y, m, d, 0, 0, 0, 0, t.Location()) |
| 116 | ceiling = floor.AddDate(0, 0, 1) |
| 117 | default: |
| 118 | floor = t.Truncate(time.Second) |
| 119 | ceiling = floor.Add(time.Second) |
| 120 | } |
| 121 | return floor, ceiling |
| 122 | } |
no outgoing calls
no test coverage detected