| 70 | } |
| 71 | |
| 72 | pub(super) fn expect_u32(expr: &ast::Expr, ctx: &str) -> Result<u32> { |
| 73 | match expr { |
| 74 | ast::Expr::Value(v) => match &v.value { |
| 75 | ast::Value::Number(n, _) => n.parse::<u32>().map_err(|_| SqlError::TypeMismatch { |
| 76 | detail: format!("{ctx}: expected u32, got {n}"), |
| 77 | }), |
| 78 | other => Err(SqlError::TypeMismatch { |
| 79 | detail: format!("{ctx}: expected number, got {other}"), |
| 80 | }), |
| 81 | }, |
| 82 | _ => Err(SqlError::TypeMismatch { |
| 83 | detail: format!("{ctx}: expected number literal, got {expr}"), |
| 84 | }), |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | pub(super) fn expect_string_array(expr: &ast::Expr, ctx: &str) -> Result<Vec<String>> { |
| 89 | let elems = match expr { |