DecodeDurationDescending is the descending version of DecodeDurationAscending.
(b []byte)
| 1082 | |
| 1083 | // DecodeDurationDescending is the descending version of DecodeDurationAscending. |
| 1084 | func DecodeDurationDescending(b []byte) ([]byte, duration.Duration, error) { |
| 1085 | if PeekType(b) != Duration { |
| 1086 | return nil, duration.Duration{}, errors.Errorf("did not find marker") |
| 1087 | } |
| 1088 | b = b[1:] |
| 1089 | b, sortNanos, err := DecodeVarintDescending(b) |
| 1090 | if err != nil { |
| 1091 | return b, duration.Duration{}, err |
| 1092 | } |
| 1093 | b, months, err := DecodeVarintDescending(b) |
| 1094 | if err != nil { |
| 1095 | return b, duration.Duration{}, err |
| 1096 | } |
| 1097 | b, days, err := DecodeVarintDescending(b) |
| 1098 | if err != nil { |
| 1099 | return b, duration.Duration{}, err |
| 1100 | } |
| 1101 | d, err := duration.Decode(sortNanos, months, days) |
| 1102 | if err != nil { |
| 1103 | return b, duration.Duration{}, err |
| 1104 | } |
| 1105 | return b, d, nil |
| 1106 | } |
| 1107 | |
| 1108 | // EncodeBitArrayAscending encodes a bitarray.BitArray value, appends it to the |
| 1109 | // supplied buffer, and returns the final buffer. The encoding is guaranteed to |
no test coverage detected
searching dependent graphs…