Extract a string literal from a function argument expression.
(expr: &ast::Expr, option: &str)
| 208 | |
| 209 | /// Extract a string literal from a function argument expression. |
| 210 | fn extract_string(expr: &ast::Expr, option: &str) -> Result<String> { |
| 211 | match expr { |
| 212 | ast::Expr::Value(v) => match &v.value { |
| 213 | ast::Value::SingleQuotedString(s) => Ok(s.clone()), |
| 214 | _ => Err(SqlError::Unsupported { |
| 215 | detail: format!( |
| 216 | "ANN option '{option}' expects a string literal (e.g. => 'rabitq'), got: {expr}" |
| 217 | ), |
| 218 | }), |
| 219 | }, |
| 220 | _ => Err(SqlError::Unsupported { |
| 221 | detail: format!( |
| 222 | "ANN option '{option}' expects a string literal (e.g. => 'rabitq'), got: {expr}" |
| 223 | ), |
| 224 | }), |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /// Extract a non-negative integer from a function argument expression. |
| 229 | fn extract_u64(expr: &ast::Expr, option: &str) -> Result<u64> { |
no test coverage detected