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

Function extract_select_exprs_as_text

nodedb-sql/src/planner/cte.rs:205–222  ·  view source on GitHub ↗

Extract SELECT projection items as raw SQL text strings.

(expr: &SetExpr)

Source from the content-addressed store, hash-verified

203
204/// Extract SELECT projection items as raw SQL text strings.
205fn extract_select_exprs_as_text(expr: &SetExpr) -> Option<Vec<String>> {
206 let select = match expr {
207 SetExpr::Select(s) => s,
208 _ => return None,
209 };
210 Some(
211 select
212 .projection
213 .iter()
214 .map(|item| match item {
215 ast::SelectItem::UnnamedExpr(e) => format!("{e}"),
216 ast::SelectItem::ExprWithAlias { expr: e, .. } => format!("{e}"),
217 ast::SelectItem::Wildcard(_) => "*".into(),
218 ast::SelectItem::QualifiedWildcard(name, _) => format!("{name}.*"),
219 })
220 .collect(),
221 )
222}
223
224/// Extract step SELECT expressions and optional WHERE condition as SQL text.
225///

Callers 1

plan_recursive_valueFunction · 0.85

Calls 2

collectMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected