You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current data type used to represent the meta.time field is a plain integer. Someone who wants to e.g. compute the age of an event needs to apply some conversions to turn it into a time.Time value that can be used for date math (or just passing the untouched value to a function that accepts standard time.Time values).
What makes this a bit tricky is that time.Time isn't serialized as an integer but as an RFC 3339 string. The only realistic option is probably to create a new data type for which we could implement MarshalJSON and UnmarshalJSON, but then we won't be able to use the resulting meta.time values straight away anyway. Not sure what to do about this.
Motivation
Making it easier to work with the meta.time value.
Exemplification
Would simplify computation of the age of an event.
Benefits
Again, would make it easier to work with meta.time values without having to perform additional conversions.
Possible Drawbacks
None in particular.
The text was updated successfully, but these errors were encountered:
magnusbaeck
changed the title
Considering making the meta.time field based on time.Time
Consider making the meta.time field based on time.Time
Dec 6, 2021
Description
The current data type used to represent the meta.time field is a plain integer. Someone who wants to e.g. compute the age of an event needs to apply some conversions to turn it into a time.Time value that can be used for date math (or just passing the untouched value to a function that accepts standard time.Time values).
What makes this a bit tricky is that time.Time isn't serialized as an integer but as an RFC 3339 string. The only realistic option is probably to create a new data type for which we could implement MarshalJSON and UnmarshalJSON, but then we won't be able to use the resulting meta.time values straight away anyway. Not sure what to do about this.
Motivation
Making it easier to work with the meta.time value.
Exemplification
Would simplify computation of the age of an event.
Benefits
Again, would make it easier to work with meta.time values without having to perform additional conversions.
Possible Drawbacks
None in particular.
The text was updated successfully, but these errors were encountered: