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

Method SubDays

postgres/parser/pgdate/pgdate.go:256–267  ·  view source on GitHub ↗

SubDays subtracts days from d with overflow and bounds checking.

(days int64)

Source from the content-addressed store, hash-verified

254
255// SubDays subtracts days from d with overflow and bounds checking.
256func (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}

Callers

nothing calls this directly

Calls 4

IsFiniteMethod · 0.95
Sub32to64WithOverflowFunction · 0.92
WithCandidateCodeFunction · 0.92
MakeDateFromPGEpochFunction · 0.85

Tested by

no test coverage detected