MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / collect_function_args

Function collect_function_args

nodedb-sql/src/resolver/expr/functions.rs:134–158  ·  view source on GitHub ↗

Collect function call arguments, converting each `Expr` to `SqlExpr`.

(func: &ast::Function, depth: &mut usize)

Source from the content-addressed store, hash-verified

132
133/// Collect function call arguments, converting each `Expr` to `SqlExpr`.
134fn collect_function_args(func: &ast::Function, depth: &mut usize) -> Result<Vec<SqlExpr>> {
135 match &func.args {
136 ast::FunctionArguments::None => Ok(Vec::new()),
137 ast::FunctionArguments::Subquery(_) => Err(SqlError::Unsupported {
138 detail: "subquery in function args".into(),
139 }),
140 ast::FunctionArguments::List(arg_list) => arg_list
141 .args
142 .iter()
143 .filter_map(|a| match a {
144 ast::FunctionArg::Unnamed(ast::FunctionArgExpr::Expr(e)) => {
145 Some(convert_expr_depth(e, depth))
146 }
147 ast::FunctionArg::Unnamed(ast::FunctionArgExpr::Wildcard) => {
148 Some(Ok(SqlExpr::Wildcard))
149 }
150 ast::FunctionArg::Named {
151 arg: ast::FunctionArgExpr::Expr(e),
152 ..
153 } => Some(convert_expr_depth(e, depth)),
154 _ => None,
155 })
156 .collect::<Result<Vec<_>>>(),
157 }
158}

Callers 1

intercept_fts_functionFunction · 0.85

Calls 2

convert_expr_depthFunction · 0.85
iterMethod · 0.45

Tested by

no test coverage detected