macros: add support for Postgres + BigDecimal

This commit is contained in:
Austin Bonander 2020-03-17 22:24:01 -07:00
parent 703dad8fcf
commit 3cb42def3b
2 changed files with 5 additions and 0 deletions

View file

@ -62,6 +62,8 @@ impl PgTypeInfo {
match self.id {
TypeId::DATE | TypeId::TIME | TypeId::TIMESTAMP | TypeId::TIMESTAMPTZ => Some("chrono"),
TypeId::UUID => Some("uuid"),
// we can support decoding `PgNumeric` but it's decidedly less useful to the layman
TypeId::NUMERIC => Some("bigdecimal"),
_ => None,
}
}

View file

@ -25,6 +25,9 @@ impl_database_ext! {
#[cfg(feature = "chrono")]
sqlx::types::chrono::DateTime<sqlx::types::chrono::Utc> | sqlx::types::chrono::DateTime<_>,
#[cfg(feature = "bigdecimal")]
sqlx::types::BigDecimal
},
ParamChecking::Strong,
feature-types: info => info.type_feature_gate(),