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
Not Nil fields refactor #298
Comments
yes, I agree. not sure its possible though. |
The idea of |
Interesting. Didn't know Crystal had that. Maybe we should keep this syntax and leverage the
|
That's kinda how it works now, using This is on my list to look into, ill post an update when i get some time to look into this more. |
@drujensen @c910335 I have a pretty good working prototype of this. However my current issue is how to handle the primary key. It's a catch 22 in that the PK can't be nil but it can be nil if its an unsaved model. So far I have come up with some solutions:
|
I vote for option 2. Nilable behind the facade. |
ditto. Seems like the best option at this point. |
Having the
field
vsfield!
to determine if a column is not nil doesn't feel crystal like to me.IMO, wouldn't it be more clear to base that off of the type of the field? For example:
This is essentially what the
field!
macro does, but then you could end up with using the bang version of field with a type ofString
. At a glance this makes it feel like it should be not nil, based on typing behavior elsewhere in Crystal.The text was updated successfully, but these errors were encountered: