MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / execute

Method execute

graphlite/src/functions/temporal_functions.rs:206–238  ·  view source on GitHub ↗
(&self, context: &FunctionContext)

Source from the content-addressed store, hash-verified

204 }
205
206 fn execute(&self, context: &FunctionContext) -> FunctionResult<Value> {
207 debug!("Executing DATETIME function");
208
209 // Validate argument count
210 context.validate_argument_count(1)?;
211
212 // Get the datetime string argument
213 let datetime_str = match context.get_argument(0)? {
214 Value::String(s) => s,
215 _ => {
216 return Err(FunctionError::InvalidArgumentType {
217 message: "DATETIME argument must be a string".to_string(),
218 })
219 }
220 };
221
222 // Parse the ISO 8601 datetime string
223 match parse_iso_datetime(datetime_str) {
224 Ok(datetime) => {
225 debug!(
226 "Successfully parsed datetime: {} -> {}",
227 datetime_str, datetime
228 );
229 Ok(Value::DateTime(datetime))
230 }
231 Err(e) => {
232 warn!("Failed to parse datetime '{}': {}", datetime_str, e);
233 Err(FunctionError::ExecutionError {
234 message: format!("Invalid datetime format '{}': {}", datetime_str, e),
235 })
236 }
237 }
238 }
239}
240
241/// NOW function - returns current system time

Callers 9

test_datetime_functionFunction · 0.45
test_now_functionFunction · 0.45
test_duration_functionFunction · 0.45
test_extract_functionFunction · 0.45
test_date_add_functionFunction · 0.45
test_date_sub_functionFunction · 0.45

Calls 11

parse_iso_datetimeFunction · 0.85
parse_iso_durationFunction · 0.85
parse_numeric_durationFunction · 0.85
TimeWindowClass · 0.85
get_argumentMethod · 0.80
formatMethod · 0.80
get_timezone_infoMethod · 0.80
as_strMethod · 0.45
convert_from_utcMethod · 0.45

Tested by 9

test_datetime_functionFunction · 0.36
test_now_functionFunction · 0.36
test_duration_functionFunction · 0.36
test_extract_functionFunction · 0.36
test_date_add_functionFunction · 0.36
test_date_sub_functionFunction · 0.36