Skip Empty 'impl' Block Generation in 'sea-orm-cli generate entity' Command #1878
kaplanelad
started this conversation in
Ideas
Replies: 2 comments
-
f it sounds acceptable, I am willing to take on this task and implement the feature. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@kaplanelad FYI I went ahead and did this, then came across your proposal: #1947 Better to ask forgiveness than permission :). My PR takes a different approach semantically for the flag but has the same effect (leave the default behavior as it is today but provide a way for the user to skip it). I might rename the CLI option in my PR to match what you've proposed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I propose the addition of a flag to the CLI command sea-orm-cli generate entity that allows for skipping the generation of an empty impl block, specifically impl ActiveModelBehavior for ActiveModel {}.
For instance, when I intend to hash a user's password before inserting a new record, I would like to use the before_save implementation. Currently, this involves the following steps:
Adding the necessary logic directly to the generated file. However, this code gets deleted when the generate entity command is rerun.
Attempting to place the before_save logic in a different location but getting compilation error: "conflicting implementation" error.
The proposed flag would streamline this process and prevent the deletion of custom code during regeneration.
Beta Was this translation helpful? Give feedback.
All reactions