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

Function DecodeDurationAscending

pkg/util/encoding/encoding.go:1059–1081  ·  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

1057// using EncodeDurationAscending. The remainder of the input buffer and the
1058// decoded duration.Duration are returned.
1059func DecodeDurationAscending(b []byte) ([]byte, duration.Duration, error) {
1060 if PeekType(b) != Duration {
1061 return nil, duration.Duration{}, errors.Errorf("did not find marker %x", b)
1062 }
1063 b = b[1:]
1064 b, sortNanos, err := DecodeVarintAscending(b)
1065 if err != nil {
1066 return b, duration.Duration{}, err
1067 }
1068 b, months, err := DecodeVarintAscending(b)
1069 if err != nil {
1070 return b, duration.Duration{}, err
1071 }
1072 b, days, err := DecodeVarintAscending(b)
1073 if err != nil {
1074 return b, duration.Duration{}, err
1075 }
1076 d, err := duration.Decode(sortNanos, months, days)
1077 if err != nil {
1078 return b, duration.Duration{}, err
1079 }
1080 return b, d, nil
1081}
1082
1083// DecodeDurationDescending is the descending version of DecodeDurationAscending.
1084func DecodeDurationDescending(b []byte) ([]byte, duration.Duration, error) {

Callers 1

prettyPrintFirstValueFunction · 0.85

Calls 3

DecodeFunction · 0.92
PeekTypeFunction · 0.85
DecodeVarintAscendingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…