mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-26 18:00:41 +00:00
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:
@@ -114,6 +114,11 @@ impl Interval {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a tuple(months, days, nanoseconds) from the interval.
|
||||
pub fn to_month_day_nano(&self) -> (i32, i32, i64) {
|
||||
(self.months, self.days, self.nsecs)
|
||||
}
|
||||
|
||||
/// Converts the interval to nanoseconds.
|
||||
pub fn to_nanosecond(&self) -> i128 {
|
||||
let days = (self.days as i64) + DAYS_PER_MONTH * (self.months as i64);
|
||||
|
||||
Reference in New Issue
Block a user