MCPcopy Create free account
hub / github.com/dolthub/doltgresql / AddDays

Method AddDays

postgres/parser/pgdate/pgdate.go:242–253  ·  view source on GitHub ↗

AddDays adds days to d with overflow and bounds checking.

(days int64)

Source from the content-addressed store, hash-verified

240
241// AddDays adds days to d with overflow and bounds checking.
242func (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.
256func (d Date) SubDays(days int64) (Date, error) {

Callers

nothing calls this directly

Calls 4

IsFiniteMethod · 0.95
Add32to64WithOverflowFunction · 0.92
WithCandidateCodeFunction · 0.92
MakeDateFromPGEpochFunction · 0.85

Tested by

no test coverage detected