From 71fc3e74bd9bad23c381a3df370c5f5bb23558fe Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 25 Dec 2020 09:01:11 -0500 Subject: [PATCH] Release postgres-types v0.2.0 --- postgres-types/CHANGELOG.md | 10 ++++ postgres-types/Cargo.toml | 4 +- postgres-types/src/geo_types_04.rs | 78 ------------------------------ postgres-types/src/lib.rs | 2 - postgres/Cargo.toml | 1 - tokio-postgres/Cargo.toml | 4 +- 6 files changed, 12 insertions(+), 87 deletions(-) delete mode 100644 postgres-types/src/geo_types_04.rs diff --git a/postgres-types/CHANGELOG.md b/postgres-types/CHANGELOG.md index 1c267923..4fb55631 100644 --- a/postgres-types/CHANGELOG.md +++ b/postgres-types/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## v0.2.0 - 2020-12-25 + +### Changed + +* Upgraded `bytes` to 1.0. + +### Removed + +* Removed support for `geo-types` 0.4. + ## v0.1.3 - 2020-10-17 ### Added diff --git a/postgres-types/Cargo.toml b/postgres-types/Cargo.toml index 0707345f..40edc621 100644 --- a/postgres-types/Cargo.toml +++ b/postgres-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "postgres-types" -version = "0.1.3" +version = "0.2.0" authors = ["Steven Fackler "] edition = "2018" license = "MIT/Apache-2.0" @@ -15,7 +15,6 @@ derive = ["postgres-derive"] with-bit-vec-0_6 = ["bit-vec-06"] with-chrono-0_4 = ["chrono-04"] with-eui48-0_4 = ["eui48-04"] -with-geo-types-0_4 = ["geo-types-04"] with-geo-types-0_6 = ["geo-types-06"] with-serde_json-1 = ["serde-1", "serde_json-1"] with-uuid-0_8 = ["uuid-08"] @@ -30,7 +29,6 @@ postgres-derive = { version = "0.4.0", optional = true, path = "../postgres-deri bit-vec-06 = { version = "0.6", package = "bit-vec", optional = true } chrono-04 = { version = "0.4.16", package = "chrono", default-features = false, features = ["clock"], optional = true } eui48-04 = { version = "0.4", package = "eui48", optional = true } -geo-types-04 = { version = "0.4", package = "geo-types", optional = true } geo-types-06 = { version = "0.6", 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 } diff --git a/postgres-types/src/geo_types_04.rs b/postgres-types/src/geo_types_04.rs deleted file mode 100644 index eb8b958e..00000000 --- a/postgres-types/src/geo_types_04.rs +++ /dev/null @@ -1,78 +0,0 @@ -use bytes::BytesMut; -use fallible_iterator::FallibleIterator; -use geo_types_04::{Coordinate, LineString, Point, Rect}; -use postgres_protocol::types; -use std::error::Error; - -use crate::{FromSql, IsNull, ToSql, Type}; - -impl<'a> FromSql<'a> for Point { - fn from_sql(_: &Type, raw: &[u8]) -> Result> { - let point = types::point_from_sql(raw)?; - Ok(Point::new(point.x(), point.y())) - } - - accepts!(POINT); -} - -impl ToSql for Point { - fn to_sql(&self, _: &Type, out: &mut BytesMut) -> Result> { - types::point_to_sql(self.x(), self.y(), out); - Ok(IsNull::No) - } - - accepts!(POINT); - to_sql_checked!(); -} - -impl<'a> FromSql<'a> for Rect { - fn from_sql(_: &Type, raw: &[u8]) -> Result> { - let rect = types::box_from_sql(raw)?; - Ok(Rect { - min: Coordinate { - x: rect.lower_left().x(), - y: rect.lower_left().y(), - }, - max: Coordinate { - x: rect.upper_right().x(), - y: rect.upper_right().y(), - }, - }) - } - - accepts!(BOX); -} - -impl ToSql for Rect { - fn to_sql(&self, _: &Type, out: &mut BytesMut) -> Result> { - types::box_to_sql(self.min.x, self.min.y, self.max.x, self.max.y, out); - Ok(IsNull::No) - } - - accepts!(BOX); - to_sql_checked!(); -} - -impl<'a> FromSql<'a> for LineString { - fn from_sql(_: &Type, raw: &[u8]) -> Result> { - let path = types::path_from_sql(raw)?; - let points = path - .points() - .map(|p| Ok(Coordinate { x: p.x(), y: p.y() })) - .collect()?; - Ok(LineString(points)) - } - - accepts!(PATH); -} - -impl ToSql for LineString { - fn to_sql(&self, _: &Type, out: &mut BytesMut) -> Result> { - let closed = false; // always encode an open path from LineString - types::path_to_sql(closed, self.0.iter().map(|p| (p.x, p.y)), out)?; - Ok(IsNull::No) - } - - accepts!(PATH); - to_sql_checked!(); -} diff --git a/postgres-types/src/lib.rs b/postgres-types/src/lib.rs index 7e81998b..2909b81e 100644 --- a/postgres-types/src/lib.rs +++ b/postgres-types/src/lib.rs @@ -191,8 +191,6 @@ mod bit_vec_06; mod chrono_04; #[cfg(feature = "with-eui48-0_4")] mod eui48_04; -#[cfg(feature = "with-geo-types-0_4")] -mod geo_types_04; #[cfg(feature = "with-geo-types-0_6")] mod geo_types_06; #[cfg(feature = "with-serde_json-1")] diff --git a/postgres/Cargo.toml b/postgres/Cargo.toml index 52ba17a4..70d7ee30 100644 --- a/postgres/Cargo.toml +++ b/postgres/Cargo.toml @@ -24,7 +24,6 @@ circle-ci = { repository = "sfackler/rust-postgres" } with-bit-vec-0_6 = ["tokio-postgres/with-bit-vec-0_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-geo-types-0_6 = ["tokio-postgres/with-geo-types-0_6"] with-serde_json-1 = ["tokio-postgres/with-serde_json-1"] with-uuid-0_8 = ["tokio-postgres/with-uuid-0_8"] diff --git a/tokio-postgres/Cargo.toml b/tokio-postgres/Cargo.toml index 24d962f6..908d1a38 100644 --- a/tokio-postgres/Cargo.toml +++ b/tokio-postgres/Cargo.toml @@ -30,7 +30,6 @@ runtime = ["tokio/net", "tokio/time"] with-bit-vec-0_6 = ["postgres-types/with-bit-vec-0_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-geo-types-0_6 = ["postgres-types/with-geo-types-0_6"] with-serde_json-1 = ["postgres-types/with-serde_json-1"] with-uuid-0_8 = ["postgres-types/with-uuid-0_8"] @@ -48,7 +47,7 @@ percent-encoding = "2.0" pin-project-lite = "0.2" phf = "0.8" postgres-protocol = { version = "0.6.0", path = "../postgres-protocol" } -postgres-types = { version = "0.1.2", path = "../postgres-types" } +postgres-types = { version = "0.2.0", path = "../postgres-types" } socket2 = "0.3" tokio = { version = "1.0", features = ["io-util"] } tokio-util = { version = "0.6", features = ["codec"] } @@ -61,7 +60,6 @@ criterion = "0.3" bit-vec-06 = { version = "0.6", package = "bit-vec" } chrono-04 = { version = "0.4", package = "chrono", default-features = false } eui48-04 = { version = "0.4", package = "eui48" } -geo-types-04 = { version = "0.4", package = "geo-types" } geo-types-06 = { version = "0.6", package = "geo-types" } serde-1 = { version = "1.0", package = "serde" } serde_json-1 = { version = "1.0", package = "serde_json" }