Documentation ¶
Overview ¶
Package time provides for custom types to translate time from JSON and other formats into time.Time objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DurationTime ¶
DurationTime provides a type that can marshal and unmarshal a string representation of a duration from now into a time.Time object. Note: I'm not sure this is the best way to do this. What happens is we get a field called "expires_in" that represents the seconds from now that this expires. We turn that into a time we call .ExpiresOn. But maybe we should be recording when the token was received at .TokenRecieved and .ExpiresIn should remain as a duration. Then we could have a method called ExpiresOn(). Honestly, the whole thing is bad because the server doesn't return a concrete time. I think this is cleaner, but its not great either.
func (DurationTime) MarshalJSON ¶
func (d DurationTime) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.MarshalJSON().
func (*DurationTime) UnmarshalJSON ¶
func (d *DurationTime) UnmarshalJSON(b []byte) error
UnmarshalJSON implements encoding/json.UnmarshalJSON().
type Unix ¶
Unix provides a type that can marshal and unmarshal a string representation of the unix epoch into a time.Time object.
func (Unix) MarshalJSON ¶
MarshalJSON implements encoding/json.MarshalJSON().
func (*Unix) UnmarshalJSON ¶
UnmarshalJSON implements encoding/json.UnmarshalJSON().