-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
Add an option to wrap primitives to Option[] #54
Comments
Two options: Option A:
and define a Option B: you can define:
Message fields are always in options, and you can then use a custom type for it. |
I like NullableTime idea, thanks. It totally covers my case. |
@thesamet What's the reasoning behind not using |
Exactly. The receiving end has no way of telling if an int32 field was assigned to zero or whether it has not been assigned. See note here: https://developers.google.com/protocol-buffers/docs/proto3?hl=en#default |
@thesamet this seems like a pretty big regression compared to proto2, am I missing something? :) |
@thesamet it looks like proto3 betas will include built-in nullable primitives: protocolbuffers/protobuf#159 (comment). Could we map these to That being said, I can't find any trace of them in the repo yet. |
Trying to use these built-in wrapped types results in compile-time errors:
Any idea how to fix? |
In some cases zeros does not make sence. For example, I have a model Event, stored in relational database:
In the past Event did not have a deleted_at, but it had a boolean is_deleted. When deleted_at appeared, it had been set to the epoch start for every deleted event and to NULL for the rest. So, if deleted_at is not an Option, there is no way to determine if event was deleted.
The text was updated successfully, but these errors were encountered: