| 7 | use crate::prelude::*; |
| 8 | |
| 9 | pub 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 | |
| 37 | pub async fn topics( |
| 38 | after: Option<String>, |