Skip to content

Commit

Permalink
Revert "Update uuid crate to v1 (launchbadge#1821)"
Browse files Browse the repository at this point in the history
This reverts commit ec15f6b.
  • Loading branch information
RabidFire committed Jun 12, 2022
1 parent 790ad12 commit 4238fff
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sqlx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ time = { version = "0.3.2", features = ["macros", "formatting", "parsing"], opti
tokio-stream = { version = "0.1.8", features = ["fs"], optional = true }
smallvec = "1.7.0"
url = { version = "2.2.2", default-features = false }
uuid = { version = "1.0", default-features = false, optional = true, features = ["std"] }
uuid = { version = "0.8.2", default-features = false, optional = true, features = ["std"] }
webpki-roots = { version = "0.22.0", optional = true }
whoami = { version = "1.2.1", optional = true }
stringprep = "0.1.2"
Expand Down
2 changes: 1 addition & 1 deletion sqlx-core/src/mysql/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
//! | Rust type | MySQL type(s) |
//! |---------------------------------------|------------------------------------------------------|
//! | `uuid::Uuid` | BYTE(16), VARCHAR, CHAR, TEXT |
//! | `uuid::fmt::Hyphenated` | CHAR(36) |
//! | `uuid::adapter::Hyphenated` | CHAR(36) |
//!
//! ### [`json`](https://crates.io/crates/json)
//!
Expand Down
4 changes: 2 additions & 2 deletions sqlx-core/src/mysql/types/uuid.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use uuid::{fmt::Hyphenated, Uuid};
use uuid::{adapter::Hyphenated, Uuid};

use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
Expand Down Expand Up @@ -61,6 +61,6 @@ impl Decode<'_, MySql> for Hyphenated {
// parse a UUID from the text
Uuid::parse_str(text)
.map_err(Into::into)
.map(|u| u.hyphenated())
.map(|u| u.to_hyphenated())
}
}
2 changes: 1 addition & 1 deletion sqlx-core/src/sqlite/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
//! | Rust type | Sqlite type(s) |
//! |---------------------------------------|------------------------------------------------------|
//! | `uuid::Uuid` | BLOB, TEXT |
//! | `uuid::fmt::Hyphenated` | TEXT |
//! | `uuid::adapter::Hyphenated` | TEXT |
//!
//! # Nullable
//!
Expand Down
4 changes: 2 additions & 2 deletions sqlx-core/src/sqlite/types/uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::sqlite::type_info::DataType;
use crate::sqlite::{Sqlite, SqliteArgumentValue, SqliteTypeInfo, SqliteValueRef};
use crate::types::Type;
use std::borrow::Cow;
use uuid::{fmt::Hyphenated, Uuid};
use uuid::{adapter::Hyphenated, Uuid};

impl Type<Sqlite> for Uuid {
fn type_info() -> SqliteTypeInfo {
Expand Down Expand Up @@ -53,6 +53,6 @@ impl Decode<'_, Sqlite> for Hyphenated {
let uuid: Result<Uuid, BoxDynError> =
Uuid::parse_str(&value.text().map(ToOwned::to_owned)?).map_err(Into::into);

Ok(uuid?.hyphenated())
Ok(uuid?.to_hyphenated())
}
}
6 changes: 3 additions & 3 deletions tests/mysql/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ test_type!(uuid<sqlx::types::Uuid>(MySql,
));

#[cfg(feature = "uuid")]
test_type!(uuid_hyphenated<sqlx::types::uuid::fmt::Hyphenated>(MySql,
test_type!(uuid_hyphenated<sqlx::types::uuid::adapter::Hyphenated>(MySql,
"'b731678f-636f-4135-bc6f-19440c13bd19'"
== sqlx::types::Uuid::parse_str("b731678f-636f-4135-bc6f-19440c13bd19").unwrap().hyphenated(),
== sqlx::types::Uuid::parse_str("b731678f-636f-4135-bc6f-19440c13bd19").unwrap().to_hyphenated(),
"'00000000-0000-0000-0000-000000000000'"
== sqlx::types::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap().hyphenated()
== sqlx::types::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap().to_hyphenated()
));

#[cfg(feature = "chrono")]
Expand Down
6 changes: 3 additions & 3 deletions tests/sqlite/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ test_type!(uuid<sqlx::types::Uuid>(Sqlite,
));

#[cfg(feature = "uuid")]
test_type!(uuid_hyphenated<sqlx::types::uuid::fmt::Hyphenated>(Sqlite,
test_type!(uuid_hyphenated<sqlx::types::uuid::adapter::Hyphenated>(Sqlite,
"'b731678f-636f-4135-bc6f-19440c13bd19'"
== sqlx::types::Uuid::parse_str("b731678f-636f-4135-bc6f-19440c13bd19").unwrap().hyphenated(),
== sqlx::types::Uuid::parse_str("b731678f-636f-4135-bc6f-19440c13bd19").unwrap().to_hyphenated(),
"'00000000-0000-0000-0000-000000000000'"
== sqlx::types::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap().hyphenated()
== sqlx::types::Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap().to_hyphenated()
));

0 comments on commit 4238fff

Please sign in to comment.