remove uuid 0.7 support

This commit is contained in:
Steven Fackler 2019-12-19 16:41:26 -08:00
parent 8ee231f803
commit 37d0a83434
8 changed files with 1 additions and 52 deletions

View File

@ -17,7 +17,6 @@ with-chrono-0_4 = ["chrono-04"]
with-eui48-0_4 = ["eui48-04"]
with-geo-types-0_4 = ["geo-types-04"]
with-serde_json-1 = ["serde-1", "serde_json-1"]
with-uuid-0_7 = ["uuid-07"]
with-uuid-0_8 = ["uuid-08"]
[dependencies]
@ -32,5 +31,4 @@ eui48-04 = { version = "0.4", package = "eui48", optional = true }
geo-types-04 = { version = "0.4", package = "geo-types", optional = true }
serde-1 = { version = "1.0", package = "serde", optional = true }
serde_json-1 = { version = "1.0", package = "serde_json", optional = true }
uuid-07 = { version = "0.7", package = "uuid", optional = true }
uuid-08 = { version = "0.8", package = "uuid", optional = true }

View File

@ -198,8 +198,6 @@ mod eui48_04;
mod geo_types_04;
#[cfg(feature = "with-serde_json-1")]
mod serde_json_1;
#[cfg(feature = "with-uuid-0_7")]
mod uuid_07;
#[cfg(feature = "with-uuid-0_8")]
mod uuid_08;

View File

@ -1,25 +0,0 @@
use bytes::BytesMut;
use postgres_protocol::types;
use std::error::Error;
use uuid_07::Uuid;
use crate::{FromSql, IsNull, ToSql, Type};
impl<'a> FromSql<'a> for Uuid {
fn from_sql(_: &Type, raw: &[u8]) -> Result<Uuid, Box<dyn Error + Sync + Send>> {
let bytes = types::uuid_from_sql(raw)?;
Ok(Uuid::from_bytes(bytes))
}
accepts!(UUID);
}
impl ToSql for Uuid {
fn to_sql(&self, _: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
types::uuid_to_sql(*self.as_bytes(), w);
Ok(IsNull::No)
}
accepts!(UUID);
to_sql_checked!();
}

View File

@ -26,7 +26,6 @@ with-chrono-0_4 = ["tokio-postgres/with-chrono-0_4"]
with-eui48-0_4 = ["tokio-postgres/with-eui48-0_4"]
with-geo-types-0_4 = ["tokio-postgres/with-geo-types-0_4"]
with-serde_json-1 = ["tokio-postgres/with-serde_json-1"]
with-uuid-0_7 = ["tokio-postgres/with-uuid-0_7"]
with-uuid-0_8 = ["tokio-postgres/with-uuid-0_8"]
[dependencies]

View File

@ -32,7 +32,6 @@ with-chrono-0_4 = ["postgres-types/with-chrono-0_4"]
with-eui48-0_4 = ["postgres-types/with-eui48-0_4"]
with-geo-types-0_4 = ["postgres-types/with-geo-types-0_4"]
with-serde_json-1 = ["postgres-types/with-serde_json-1"]
with-uuid-0_7 = ["postgres-types/with-uuid-0_7"]
with-uuid-0_8 = ["postgres-types/with-uuid-0_8"]
[dependencies]

View File

@ -27,7 +27,7 @@ mod private {
/// was prepared previously.
///
/// This trait is "sealed" and cannot be implemented by anything outside this crate.
pub trait ToStatement: private::Sealed {
pub trait ToStatement: Sealed {
#[doc(hidden)]
fn __convert(&self) -> ToStatementType<'_>;
}

View File

@ -22,8 +22,6 @@ mod eui48_04;
mod geo_010;
#[cfg(feature = "with-serde_json-1")]
mod serde_json_1;
#[cfg(feature = "with-uuid-0_7")]
mod uuid_07;
#[cfg(feature = "with-uuid-0_8")]
mod uuid_08;

View File

@ -1,18 +0,0 @@
use uuid_07::Uuid;
use crate::types::test_type;
#[tokio::test]
async fn test_uuid_params() {
test_type(
"UUID",
&[
(
Some(Uuid::parse_str("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11").unwrap()),
"'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'",
),
(None, "NULL"),
],
)
.await
}