Skip to content

Commit

Permalink
Switch rust_decimal to BigDecimal, and increase precision to match Po…
Browse files Browse the repository at this point in the history
…stgres NUMERIC type precision, addresses cornucopia-rs#204
  • Loading branch information
farazfazli committed Mar 23, 2023
1 parent 5098729 commit c03cf61
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 217 deletions.
233 changes: 38 additions & 195 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cornucopia/src/type_registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl TypeRegistrar {
Type::UUID => ("uuid::Uuid", true),
Type::INET => ("std::net::IpAddr", true),
Type::MACADDR => ("eui48::MacAddress", true),
Type::NUMERIC => ("rust_decimal::Decimal", true),
Type::NUMERIC => ("bigdecimal::BigDecimal", true),
_ => {
return Err(Error::UnsupportedPostgresType {
src: module_info.clone().into(),
Expand Down
2 changes: 1 addition & 1 deletion test_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ serde_json = { version = "1.0.91", features = ["raw_value"] }
time = { version = "0.3.17", features = ["parsing", "serde"] }
uuid = { version = "1.2.2", features = ["serde"] }
eui48 = { version = "1.1.0", features = ["serde"] }
rust_decimal = { version = "1.28.0", features = ["db-postgres"] }
bigdecimal = { version = "0.3.0" }
Loading

0 comments on commit c03cf61

Please sign in to comment.