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

Comments

Projects
None yet
4 participants
@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

@gopherbot gopherbot added the Proposal label Jan 24, 2019

@mdlayher

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

tredoe commented Jan 24, 2019

Ok, time.Time{} meets this issue.

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

@tredoe tredoe closed this Jan 24, 2019

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Jan 24, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment