(&self, ids: &[String])
| 96 | type Error = Error; |
| 97 | |
| 98 | async fn load(&self, ids: &[String]) -> Result<HashMap<String, Self::Value>> { |
| 99 | log::debug!("batch load repositories {:?}", ids); |
| 100 | |
| 101 | let query = format!( |
| 102 | r#" |
| 103 | select |
| 104 | {REPOSITORY_FIELDS} |
| 105 | {REPOSITORY_JOINS} |
| 106 | where r.id = any($1::uuid[]) |
| 107 | and r.id = any($2::uuid[]) |
| 108 | {REPOSITORY_GROUP_BY} |
| 109 | "# |
| 110 | ); |
| 111 | let rows = sqlx::query_as::<_, Row>(&query) |
| 112 | .bind(ids) |
| 113 | .bind(self.viewer.read_repo_ids.to_vec()) |
| 114 | .fetch_all(&self.pool) |
| 115 | .await?; |
| 116 | |
| 117 | Ok(rows |
| 118 | .iter() |
| 119 | .map(|r| (r.id.to_string(), r.to_repository())) |
| 120 | .collect::<HashMap<_, _>>()) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | pub struct SelectRepository { |
nothing calls this directly
no test coverage detected