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

Function expect_string_array

nodedb-sql/src/planner/array_fn/helpers.rs:88–114  ·  view source on GitHub ↗
(expr: &ast::Expr, ctx: &str)

Source from the content-addressed store, hash-verified

86}
87
88pub(super) fn expect_string_array(expr: &ast::Expr, ctx: &str) -> Result<Vec<String>> {
89 let elems = match expr {
90 ast::Expr::Array(arr) => arr.elem.clone(),
91 ast::Expr::Function(f)
92 if matches!(
93 crate::parser::normalize::normalize_object_name_checked(&f.name)
94 .as_deref()
95 .unwrap_or(""),
96 "make_array" | "array"
97 ) =>
98 {
99 match &f.args {
100 ast::FunctionArguments::List(list) => collect_args(&list.args),
101 _ => Vec::new(),
102 }
103 }
104 _ => {
105 return Err(SqlError::Unsupported {
106 detail: format!("{ctx}: expected array literal, got {expr}"),
107 });
108 }
109 };
110 elems
111 .iter()
112 .map(|e| expect_string_literal(e, ctx))
113 .collect()
114}
115
116pub(super) fn is_null_literal(expr: &ast::Expr) -> bool {
117 matches!(

Callers 2

plan_sliceFunction · 0.85
plan_projectFunction · 0.85

Calls 5

collect_argsFunction · 0.85
expect_string_literalFunction · 0.85
collectMethod · 0.80
cloneMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected