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

Function EncodeDurationDescending

pkg/util/encoding/encoding.go:1525–1537  ·  view source on GitHub ↗

EncodeDurationDescending is the descending version of EncodeDurationAscending.

(b []byte, d duration.Duration)

Source from the content-addressed store, hash-verified

1523
1524// EncodeDurationDescending is the descending version of EncodeDurationAscending.
1525func EncodeDurationDescending(b []byte, d duration.Duration) ([]byte, error) {
1526 sortNanos, months, days, err := d.Encode()
1527 if err != nil {
1528 // TODO(dan): Handle this using d.EncodeBigInt() and the
1529 // durationBigNeg/durationBigPos markers.
1530 return b, err
1531 }
1532 b = append(b, durationMarker)
1533 b = EncodeVarintDescending(b, sortNanos)
1534 b = EncodeVarintDescending(b, months)
1535 b = EncodeVarintDescending(b, days)
1536 return b, nil
1537}
1538
1539// DecodeDurationAscending decodes a duration.Duration value which was encoded
1540// using EncodeDurationAscending. The remainder of the input buffer and the

Callers

nothing calls this directly

Calls 2

EncodeVarintDescendingFunction · 0.85
EncodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…