MCPcopy Create free account
hub / github.com/PRQL/prql / into_tuple_items

Function into_tuple_items

prqlc/prqlc/src/sql/operators.rs:185–193  ·  view source on GitHub ↗

Find the items in a `@{a=b}`. We're only using annotations with tuples; we can consider formalizing this constraint.

(expr: pl::Expr)

Source from the content-addressed store, hash-verified

183/// Find the items in a `@{a=b}`. We're only using annotations with tuples;
184/// we can consider formalizing this constraint.
185fn into_tuple_items(expr: pl::Expr) -> Result<Vec<(String, pl::ExprKind)>, pl::Expr> {
186 match expr.kind {
187 pl::ExprKind::Tuple(items) => items
188 .into_iter()
189 .map(|item| Ok((item.alias.clone().unwrap(), item.kind)))
190 .collect(),
191 _ => Err(expr),
192 }
193}

Callers 1

find_operator_implFunction · 0.85

Calls 3

mapMethod · 0.80
into_iterMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected