-
-
Notifications
You must be signed in to change notification settings - Fork 519
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
Auto Generated ActiveEnum String Values And Model Column Names #2170
Auto Generated ActiveEnum String Values And Model Column Names #2170
Conversation
@tyt2y3 @billy1624 Can I ask for your opinions for these:
|
208c70c
to
f23ebac
Compare
Hi @tyt2y3 @billy1624, sorry to ping you about this! Did you get a chance to look at it yet? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @anshap1719, thanks for the PR! I think this is a good alternative to the existing renaming of entity columns and active enum variants!
f23ebac
to
35bca74
Compare
…ants Based On Renaming Rules SeaQL#2160
… Tests For DeriveActiveEnum rename rules SeaQL#2160
a349af0
to
c1cd1ac
Compare
@billy1624 This is ready for your review in my opinion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!! @anshap1719
Thanks @billy1624 |
@tyt2y3 Please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Thank you
@tyt2y3 @billy1624 Thanks for all your help as well. |
🎉 Released In 1.0.0-rc.5 🎉Thank you everyone for the contribution! |
@anshap1719 Just wanted to inform you that this no longer works: #[derive(EnumIter, DeriveActiveEnum)]
#[sea_orm(
rs_type = "String",
db_type = "String(Some(1))",
rename_all = "camelCase"
)]
pub enum Category {
BigTask,
SmallWork,
}
Using EDIT: Nvm found the correct way: #[derive(EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "String(StringLen::None)", rename_all = "camelCase")]
pub enum TestEnum {
DefaultVariant, // defaultVariant
#[sea_orm(rename = "kebab-case")]
VariantKebabCase, // variant-kebab-case
#[sea_orm(rename = "snake_case")]
VariantSnakeCase, // variant_snake_case
#[sea_orm(string_value = "CuStOmStRiNgVaLuE")]
CustomStringValue, // CuStOmStRiNgVaLuE
} |
🎉 Released In 1.0.0 🎉Thank you everyone for the contribution! |
PR Info
string_value
For ActiveEnum Based On Renaming Rules On Variants #2160, Atomically pick a string_value value if not provided. #2125New Features
column_name_case
attribute inDeriveEntityModel
for automatically generating column names for all fields based on case style provided.column_name_case
attribute in fields within a model that derivesDeriveEntityModel
for automatically generating column name based on case style provided.rename_all
attribute inDeriveActiveEnum
for automatically generating string values for all variants of the enum based on case style provided.rename
attribute for variants of anActiveEnum
that derivesDeriveActiveEnum
for automatically generating string value for it based on case style provided.Dependents