From 4238fffc8da27e99d1eb0d491922628ee1932890 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Date: Mon, 13 Jun 2022 01:06:13 +0530 Subject: [PATCH] Revert "Update uuid crate to v1 (#1821)" This reverts commit ec15f6b30c3eba483a1aff508d3f46fbbb7b7134. --- Cargo.lock | 4 ++-- sqlx-core/Cargo.toml | 2 +- sqlx-core/src/mysql/types/mod.rs | 2 +- sqlx-core/src/mysql/types/uuid.rs | 4 ++-- sqlx-core/src/sqlite/types/mod.rs | 2 +- sqlx-core/src/sqlite/types/uuid.rs | 4 ++-- tests/mysql/types.rs | 6 +++--- tests/sqlite/types.rs | 6 +++--- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f678f205ac..5591d70ad3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2881,9 +2881,9 @@ checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" [[package]] name = "uuid" -version = "1.0.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "value-bag" diff --git a/sqlx-core/Cargo.toml b/sqlx-core/Cargo.toml index 24dac44c8f..be49137883 100644 --- a/sqlx-core/Cargo.toml +++ b/sqlx-core/Cargo.toml @@ -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" diff --git a/sqlx-core/src/mysql/types/mod.rs b/sqlx-core/src/mysql/types/mod.rs index 33b5fe9354..4f7854b5f2 100644 --- a/sqlx-core/src/mysql/types/mod.rs +++ b/sqlx-core/src/mysql/types/mod.rs @@ -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) //! diff --git a/sqlx-core/src/mysql/types/uuid.rs b/sqlx-core/src/mysql/types/uuid.rs index 114405db22..594463cd3d 100644 --- a/sqlx-core/src/mysql/types/uuid.rs +++ b/sqlx-core/src/mysql/types/uuid.rs @@ -1,4 +1,4 @@ -use uuid::{fmt::Hyphenated, Uuid}; +use uuid::{adapter::Hyphenated, Uuid}; use crate::decode::Decode; use crate::encode::{Encode, IsNull}; @@ -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()) } } diff --git a/sqlx-core/src/sqlite/types/mod.rs b/sqlx-core/src/sqlite/types/mod.rs index 45cd77cb9f..1f7dfc50e7 100644 --- a/sqlx-core/src/sqlite/types/mod.rs +++ b/sqlx-core/src/sqlite/types/mod.rs @@ -35,7 +35,7 @@ //! | Rust type | Sqlite type(s) | //! |---------------------------------------|------------------------------------------------------| //! | `uuid::Uuid` | BLOB, TEXT | -//! | `uuid::fmt::Hyphenated` | TEXT | +//! | `uuid::adapter::Hyphenated` | TEXT | //! //! # Nullable //! diff --git a/sqlx-core/src/sqlite/types/uuid.rs b/sqlx-core/src/sqlite/types/uuid.rs index fca8095fcf..272f58bf80 100644 --- a/sqlx-core/src/sqlite/types/uuid.rs +++ b/sqlx-core/src/sqlite/types/uuid.rs @@ -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 for Uuid { fn type_info() -> SqliteTypeInfo { @@ -53,6 +53,6 @@ impl Decode<'_, Sqlite> for Hyphenated { let uuid: Result = Uuid::parse_str(&value.text().map(ToOwned::to_owned)?).map_err(Into::into); - Ok(uuid?.hyphenated()) + Ok(uuid?.to_hyphenated()) } } diff --git a/tests/mysql/types.rs b/tests/mysql/types.rs index 4078b733e1..f8e0766bb0 100644 --- a/tests/mysql/types.rs +++ b/tests/mysql/types.rs @@ -51,11 +51,11 @@ test_type!(uuid(MySql, )); #[cfg(feature = "uuid")] -test_type!(uuid_hyphenated(MySql, +test_type!(uuid_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")] diff --git a/tests/sqlite/types.rs b/tests/sqlite/types.rs index f2ea047025..181fbb45a7 100644 --- a/tests/sqlite/types.rs +++ b/tests/sqlite/types.rs @@ -140,9 +140,9 @@ test_type!(uuid(Sqlite, )); #[cfg(feature = "uuid")] -test_type!(uuid_hyphenated(Sqlite, +test_type!(uuid_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() ));