diff options
author | iximeow <me@iximeow.net> | 2023-06-24 20:22:21 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2023-06-24 20:22:21 -0700 |
commit | 916965ab13d4c9273089162a04d730f3061c6d18 (patch) | |
tree | 806f2c5dfaa9698402dee8b76c953ba4e4e39776 /src/dbctx.rs | |
parent | 7b08cb229de7b0c131bc8c7e3405ad548ff5e0eb (diff) |
and now the index page is useful
Diffstat (limited to 'src/dbctx.rs')
-rw-r--r-- | src/dbctx.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/dbctx.rs b/src/dbctx.rs index 476c3fc..c9454fc 100644 --- a/src/dbctx.rs +++ b/src/dbctx.rs @@ -221,6 +221,20 @@ impl DbCtx { .map_err(|e| e.to_string()) } + pub fn remote_by_id(&self, id: u64) -> Result<Option<Remote>, String> { + self.conn.lock() + .unwrap() + .query_row("select * from remotes where id=?1", [id], |row| { + let (id, repo_id, remote_path, remote_api, remote_url, remote_git_url, notifier_config_path) = row.try_into().unwrap(); + + Ok(Remote { + id, repo_id, remote_path, remote_api, remote_url, remote_git_url, notifier_config_path + }) + }) + .optional() + .map_err(|e| e.to_string()) + } + pub fn repo_id_by_remote(&self, remote_id: u64) -> Result<Option<u64>, String> { self.conn.lock() .unwrap() |