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

Function connection

backend/src/graphql/relay.rs:9–35  ·  view source on GitHub ↗
(
    after: Option<String>,
    before: Option<String>,
    first: Option<i32>,
    last: Option<i32>,
    results: Vec<N>,
)

Source from the content-addressed store, hash-verified

7use crate::prelude::*;
8
9pub async fn connection<N: OutputType>(
10 after: Option<String>,
11 before: Option<String>,
12 first: Option<i32>,
13 last: Option<i32>,
14 results: Vec<N>,
15) -> Result<Connection<String, N, EmptyFields, EmptyFields, DefaultConnectionName, DefaultEdgeName>>
16{
17 let result = query(
18 after,
19 before,
20 first,
21 last,
22 |_after, _before, _first, _last| async move {
23 let mut connection = Connection::new(false, false);
24 connection.edges.extend(
25 results
26 .into_iter()
27 .map(|n| Edge::with_additional_fields(String::from("0"), n, EmptyFields)),
28 );
29 Ok::<_, Error>(connection)
30 },
31 )
32 .await?;
33
34 Ok(result)
35}
36
37pub async fn topics(
38 after: Option<String>,

Callers 5

activityMethod · 0.85
activityMethod · 0.85
childrenMethod · 0.85
topicsFunction · 0.85
topicsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected