Skip to content
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

Add Copy to the derived traits for active enums #634

Merged
merged 8 commits into from
Aug 6, 2022
Merged

Add Copy to the derived traits for active enums #634

merged 8 commits into from
Aug 6, 2022

Conversation

junbl
Copy link
Contributor

@junbl junbl commented Mar 25, 2022

PR Info

Adds

Added command line flag --with-copy-enums to sea-orm-cli. If provided, the automatically generated enums will derive the Copy trait. Otherwise, the behavior is unchanged.

Breaking Changes

No changes to public API methods, CLI behavior is backwards compatible.

Changes

Added with_copy_enums parameter in several places to get the behavior from the CLI to sea_orm_codegen (basically added the new flag anywhere the with-serde flag got passed).

@tyt2y3
Copy link
Member

tyt2y3 commented Mar 26, 2022

Although as for now there is no reason those enums can't be Copy , I wanted them to feel "heavyweight" so they are only Clone but not copy.

@tyt2y3
Copy link
Member

tyt2y3 commented Apr 10, 2022

I think the behaviour of adding Copy should be opt-in instead of a default behaviour

Copy link
Member

@billy1624 billy1624 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @e-rhodes, sorry for the delay! Thanks for contributions!!

The opt-in --with-copy-enums flag look great!

@tyt2y3 has any comments on the naming?

@billy1624 billy1624 requested a review from tyt2y3 August 3, 2022 03:53
@tyt2y3 tyt2y3 changed the base branch from master to pulls/634 August 6, 2022 08:36
@tyt2y3 tyt2y3 merged commit eac8bfd into SeaQL:pulls/634 Aug 6, 2022
@tyt2y3
Copy link
Member

tyt2y3 commented Aug 6, 2022

Thank you. We may turn that on as default in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

sea_orm_cli: Enums could implement Copy
3 participants