MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / array_position

Function array_position

crates/gitql-std/src/array/mod.rs:231–238  ·  view source on GitHub ↗
(inputs: &[Box<dyn Value>])

Source from the content-addressed store, hash-verified

229}
230
231pub fn array_position(inputs: &[Box<dyn Value>]) -> Box<dyn Value> {
232 let array = inputs[0].as_array().unwrap();
233 let elemnet = &inputs[1];
234 if let Some(index) = array.iter().position(|r| r.equals(elemnet)) {
235 return Box::new(IntValue::new((index + 1) as i64));
236 }
237 Box::new(NullValue)
238}
239
240pub fn array_positions(inputs: &[Box<dyn Value>]) -> Box<dyn Value> {
241 let array = inputs[0].as_array().unwrap();

Callers

nothing calls this directly

Calls 2

as_arrayMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…