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

Function DecodeDurationAscending

pkg/util/encoding/encoding.go:1542–1564  ·  view source on GitHub ↗

DecodeDurationAscending decodes a duration.Duration value which was encoded using EncodeDurationAscending. The remainder of the input buffer and the decoded duration.Duration are returned.

(b []byte)

Source from the content-addressed store, hash-verified

1540// using EncodeDurationAscending. The remainder of the input buffer and the
1541// decoded duration.Duration are returned.
1542func DecodeDurationAscending(b []byte) ([]byte, duration.Duration, error) {
1543 if PeekType(b) != Duration {
1544 return nil, duration.Duration{}, errors.Errorf("did not find marker %x", b)
1545 }
1546 b = b[1:]
1547 b, sortNanos, err := DecodeVarintAscending(b)
1548 if err != nil {
1549 return b, duration.Duration{}, err
1550 }
1551 b, months, err := DecodeVarintAscending(b)
1552 if err != nil {
1553 return b, duration.Duration{}, err
1554 }
1555 b, days, err := DecodeVarintAscending(b)
1556 if err != nil {
1557 return b, duration.Duration{}, err
1558 }
1559 d, err := duration.Decode(sortNanos, months, days)
1560 if err != nil {
1561 return b, duration.Duration{}, err
1562 }
1563 return b, d, nil
1564}
1565
1566// DecodeDurationDescending is the descending version of DecodeDurationAscending.
1567func DecodeDurationDescending(b []byte) ([]byte, duration.Duration, error) {

Callers 1

prettyPrintFirstValueFunction · 0.85

Calls 4

DecodeFunction · 0.92
PeekTypeFunction · 0.85
DecodeVarintAscendingFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…