Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 8 commits intomainfromcj/codersdk-time-duration
Jun 2, 2022

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedJun 1, 2022
edited
Loading

This PR changes all public-facing codersdk types to use a plainint64 (milliseconds) instead oftime.Duration (nanoseconds) as this is the conventional type in the FE world.
Also makesautostart_schedule a*string as it may not be present.
Also also adds autils/ptr package with some useful methods.

@johnstcnjohnstcn requested a review froma teamJune 1, 2022 14:29
@johnstcnjohnstcn self-assigned thisJun 1, 2022
@johnstcnjohnstcn removed the request for review froma teamJune 1, 2022 14:30
@Emyrk
Copy link
Member

Emyrk commentedJun 1, 2022
edited
Loading

Do you want to make it an actual type and write a json marshal?

typeMillisecondDuration time.Duration

This means the sdk and cli would have an actual duration type.

@johnstcn
Copy link
MemberAuthor

Do you want to make it an actual type and write a json marshal?

typeMillisecondDuration 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.

@johnstcnjohnstcn marked this pull request as ready for reviewJune 1, 2022 16:32
@johnstcnjohnstcn requested a review froma team as acode ownerJune 1, 2022 16:32
@johnstcnjohnstcn requested a review froma teamJune 1, 2022 16:36
@presleyp
Copy link
Contributor

A lot of the stories say "228 years after start" now, maybe they need to be updated?

Emyrk and johnstcn reacted with laugh emoji

@johnstcn
Copy link
MemberAuthor

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. :-)

@johnstcnjohnstcn requested a review fromgreyscaledJune 1, 2022 21:28
Copy link
Member

@mafredrimafredri left a 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,
Copy link
Member

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 usingomitempty, should we perhaps not define these here? There's a slight change in semantic meaning betweenx: undefined and omitting it entirely. In the former case, thekey is defined on the object and does not mimic API behavior 1:1.

@johnstcnjohnstcnforce-pushed thecj/codersdk-time-duration branch from717f451 tob9b3edfCompareJune 2, 2022 09:46
@johnstcnjohnstcn merged commitdcf03d8 intomainJun 2, 2022
@johnstcnjohnstcn deleted the cj/codersdk-time-duration branchJune 2, 2022 10:23
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
#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.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mafredrimafredrimafredri approved these changes

@deansheatherdeansheatherdeansheather approved these changes

@greyscaledgreyscaledAwaiting requested review from greyscaled

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@johnstcn@Emyrk@presleyp@mafredri@greyscaled@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp