MCPcopy Create free account
hub / github.com/emwalker/digraph / children

Method children

backend/src/graphql/topic.rs:214–258  ·  view source on GitHub ↗
(
        &self,
        ctx: &Context<'_>,
        search_string: Option<String>,
        after: Option<String>,
        before: Option<String>,
        first: Option<i32>,
        last: Option<i32>,

Source from the content-addressed store, hash-verified

212 }
213
214 async fn children(
215 &self,
216 ctx: &Context<'_>,
217 search_string: Option<String>,
218 after: Option<String>,
219 before: Option<String>,
220 first: Option<i32>,
221 last: Option<i32>,
222 ) -> Result<SearchResultConnection> {
223 let search = git::Search::parse(&search_string.unwrap_or_default())?;
224
225 if !search.is_empty() {
226 let git::FindMatchesResult { matches, .. } = ctx
227 .data_unchecked::<Store>()
228 .search(&self.0, &search)
229 .await?;
230
231 let mut results = vec![];
232 for row in matches {
233 results.push(row.try_into()?);
234 }
235
236 return relay::connection(after, before, first, last, results).await;
237 }
238
239 let objects = ctx
240 .data_unchecked::<Store>()
241 .fetch_objects_with_context(self.0.child_ids().to_owned(), 50, self.0.context_id())
242 .await?
243 .into_iter();
244 let mut matches = BTreeSet::new();
245
246 for object in objects {
247 let row = object.to_search_match(Locale::EN, &search)?;
248 matches.insert(row);
249 }
250
251 let mut results = vec![];
252
253 for row in matches.into_iter() {
254 results.push(row.try_into()?);
255 }
256
257 relay::connection(after, before, first, last, results).await
258 }
259
260 async fn display_name(&self) -> String {
261 self.0.display_name(Locale::EN)

Callers

nothing calls this directly

Calls 10

parseFunction · 0.85
connectionFunction · 0.85
searchMethod · 0.80
child_idsMethod · 0.80
context_idMethod · 0.80
to_search_matchMethod · 0.80
insertMethod · 0.80
is_emptyMethod · 0.45
try_intoMethod · 0.45

Tested by

no test coverage detected