Skip to content

Commit cd3344e

Browse files
authored
Adds the ToDuration function to the paypalExpirationTime type. This function allows easy conversion of the internal value to a time.Duration type, which is crucial when using paypalExpirationTime values with Redis expiration times. (#265)
1 parent b8f2c8c commit cd3344e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

types.go

+6
Original file line numberDiff line numberDiff line change
@@ -1649,3 +1649,9 @@ func (e *expirationTime) UnmarshalJSON(b []byte) error {
16491649
*e = expirationTime(i)
16501650
return nil
16511651
}
1652+
1653+
// Convert ExpirationTime to time.Duration
1654+
func (e *expirationTime) ToDuration() time.Duration {
1655+
seconds := int64(*e)
1656+
return time.Duration(seconds) * time.Second
1657+
}

0 commit comments

Comments
 (0)