.copyWith() for generated result classes
#3831
Replies: 1 comment
|
Thanks for starting the discussion here! I don't think we should do this, but I'm happy to be convinced otherwise. From an architectural standpoint, the point of drift-generated classes is to represent a result set as it appears in the database. Drift does generate a lot more for row and companion classes, but nowadays I mostly consider that to be a mistake (builtin json serialization is a particularly bad offender here). I can see why one would want to mutate / If you want to map query results into proper model classes (that you own), I think the cleanest solution would be to convert drift result sets to that. With existing row classes, you can also let drift map query results into your types directly. I think this would be a better option in the interest of separating concerns, but I'm curious to hear what your use cases for this are. |
Uh oh!
There was an error while loading. Please reload this page.
When I have a
.driftfile that generates some result classes, it would be nice to have.copyWith()methods on those immutable data classes. Drift already generates.copyWith()on companion classes for our table schemas, but does not generate those methods for result types.All reactions