Repository navigation
refactor: TableRow implementation - #2775
Merged
Merged
Conversation
change c.extends to x.implements add a private field `_id` to class (to escape recursive getter problem) add getter and setter for id instead of calling super, _id is initialized in the constructor body tests where updated to: not expect .extends but .implements not expect super(id) but `_id = id`
SandPod
requested changes
Sep 25, 2024
SandPod
left a comment
Contributor
There was a problem hiding this comment.
Nice clean work!
Couple of suggestions that would probably simplify this change and make the code diff a lot smaller.
Simplifies the way ID is handled in generated table-classes instead of getter and setter we override the id field itself ID is now initialized in the initializer list instead of the body also the url referring to TableRow is not hardcoded anymore entity_class_test were updated to expect the id being initialized/declared in the initializer list/constructor inser_sql_query_test util classes were changed to align with the changes above
This removes `hasPrimaryKey` from the assertion of `shouldIncludeType` this way we also don't need to check for isIdFieldInMainConstructor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the implementation of
TableRowfrom:an
abstract classthat wasextendedto
an
abstract interface classthat isimplementedwith the following steps:
TableRow
TableRowwas changed to be an interfaceconstructoragetterand asetterwas added foridModelLibraryGenerator
implementsTableRow instead of extending it_idthat is initialized in the constructor body instead of callingsuper(id)overridesthegetterandsetterfrom TableRowentity_class_test.dartextendedbutimplementedidto be passed tosuperbut to be initialized in the constructor bodyinsert_sql_query_testcloses #2711
connected to #1873
I would recommend reviewing it commit by commit, as the PR includes the output of
generate_allbut note, I forgot to update the test in the database package at first. This is done in the last commitPre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
I don't think there are breaking changes as explained by @SandPod in #2711