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

Method validate_and_execute_function

graphlite/src/exec/executor.rs:8273–8303  ·  view source on GitHub ↗

ROADMAP v0.5.0 - Function validation wrapper

(
        &self,
        func_name: &str,
        arg_types: &[GqlType],
        _arg_values: &[Value],
        _context: &ExecutionContext,
    )

Source from the content-addressed store, hash-verified

8271 /// Validate function arguments and get return type
8272 #[allow(dead_code)] // ROADMAP v0.5.0 - Function validation wrapper
8273 fn validate_and_execute_function(
8274 &self,
8275 func_name: &str,
8276 arg_types: &[GqlType],
8277 _arg_values: &[Value],
8278 _context: &ExecutionContext,
8279 ) -> Result<GqlType, ExecutionError> {
8280 // For now, return a default type based on known functions
8281 // In a full implementation, we'd look up function signatures
8282 match func_name.to_uppercase().as_str() {
8283 "COUNT" => Ok(GqlType::BigInt),
8284 "SUM" | "AVG" | "MIN" | "MAX" => Ok(GqlType::Double),
8285 "NOW" | "DATETIME" => Ok(GqlType::ZonedDateTime { precision: None }),
8286 "DURATION" => Ok(GqlType::Duration { precision: None }),
8287 "TIME_WINDOW" => Ok(GqlType::Duration { precision: None }),
8288 // Graph functions
8289 "LABELS" => Ok(GqlType::List {
8290 element_type: Box::new(GqlType::String { max_length: None }),
8291 max_length: None,
8292 }),
8293 "TYPE" | "ID" => Ok(GqlType::String { max_length: None }),
8294 "PROPERTIES" => Ok(GqlType::Record),
8295 _ => {
8296 // Default to the first argument type or string
8297 Ok(arg_types
8298 .first()
8299 .cloned()
8300 .unwrap_or(GqlType::String { max_length: None }))
8301 }
8302 }
8303 }
8304
8305 /// Execute a function call (delegates to existing function registry)
8306 #[allow(dead_code)] // ROADMAP v0.5.0 - Function call execution

Callers 1

Calls 2

as_strMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected