-
Notifications
You must be signed in to change notification settings - Fork 887
chore: refactor time.Duration -> int64 milliseconds for FE consumption #1944
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
Conversation
Do you want to make it an actual type and write a json marshal? type MillisecondDuration time.Duration This means the sdk and cli would have an actual duration type. |
Maybe later; doing it with a type alias means you lose all the existing methods on the type and struct-embedding can get weird. |
A lot of the stories say "228 years after start" now, maybe they need to be updated? |
I think I've repaired the temporal anomaly now. :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
transition: "stop", | ||
}, | ||
autostart_schedule: undefined, | ||
ttl_ms: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unfamiliar with stories, but since we're using omitempty
, should we perhaps not define these here? There's a slight change in semantic meaning between x: undefined
and omitting it entirely. In the former case, the key is defined on the object and does not mimic API behavior 1:1.
717f451
to
b9b3edf
Compare
#1944) * Changes all public-facing codersdk types to use a plain int64 (milliseconds) instead of time.Duration. * Makes autostart_schedule a *string as it may not be present. * Adds a utils/ptr package with some useful methods.
This PR changes all public-facing codersdk types to use a plain
int64
(milliseconds) instead oftime.Duration
(nanoseconds) as this is the conventional type in the FE world.Also makes
autostart_schedule
a*string
as it may not be present.Also also adds a
utils/ptr
package with some useful methods.