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

Method call

backend/src/psql/repository.rs:58–80  ·  view source on GitHub ↗
(&self, pool: &PgPool)

Source from the content-addressed store, hash-verified

56 }
57
58 pub async fn call(&self, pool: &PgPool) -> Result<Vec<Repository>> {
59 log::debug!("fetching repositories for user {:?}", self.user_id);
60
61 let query = format!(
62 r#"
63 select
64 {REPOSITORY_FIELDS}
65 {REPOSITORY_JOINS}
66 join users_repositories ur on r.id = ur.repository_id
67 where ur.user_id = $1::uuid
68 and r.id = any($2::uuid[])
69 and ur.can_write
70 group by r.id, ur.user_id
71 "#,
72 );
73 let rows = sqlx::query_as::<_, Row>(&query)
74 .bind(&self.user_id)
75 .bind(self.viewer.write_repo_ids.to_vec())
76 .fetch_all(pool)
77 .await?;
78
79 Ok(rows.iter().map(Row::to_repository).collect())
80 }
81}
82
83pub struct RepositoryLoader {

Callers

nothing calls this directly

Calls 5

fetch_userFunction · 0.85
fetch_allMethod · 0.80
to_vecMethod · 0.80
to_repositoryMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected