2
定义一个固定的精确数字(Postgres中的十进制或数字)并将其传递给rust-postgres中的插入的正确方法是什么?在rust-postgres中使用固定精确数字的正确方法是什么?
transaction.execute("INSERT INTO commons_account(
display_name, blocked, balance, blocked_balance, password, salt)
VALUES ($1, $2, $3, $4, $5, $6);", &[&"bob", &false, &0, &0, &"dfasdfsa", &"dfsdsa"]).unwrap();
两个平衡和阻止平衡是numeric
并运行该代码给出了这样的错误
thread 'test' panicked at 'called `Result::unwrap()` on an `Err` value: WrongType(Numeric)'
我刚刚发现,锈不具有一个内置的十进制类型,这只是做的一切更加困难 – ibrabeicker
@ibrabeicker,有https://开头WWW .reddit.com/R /防锈/评论/ 3wfhro/decimal_d128_type_for_rust_for_decimal_floating /;另见https://www.reddit.com/r/rust/comments/3wubj0/numeric_types_in_rust/ – ArtemGr