-
-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using numeric representation of time.Duration is confusing, because value is stored as UNIX nanoseconds. Humans tend to be more comfortable with the string representation of the time.Duration. In addition to time.Duration being an int64 number and encoding/decoding as such, allow to use its string representation. For example, the below structure: Configuration := struct { ExpireIn time.Duration }{ ExpireIn 15 * time.Minute, } Is currently serialized as: ExpireIn = 900000000000 This commit is prioritizing its string representation and the new encoding will produce: ExpireIn = "15m0s" This change is backward compatible. Both old numeric value and the new string reprentation are accepted by the decoder.
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters