feat: conversion between interval and gRPC (#2064)

* feat: support grpc for interval type

* chore: add unit test cases.

* chore: cargo clippy

* chore: modify greptime-proto version

* chore: cr comment.

* chore: cargo fmt

* refactor: convert function.
This commit is contained in:
Zou Wei
2023-08-07 14:22:04 +08:00
committed by GitHub
parent 7210b35d86
commit d5cadeeec3
7 changed files with 417 additions and 34 deletions

View File

@@ -135,4 +135,19 @@ mod tests {
assert_eq!(interval, interval.to_owned_scalar());
assert_eq!(1000, interval.into_native());
}
#[test]
fn test_interval_convert_to_native_type() {
let interval = IntervalMonthDayNano::new(1000);
let native_value: i128 = interval.into();
assert_eq!(native_value, 1000);
let interval = IntervalDayTime::new(1000);
let native_interval: i64 = interval.into();
assert_eq!(native_interval, 1000);
let interval = IntervalYearMonth::new(1000);
let native_interval: i32 = interval.into();
assert_eq!(native_interval, 1000);
}
}