-
Notifications
You must be signed in to change notification settings - Fork 366
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
non-nullable attributes should be marked as @required in generated classes #25
Comments
This is due to an unfortunate design choice made by me pretty early on. We can't really make them This, btw., is required for some queries. Let's say we had a users table with a (required) id and name column and an optional age column. To express This situation is obviously obviously not ideal and will only get worse when Dart gets null-safe types as we'd have to make each field nullable even though most aren't. At the moment, it's not that bad as the library will enforce that all required fields for a specific query are set. A possible solution might be to generate multiple data classes per table (for reading, updating, and inserting), but I'll have to think about this some more. Other ideas are definitely most welcome. |
I think I have a solution that could work. For each data class, we also generate an update companion, which would be used for inserts and updates. It stores whether a field is absent or explicitly set to |
I think I managed to implement the update companion classes without breaking backwards compatibility on |
No description provided.
The text was updated successfully, but these errors were encountered: