mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-06-01 12:50:40 +00:00
feat: impl date_add/date_sub functions (#2881)
* feat: adds date_add and date_sub function * test: add date function * fix: adds interval to date returns wrong result * fix: header * fix: typo * fix: timestamp resolution * fix: capacity * chore: apply suggestion * fix: wrong behavior when adding intervals to timestamp, date and datetime * chore: remove unused error * test: refactor and add some tests
This commit is contained in:
@@ -210,6 +210,14 @@ impl Value {
|
||||
}
|
||||
}
|
||||
|
||||
/// Cast Value to Interval. Return None if value is not a valid interval data type.
|
||||
pub fn as_interval(&self) -> Option<Interval> {
|
||||
match self {
|
||||
Value::Interval(i) => Some(*i),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Cast Value to Date. Return None if value is not a valid date data type.
|
||||
pub fn as_date(&self) -> Option<Date> {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user