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

Derive Hash on active enums #1977

Closed
kije opened this issue Nov 20, 2023 · 2 comments
Closed

Derive Hash on active enums #1977

kije opened this issue Nov 20, 2023 · 2 comments

Comments

@kije
Copy link

kije commented Nov 20, 2023

Motivation

Active enums generated by the sea-orm-cli generate entity could be used as keys in hashmaps/hashsets, etc...

Thus it would be really useful if one could opt-in to having Hash automatically derived, like there is already an option for the Copy trait via the --with-copy-enums CLI option

Proposed Solutions

Add an optional --with-hash-enums option to the CLI, which then will add Hash to the traits derived on the generated active enums.

Current Workarounds

Customize generated files manually and repeat that customization after each generate.

@anshap1719
Copy link
Sponsor Contributor

@tyt2y3 I think it would make more sense to have an equivalent of --model-extra-derives for ActiveEnums. Do you agree? I can create a PR for that.

@tyt2y3
Copy link
Member

tyt2y3 commented Jan 12, 2024

Thank you @anshap1719 for the nudge.

We added --enum-extra-derives and --enum-extra-attributes recently (https://github.com/SeaQL/sea-orm/releases/tag/0.12.5), I think this issue can now be closed.

@tyt2y3 tyt2y3 closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants