mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 18:40:24 +00:00
* Fix missing num-bigint dependency for rust_decimal * Fix missing feature name change from "decimal" to "rust_decimal" * update missing "decimal"->"rust_decimal" renaming in range.rs * Update money.rs references to "decimal" * Update "decimal" -> "rust_decimal"
This commit is contained in:
@@ -196,7 +196,7 @@ mod time_tz;
|
||||
#[cfg(feature = "bigdecimal")]
|
||||
mod bigdecimal;
|
||||
|
||||
#[cfg(any(feature = "bigdecimal", feature = "decimal"))]
|
||||
#[cfg(any(feature = "bigdecimal", feature = "rust_decimal"))]
|
||||
mod numeric;
|
||||
|
||||
#[cfg(feature = "rust_decimal")]
|
||||
|
||||
@@ -81,7 +81,7 @@ impl PgMoney {
|
||||
/// See the type-level docs for an explanation of `locale_frac_digits`.
|
||||
///
|
||||
/// [`Decimal`]: crate::types::Decimal
|
||||
#[cfg(feature = "decimal")]
|
||||
#[cfg(feature = "rust_decimal")]
|
||||
pub fn to_decimal(self, locale_frac_digits: u32) -> rust_decimal::Decimal {
|
||||
rust_decimal::Decimal::new(self.0, locale_frac_digits)
|
||||
}
|
||||
@@ -94,7 +94,7 @@ impl PgMoney {
|
||||
/// If the value is larger than 63 bits it will be truncated.
|
||||
///
|
||||
/// [`Decimal`]: crate::types::Decimal
|
||||
#[cfg(feature = "decimal")]
|
||||
#[cfg(feature = "rust_decimal")]
|
||||
pub fn from_decimal(mut decimal: rust_decimal::Decimal, locale_frac_digits: u32) -> Self {
|
||||
// this is all we need to convert to our expected locale's `frac_digits`
|
||||
decimal.rescale(locale_frac_digits);
|
||||
@@ -316,7 +316,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "decimal")]
|
||||
#[cfg(feature = "rust_decimal")]
|
||||
fn conversion_to_decimal_works() {
|
||||
assert_eq!(
|
||||
rust_decimal::Decimal::new(12345, 2),
|
||||
@@ -325,7 +325,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "decimal")]
|
||||
#[cfg(feature = "rust_decimal")]
|
||||
fn conversion_from_decimal_works() {
|
||||
assert_eq!(
|
||||
PgMoney(12345),
|
||||
|
||||
@@ -143,7 +143,7 @@ impl Type<Postgres> for PgRange<bigdecimal::BigDecimal> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "decimal")]
|
||||
#[cfg(feature = "rust_decimal")]
|
||||
impl Type<Postgres> for PgRange<rust_decimal::Decimal> {
|
||||
fn type_info() -> PgTypeInfo {
|
||||
PgTypeInfo::NUM_RANGE
|
||||
|
||||
Reference in New Issue
Block a user