Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making the meta.time field based on time.Time #14

Open
magnusbaeck opened this issue Dec 3, 2021 · 0 comments
Open

Consider making the meta.time field based on time.Time #14

magnusbaeck opened this issue Dec 3, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@magnusbaeck
Copy link
Member

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.

@magnusbaeck magnusbaeck added the enhancement New feature or request label Dec 3, 2021
@magnusbaeck 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant