Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 36 additions & 35 deletions src/driver/sqlx_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"VARCHAR" | "CHAR" | "TEXT" | "NAME" => Value::String(
row.try_get::<Option<String>, _>(c.ordinal())
.expect("Failed to get string")
.map(Box::new),
,
),
#[cfg(feature = "postgres-array")]
"VARCHAR[]" | "CHAR[]" | "TEXT[]" | "NAME[]" => Value::Array(
Expand All @@ -533,7 +533,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::String(Some(Box::new(val))))
.map(|val| Value::String(Some(val)))
.collect(),
)
}),
Expand All @@ -542,7 +542,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"BYTEA" => Value::Bytes(
row.try_get::<Option<Vec<u8>>, _>(c.ordinal())
.expect("Failed to get bytes")
.map(Box::new),
,
),
#[cfg(feature = "postgres-array")]
"BYTEA[]" => Value::Array(
Expand All @@ -552,7 +552,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::Bytes(Some(Box::new(val))))
.map(|val| Value::Bytes(Some(val)))
.collect(),
)
}),
Expand All @@ -562,7 +562,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"NUMERIC" => Value::BigDecimal(
row.try_get::<Option<bigdecimal::BigDecimal>, _>(c.ordinal())
.expect("Failed to get numeric")
.map(Box::new),
,
),
#[cfg(all(
feature = "with-rust_decimal",
Expand All @@ -571,7 +571,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"NUMERIC" => Value::Decimal(
row.try_get(c.ordinal())
.expect("Failed to get numeric")
.map(Box::new),
,
),

#[cfg(all(feature = "with-bigdecimal", feature = "postgres-array"))]
Expand All @@ -582,7 +582,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::BigDecimal(Some(Box::new(val))))
.map(|val| Value::BigDecimal(Some(val)))
.collect(),
)
}),
Expand All @@ -599,7 +599,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::Decimal(Some(Box::new(val))))
.map(|val| Value::Decimal(Some(val)))
.collect(),
)
}),
Expand All @@ -625,7 +625,8 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"JSON" | "JSONB" => Value::Json(
row.try_get::<Option<serde_json::Value>, _>(c.ordinal())
.expect("Failed to get json")
.map(Box::new),
.map(Box::new)
,
),
#[cfg(any(feature = "json-array", feature = "postgres-array"))]
"JSON[]" | "JSONB[]" => Value::Array(
Expand All @@ -645,7 +646,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"INET" | "CIDR" => Value::IpNetwork(
row.try_get::<Option<ipnetwork::IpNetwork>, _>(c.ordinal())
.expect("Failed to get ip address")
.map(Box::new),
,
),
#[cfg(feature = "with-ipnetwork")]
"INET[]" | "CIDR[]" => Value::Array(
Expand All @@ -655,7 +656,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::IpNetwork(Some(Box::new(val))))
.map(|val| Value::IpNetwork(Some(val)))
.collect(),
)
}),
Expand All @@ -665,7 +666,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"MACADDR" | "MACADDR8" => Value::MacAddress(
row.try_get::<Option<mac_address::MacAddress>, _>(c.ordinal())
.expect("Failed to get mac address")
.map(Box::new),
,
),
#[cfg(all(feature = "with-mac_address", feature = "postgres-array"))]
"MACADDR[]" | "MACADDR8[]" => Value::Array(
Expand All @@ -675,7 +676,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::MacAddress(Some(Box::new(val))))
.map(|val| Value::MacAddress(Some(val)))
.collect(),
)
}),
Expand All @@ -685,13 +686,13 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"TIMESTAMP" => Value::ChronoDateTime(
row.try_get::<Option<chrono::NaiveDateTime>, _>(c.ordinal())
.expect("Failed to get timestamp")
.map(Box::new),
,
),
#[cfg(all(feature = "with-time", not(feature = "with-chrono")))]
"TIMESTAMP" => Value::TimeDateTime(
row.try_get::<Option<time::PrimitiveDateTime>, _>(c.ordinal())
.expect("Failed to get timestamp")
.map(Box::new),
,
),

#[cfg(all(feature = "with-chrono", feature = "postgres-array"))]
Expand All @@ -702,7 +703,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::ChronoDateTime(Some(Box::new(val))))
.map(|val| Value::ChronoDateTime(Some(val)))
.collect(),
)
}),
Expand All @@ -719,7 +720,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::TimeDateTime(Some(Box::new(val))))
.map(|val| Value::TimeDateTime(Some(val)))
.collect(),
)
}),
Expand All @@ -729,13 +730,13 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"DATE" => Value::ChronoDate(
row.try_get::<Option<chrono::NaiveDate>, _>(c.ordinal())
.expect("Failed to get date")
.map(Box::new),
,
),
#[cfg(all(feature = "with-time", not(feature = "with-chrono")))]
"DATE" => Value::TimeDate(
row.try_get::<Option<time::Date>, _>(c.ordinal())
.expect("Failed to get date")
.map(Box::new),
,
),

#[cfg(all(feature = "with-chrono", feature = "postgres-array"))]
Expand All @@ -746,7 +747,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::ChronoDate(Some(Box::new(val))))
.map(|val| Value::ChronoDate(Some(val)))
.collect(),
)
}),
Expand All @@ -763,7 +764,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::TimeDate(Some(Box::new(val))))
.map(|val| Value::TimeDate(Some(val)))
.collect(),
)
}),
Expand All @@ -773,13 +774,13 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"TIME" => Value::ChronoTime(
row.try_get::<Option<chrono::NaiveTime>, _>(c.ordinal())
.expect("Failed to get time")
.map(Box::new),
,
),
#[cfg(all(feature = "with-time", not(feature = "with-chrono")))]
"TIME" => Value::TimeTime(
row.try_get::<Option<time::Time>, _>(c.ordinal())
.expect("Failed to get time")
.map(Box::new),
,
),

#[cfg(all(feature = "with-chrono", feature = "postgres-array"))]
Expand All @@ -790,7 +791,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::ChronoTime(Some(Box::new(val))))
.map(|val| Value::ChronoTime(Some(val)))
.collect(),
)
}),
Expand All @@ -807,7 +808,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::TimeTime(Some(Box::new(val))))
.map(|val| Value::TimeTime(Some(val)))
.collect(),
)
}),
Expand All @@ -817,13 +818,13 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"TIMESTAMPTZ" => Value::ChronoDateTimeUtc(
row.try_get::<Option<chrono::DateTime<chrono::Utc>>, _>(c.ordinal())
.expect("Failed to get timestamptz")
.map(Box::new),
,
),
#[cfg(all(feature = "with-time", not(feature = "with-chrono")))]
"TIMESTAMPTZ" => Value::TimeDateTime(
row.try_get::<Option<time::PrimitiveDateTime>, _>(c.ordinal())
.expect("Failed to get timestamptz")
.map(Box::new),
,
),

#[cfg(all(feature = "with-chrono", feature = "postgres-array"))]
Expand All @@ -836,7 +837,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::ChronoDateTimeUtc(Some(Box::new(val))))
.map(|val| Value::ChronoDateTimeUtc(Some(val)))
.collect(),
)
}),
Expand All @@ -853,7 +854,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::TimeDateTime(Some(Box::new(val))))
.map(|val| Value::TimeDateTime(Some(val)))
.collect(),
)
}),
Expand All @@ -863,13 +864,13 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"TIMETZ" => Value::ChronoTime(
row.try_get::<Option<chrono::NaiveTime>, _>(c.ordinal())
.expect("Failed to get timetz")
.map(Box::new),
,
),
#[cfg(all(feature = "with-time", not(feature = "with-chrono")))]
"TIMETZ" => Value::TimeTime(
row.try_get(c.ordinal())
.expect("Failed to get timetz")
.map(Box::new),
,
),

#[cfg(all(feature = "with-chrono", feature = "postgres-array"))]
Expand All @@ -880,7 +881,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::ChronoTime(Some(Box::new(val))))
.map(|val| Value::ChronoTime(Some(val)))
.collect(),
)
}),
Expand All @@ -897,7 +898,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::TimeTime(Some(Box::new(val))))
.map(|val| Value::TimeTime(Some(val)))
.collect(),
)
}),
Expand All @@ -907,7 +908,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
"UUID" => Value::Uuid(
row.try_get::<Option<uuid::Uuid>, _>(c.ordinal())
.expect("Failed to get uuid")
.map(Box::new),
,
),

#[cfg(all(feature = "with-uuid", feature = "postgres-array"))]
Expand All @@ -918,7 +919,7 @@ pub(crate) fn from_sqlx_postgres_row_to_proxy_row(row: &sqlx::postgres::PgRow) -
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::Uuid(Some(Box::new(val))))
.map(|val| Value::Uuid(Some(val)))
.collect(),
)
}),
Expand Down
Loading