fix format

This commit is contained in:
al8n 2022-05-21 13:55:58 +08:00
parent db2ef6e137
commit b3ac42fbeb
3 changed files with 7 additions and 7 deletions

View File

@ -14,12 +14,12 @@ impl ScalarType for BigDecimal {
} }
if let Some(f) = n.as_i64() { if let Some(f) = n.as_i64() {
return Ok(BigDecimal::from(f)); return Ok(BigDecimal::from(f));
} }
// unwrap safe here, because we have check the other possibility // unwrap safe here, because we have check the other possibility
Ok(BigDecimal::from(n.as_u64().unwrap())) Ok(BigDecimal::from(n.as_u64().unwrap()))
}, }
Value::String(s) => Ok(BigDecimal::from_str(s)?), Value::String(s) => Ok(BigDecimal::from_str(s)?),
_ => Err(InputValueError::expected_type(value)), _ => Err(InputValueError::expected_type(value)),
} }
@ -28,4 +28,4 @@ impl ScalarType for BigDecimal {
fn to_value(&self) -> Value { fn to_value(&self) -> Value {
Value::String(self.to_string()) Value::String(self.to_string())
} }
} }

View File

@ -15,12 +15,12 @@ impl ScalarType for Decimal {
} }
if let Some(f) = n.as_i64() { if let Some(f) = n.as_i64() {
return Ok(Decimal::from(f)); return Ok(Decimal::from(f));
} }
// unwrap safe here, because we have check the other possibility // unwrap safe here, because we have check the other possibility
Ok(Decimal::from(n.as_u64().unwrap())) Ok(Decimal::from(n.as_u64().unwrap()))
}, }
_ => Err(InputValueError::expected_type(value)), _ => Err(InputValueError::expected_type(value)),
} }
} }

View File

@ -15,6 +15,8 @@ mod string;
#[cfg(feature = "tokio-sync")] #[cfg(feature = "tokio-sync")]
mod tokio; mod tokio;
#[cfg(feature = "bigdecimal")]
mod big_decimal;
#[cfg(feature = "bson")] #[cfg(feature = "bson")]
mod bson; mod bson;
#[cfg(feature = "chrono-tz")] #[cfg(feature = "chrono-tz")]
@ -23,8 +25,6 @@ mod chrono_tz;
mod datetime; mod datetime;
#[cfg(feature = "decimal")] #[cfg(feature = "decimal")]
mod decimal; mod decimal;
#[cfg(feature = "bigdecimal")]
mod big_decimal;
#[cfg(feature = "chrono-duration")] #[cfg(feature = "chrono-duration")]
mod duration; mod duration;
#[cfg(feature = "chrono")] #[cfg(feature = "chrono")]