Collect function call arguments, converting each `Expr` to `SqlExpr`.
(func: &ast::Function, depth: &mut usize)
| 132 | |
| 133 | /// Collect function call arguments, converting each `Expr` to `SqlExpr`. |
| 134 | fn 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 | } |
no test coverage detected