mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
Add default implementation for PgMoney (#3018)
This commit is contained in:
parent
235604fbce
commit
0299959ca6
1 changed files with 8 additions and 1 deletions
|
@ -48,7 +48,7 @@ use std::{
|
|||
/// https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/cash.c#L114-L123
|
||||
///
|
||||
/// [`MONEY`]: https://www.postgresql.org/docs/current/datatype-money.html
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
|
||||
pub struct PgMoney(
|
||||
/// The raw integer value sent over the wire; for locales with `frac_digits=2` (i.e. most
|
||||
/// of them), this will be the value in whole cents.
|
||||
|
@ -278,6 +278,13 @@ mod tests {
|
|||
assert_eq!(PgMoney(-1), money);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_value() {
|
||||
let money = PgMoney::default();
|
||||
|
||||
assert_eq!(money, PgMoney(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn add_overflow_panics() {
|
||||
|
|
Loading…
Reference in a new issue