chore: refactor time.Duration -> int64 milliseconds for FE consumption#1944
Conversation
|
Do you want to make it an actual type and write a json marshal? type MillisecondDuration time.DurationThis 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. :-) |
| transition: "stop", | ||
| }, | ||
| autostart_schedule: undefined, | ||
| ttl_ms: undefined, |
There was a problem hiding this comment.
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_schedulea*stringas it may not be present.Also also adds a
utils/ptrpackage with some useful methods.