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

Function pluck_annotation

prqlc/prqlc/src/sql/operators.rs:172–181  ·  view source on GitHub ↗
(
    annotation: &mut Vec<(String, pl::ExprKind)>,
    name: &str,
)

Source from the content-addressed store, hash-verified

170}
171
172fn pluck_annotation(
173 annotation: &mut Vec<(String, pl::ExprKind)>,
174 name: &str,
175) -> Option<pl::Literal> {
176 annotation
177 .pluck(|(n, val)| if n == name { Ok(val) } else { Err((n, val)) })
178 .into_iter()
179 .next()
180 .and_then(|val| val.into_literal().ok())
181}
182
183/// Find the items in a `@{a=b}`. We're only using annotations with tuples;
184/// we can consider formalizing this constraint.

Callers 1

find_operator_implFunction · 0.85

Calls 3

nextMethod · 0.80
into_iterMethod · 0.80
pluckMethod · 0.80

Tested by

no test coverage detected