-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
Drop the use of sea-strum
and depends on the original strum
with a tailored EnumIter
provided
#1535
Conversation
…a tailored `EnumIter` provided
@@ -29,4 +29,7 @@ sea-orm = { path = "../", features = ["macros"] } | |||
serde = { version = "1.0", features = ["derive"] } | |||
|
|||
[features] | |||
default = ["derive"] |
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.
Why do we need a feature here? I think we always want to enable this right?
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.
Backward compatibility. Not a must, I just think it's better to ship with derive
by default like it used to be.
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.
We have two features in sea-orm-macros
derive
- provide all derive macros of SeaORM, e.g.DeriveEntityModel
strum
- provide theEnumIter
derive macros
I split the sea-orm-macros
in half because one can opt-out the derive
feature in SeaORM by specifying sea-orm = { version = "*", default-features = false }
. Where the sea-orm-macros
is a optional dependency. But now, the strum
reside in it, making it a "compulsory" dependency. Instead, we turn on / off the derive
feature as needed.
In contrast, we ALWAYS want the strum
feature to be enabled.
Hence,
- sea-orm-macros = { version = "0.11.0", path = "sea-orm-macros", default-features = false, optional = true }
+ sea-orm-macros = { version = "0.11.0", path = "sea-orm-macros", default-features = false, features = ["strum"] }
[features]
- macros = ["sea-orm-macros", "sea-query/derive"]
+ macros = ["sea-orm-macros/derive", "sea-query/derive"]
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.
Umm. This sounds complicated. Well but let it be for now.
postgres-array = [] | ||
derive = ["bae"] | ||
strum = [] |
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.
Same, I think we can just ship it by default
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.
For this, dependency are conditionally enabled when a feature is being enabled.
This should be fine. If we decided to keep derive
and strum
as it's now.
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.
Awesome
* Optional Field SeaQL/sea-orm#1513 * .gitignore SeaQL/sea-orm#1334 * migration table custom name SeaQL/sea-orm#1511 * OR condition relation SeaQL/sea-orm#1433 * DerivePartialModel SeaQL/sea-orm#1597 * space for migration file naming SeaQL/sea-orm#1570 * composite key up to 12 SeaQL/sea-orm#1508 * seaography integration SeaQL/sea-orm#1599 * QuerySelect SimpleExpr SeaQL/sea-orm#1702 * sqlErr SeaQL/sea-orm#1707 * migration check SeaQL/sea-orm#1519 * postgres array SeaQL/sea-orm#1565 * param intoString SeaQL/sea-orm#1439 * **skipped** re-export SeaQL/sea-orm#1661 * ping SeaQL/sea-orm#1627 * on empty do nothing SeaQL/sea-orm#1708 * on conflict do nothing SeaQL/sea-orm#1712 * **skipped** upgrade versions * active enum fail safe SeaQL/sea-orm#1374 * relation generation check SeaQL/sea-orm#1435 * entity generation bug SeaQL/sea-schema#105 * **skipped** bug fix that does not require edits * EnumIter change SeaQL/sea-orm#1535 * completed and fixed a previous todo SeaQL/sea-orm#1570 * amended wordings and structures * Edit * Remove temp file --------- Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
🎉 Released In 0.12.1 🎉Thank you everyone for the contribution! |
PR Info
Dependencies:
This PR should be merged into master. But I want to substitute the changes of Update heck dependency #1520 for readability.
New Features
sea_orm_macros::EnumIter
to implementstrum::IntoEnumIterator
trait for the derived enum (source code adapted from https://github.com/Peternator7/strum)Upgrades
strum
to 0.24Breaking Changes
derive
andstrum
features tosea-orm-macros
sea-strum
dependency withstrum
insea-orm
sea_orm_macros::EnumIter
instead ofstrum::EnumIter
on the root ofsea-orm