diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/database.rs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/database.rs b/src/database.rs index 4c14f2e..83a27b3 100644 --- a/src/database.rs +++ b/src/database.rs @@ -77,23 +77,21 @@ impl Db { pub async fn repo_insert( &mut self, - repos: &[GithubRepo], + repo: Repo, ) -> Result<(), Box<dyn std::error::Error>> { let mut tx = self.connection.begin().await?; - for repo in repos { - sqlx::query(r#" - INSERT INTO repositories - (id, name, updated_at) - VALUES - (?, ?, ?) - "#) - .bind(repo.id) - .bind(&repo.name) - .bind(&repo.updated_at) - .execute(&mut tx) - .await?; - } + sqlx::query(r#" + INSERT INTO repositories + (id, name, updated_at) + VALUES + (?, ?, ?) + "#) + .bind(repo.id) + .bind(&repo.name) + .bind(&repo.updated_at) + .execute(&mut tx) + .await?; tx.commit().await?; @@ -105,7 +103,7 @@ impl Db { Ok(false) } - pub fn repo_update(repo: &GithubRepo) -> Result<(), Box<dyn std::error::Error>> { + pub fn repo_update(repo: &Repo) -> Result<(), Box<dyn std::error::Error>> { Ok(()) } } |