-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
Use UUID v1.0 release #326
Conversation
Note to review -- I already checked this using |
Ah, I see there are failures. These did not appear on my machine running |
bce1f61
to
b9257c1
Compare
Alrighty -- Seems to work and pass all tests. Should be ready to 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.
@marti4d thank you! LGTM!
@@ -39,6 +39,7 @@ pub enum ColumnType { | |||
Json, | |||
JsonBinary, | |||
Uuid, | |||
Uuid1, |
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.
This doesn't seems right. uuid v1.x
shouldn't need a separate ColumnType
#[cfg(feature = "with-uuid-1")] | ||
#[cfg_attr(docsrs, doc(cfg(feature = "with-uuid-1")))] | ||
Uuid1(Option<Box<Uuid1>>), |
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.
If the behaviour and API between uuid v0.8
and uuid v1.0
remains the same. We should switch the version of uuid
to v1.0 if with-uuid-1
feature is enabled, instead of introducing a new UUID variant in Value
enum.
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.
You mean if uuid-8 is enabled, then we disable the previous uuid version? Maybe compile error?
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.
I mean swapping the version of uuid
.
- If
with-uuid
is enabled but notwith-uuid-1
, then we importuse uuid::Uuid;
- If
with-uuid-1
is enabled, then we importuse uuid_1::Uuid;
i.e. the same old Uuid(Option<Box<Uuid>>)
unchanged. But we swap the inner uuid
to either v0.8 / v1.0
@billy1624 -- Thanks for the feedback. What you're describing is actually how I implemented this previously in this PR. Example from #[cfg(all(feature = "with-uuid", feature = "with-uuid-1"))]
compile_error!("You cannot use `with-uuid` and `with-uuid-1` together");
#[cfg(feature = "with-uuid")]
use uuid::Uuid;
#[cfg(feature = "with-uuid-1")]
use uuid_1::Uuid as Uuid; The issue was that the automation builds use I completely agree with you that it is better to have just one version of I don't know which option you like better? The other option, of course, is that we wait for |
@@ -81,6 +83,7 @@ with-json = ["serde_json", "sea-query-driver/with-json"] | |||
with-rust_decimal = ["rust_decimal", "sea-query-driver/with-rust_decimal"] | |||
with-bigdecimal = ["bigdecimal", "sea-query-driver/with-bigdecimal"] | |||
with-uuid = ["uuid", "sea-query-driver/with-uuid"] | |||
with-uuid-1 = ["uuid-1", "sea-query-driver?/with-uuid-1"] |
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.
Ohhhhh! We might actually want to use this question mark across all our crates
The "package-name/feature-name" syntax will also enable package-name if it is an optional dependency. Often this is not what you want. You can add a ? as in "package-name?/feature-name" which will only enable the given feature if something else enables the optional dependency.
Note: The ? syntax is only available starting with Rust 1.60.
Actually, I think this is a BIG problem the Rust ecosystem has to tackle as a whole. |
To make sure I'm understanding before I make the change -- Are you saying that you would prefer there to be |
Yup that's what I meant. 2.0 would one day come out |
Hmm... Now that I think about this more though, I'm not sure that approach will scale well in the code? There are also other dependencies like Perhaps it's better to just do dual-support when a transition is happening? IE change the default dependency to the new version and provide a "backward-compatibility" type for a while? (I think the only reason I have to do this for my project is because we're in a weird place where the DB I want to use (Postgres) supports Uuid v1.0 and the others don't) Assuming you like this plan, I made PR #329 that makes |
UUID had their offical v1.0 release now 🎉
Postgres crates already support it via the
with-uuid-1
option,so let's do it!
Fixes #325
PR Info
Changes