DecodeDurationDescending is the descending version of DecodeDurationAscending.
(b []byte)
| 1565 | |
| 1566 | // DecodeDurationDescending is the descending version of DecodeDurationAscending. |
| 1567 | func DecodeDurationDescending(b []byte) ([]byte, duration.Duration, error) { |
| 1568 | if PeekType(b) != Duration { |
| 1569 | return nil, duration.Duration{}, errors.Errorf("did not find marker") |
| 1570 | } |
| 1571 | b = b[1:] |
| 1572 | b, sortNanos, err := DecodeVarintDescending(b) |
| 1573 | if err != nil { |
| 1574 | return b, duration.Duration{}, err |
| 1575 | } |
| 1576 | b, months, err := DecodeVarintDescending(b) |
| 1577 | if err != nil { |
| 1578 | return b, duration.Duration{}, err |
| 1579 | } |
| 1580 | b, days, err := DecodeVarintDescending(b) |
| 1581 | if err != nil { |
| 1582 | return b, duration.Duration{}, err |
| 1583 | } |
| 1584 | d, err := duration.Decode(sortNanos, months, days) |
| 1585 | if err != nil { |
| 1586 | return b, duration.Duration{}, err |
| 1587 | } |
| 1588 | return b, d, nil |
| 1589 | } |
| 1590 | |
| 1591 | // EncodeBitArrayAscending encodes a bitarray.BitArray value, appends it to the |
| 1592 | // supplied buffer, and returns the final buffer. The encoding is guaranteed to |
no test coverage detected
searching dependent graphs…