Duration parses the provided argument into a [`Value::Duration`] value. The argument must be string, and must be in the format of a duration. See the [`crate::duration::parse_duration`] documentation for more information on the supported formats. # Examples - `1h` parses as 1 hour - `1.5h` parses as 1 hour and 30 minutes - `1h30m` parses as 1 hour and 30 minutes - `1h30m1s` parses as 1 hour, 30
(value: Arc<String>)
| 314 | /// - `1ns` parses as 1 nanosecond |
| 315 | /// - `1.5ns` parses as 1 nanosecond (sub-nanosecond durations not supported) |
| 316 | pub fn duration(value: Arc<String>) -> crate::functions::Result<Value> { |
| 317 | Ok(Value::Duration({ |
| 318 | let i = value.as_str(); |
| 319 | let (_, duration) = crate::duration::parse_duration(i) |
| 320 | .map_err(|e| ExecutionError::function_error("duration", e.to_string()))?; |
| 321 | Ok(duration) |
| 322 | }?)) |
| 323 | } |
| 324 | |
| 325 | fn _timestamp(i: &str) -> Result<chrono::DateTime<chrono::FixedOffset>> { |
| 326 | chrono::DateTime::parse_from_rfc3339(i) |
nothing calls this directly
no test coverage detected