AddDays adds days to d with overflow and bounds checking.
(days int64)
| 240 | |
| 241 | // AddDays adds days to d with overflow and bounds checking. |
| 242 | func (d Date) AddDays(days int64) (Date, error) { |
| 243 | if !d.IsFinite() { |
| 244 | return d, nil |
| 245 | } |
| 246 | n, ok := utils.Add32to64WithOverflow(d.days, days) |
| 247 | if !ok { |
| 248 | return Date{}, pgerror.WithCandidateCode( |
| 249 | errors.Newf("%s + %d is out of range", d, errors.Safe(days)), |
| 250 | pgcode.DatetimeFieldOverflow) |
| 251 | } |
| 252 | return MakeDateFromPGEpoch(n) |
| 253 | } |
| 254 | |
| 255 | // SubDays subtracts days from d with overflow and bounds checking. |
| 256 | func (d Date) SubDays(days int64) (Date, error) { |
nothing calls this directly
no test coverage detected