SubDays subtracts days from d with overflow and bounds checking.
(days int64)
| 254 | |
| 255 | // SubDays subtracts days from d with overflow and bounds checking. |
| 256 | func (d Date) SubDays(days int64) (Date, error) { |
| 257 | if !d.IsFinite() { |
| 258 | return d, nil |
| 259 | } |
| 260 | n, ok := utils.Sub32to64WithOverflow(d.days, days) |
| 261 | if !ok { |
| 262 | return Date{}, pgerror.WithCandidateCode( |
| 263 | errors.Newf("%s - %d is out of range", d, errors.Safe(days)), |
| 264 | pgcode.DatetimeFieldOverflow) |
| 265 | } |
| 266 | return MakeDateFromPGEpoch(n) |
| 267 | } |
nothing calls this directly
no test coverage detected