mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 02:11:02 +01:00
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)
This commit is contained in:
parent
b8f2c8c573
commit
cd3344edd1
6
types.go
6
types.go
|
@ -1649,3 +1649,9 @@ func (e *expirationTime) UnmarshalJSON(b []byte) error {
|
||||||
*e = expirationTime(i)
|
*e = expirationTime(i)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert ExpirationTime to time.Duration
|
||||||
|
func (e *expirationTime) ToDuration() time.Duration {
|
||||||
|
seconds := int64(*e)
|
||||||
|
return time.Duration(seconds) * time.Second
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user