MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Decode

Function Decode

pkg/util/duration/duration.go:724–729  ·  view source on GitHub ↗

Decode reverses the three integers returned from Encode and produces an equal Duration to the original.

(sortNanos int64, months int64, days int64)

Source from the content-addressed store, hash-verified

722// Decode reverses the three integers returned from Encode and produces an equal
723// Duration to the original.
724func Decode(sortNanos int64, months int64, days int64) (Duration, error) {
725 nanos := sortNanos - months*nanosInMonth - days*nanosInDay
726 // TODO(dan): Handle underflow, then document that DecodeBigInt can be used
727 // in underflow cases.
728 return Duration{Months: months, Days: days, nanos: nanos}, nil
729}
730
731// TODO(dan): Write DecodeBigInt.
732

Callers 2

DecodeDurationAscendingFunction · 0.92
DecodeDurationDescendingFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…