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

Function function_args_and_distinct

nodedb-sql/src/aggregate_walk.rs:196–214  ·  view source on GitHub ↗
(f: &ast::Function)

Source from the content-addressed store, hash-verified

194}
195
196fn function_args_and_distinct(f: &ast::Function) -> (Vec<SqlExpr>, bool) {
197 let ast::FunctionArguments::List(args) = &f.args else {
198 return (Vec::new(), false);
199 };
200 let parsed = args
201 .args
202 .iter()
203 .filter_map(|a| match a {
204 ast::FunctionArg::Unnamed(ast::FunctionArgExpr::Expr(e)) => convert_expr(e).ok(),
205 ast::FunctionArg::Unnamed(ast::FunctionArgExpr::Wildcard) => Some(SqlExpr::Wildcard),
206 _ => None,
207 })
208 .collect();
209 let distinct = matches!(
210 args.duplicate_treatment,
211 Some(ast::DuplicateTreatment::Distinct)
212 );
213 (parsed, distinct)
214}
215
216#[cfg(test)]
217mod tests {

Callers 1

pre_visit_exprMethod · 0.85

Calls 4

convert_exprFunction · 0.85
collectMethod · 0.80
iterMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected