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

proposal: time: add ZeroTime function #29914

Closed
tredoe opened this issue Jan 24, 2019 · 3 comments
Closed

proposal: time: add ZeroTime function #29914

tredoe opened this issue Jan 24, 2019 · 3 comments

Comments

@tredoe
Copy link

tredoe commented Jan 24, 2019

Some times you need to have a Time with value set to zero to be entered at columns where the constraint 'not null' is set.

@gopherbot gopherbot added this to the Proposal milestone Jan 24, 2019
@mdlayher
Copy link
Member

mdlayher commented Jan 24, 2019

Does a time.Time{} literal not meet this need?

More information than a single sentence is needed to effectively understand and address your concerns. This proposal doesn't really explain what you're trying to accomplish, what you've already tried, why those workarounds are unacceptable, how common this issue is, etc.

@tredoe
Copy link
Author

tredoe commented Jan 24, 2019

Ok, time.Time{} meets this issue.

https://play.golang.org/p/QEJeKdQ93u1

@tredoe tredoe closed this as completed Jan 24, 2019
@agnivade
Copy link
Contributor

FYI - This is already documented -

The zero value of type Time is January 1, year 1, 00:00:00.000000000 UTC. As this time is unlikely to come up in practice, the IsZero method gives a simple way of detecting a time that has not been initialized explicitly.

@golang golang locked and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants