Hacker News new | past | comments | ask | show | jobs | submit login

But that will also not transfer over to the domain struct



Well it depends. If your data model doesn't include "this bool is optional", you can just include the bool directly in the struct and get all the memory layout advantages, and then you decide in your protobuf -> domain type conversion code whether it's an error if that field is missing or if it just defaults to 'false'. You only need to make ways for a field to be optional (such as naming it a pointer where nil represents "missing") when that actually makes sense in your data model.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: