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

Method EncodeBigInt

postgres/parser/duration/duration.go:414–422  ·  view source on GitHub ↗

EncodeBigInt is the same as Encode, except that it always returns successfully and is slower.

()

Source from the content-addressed store, hash-verified

412// EncodeBigInt is the same as Encode, except that it always returns
413// successfully and is slower.
414func (d Duration) EncodeBigInt() (sortNanos *big.Int, months int64, days int64) {
415 bigMonths := big.NewInt(d.Months)
416 bigMonths.Mul(bigMonths, big.NewInt(nanosInMonth))
417 bigDays := big.NewInt(d.Days)
418 bigDays.Mul(bigDays, big.NewInt(nanosInDay))
419 totalNanos := big.NewInt(d.nanos)
420 totalNanos.Add(totalNanos, bigMonths).Add(totalNanos, bigDays)
421 return totalNanos, d.Months, d.Days
422}
423
424// Decode reverses the three integers returned from Encode and produces an equal
425// Duration to the original.

Callers

nothing calls this directly

Calls 2

MulMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected