Add default implementation for PgInterval (#3013)

This commit is contained in:
Paweł Urbanek
2024-01-26 08:29:51 +01:00
committed by GitHub
parent 5890afe95b
commit af31d5059d

View File

@@ -10,7 +10,7 @@ use crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValue
// `PgInterval` is available for direct access to the INTERVAL type
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
#[derive(Debug, Eq, PartialEq, Clone, Hash, Default)]
pub struct PgInterval {
pub months: i32,
pub days: i32,
@@ -301,6 +301,15 @@ fn test_encode_interval() {
));
assert_eq!(&**buf, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
buf.clear();
assert_eq!(
PgInterval::default(),
PgInterval {
months: 0,
days: 0,
microseconds: 0,
}
);
}
#[test]