summaryrefslogtreecommitdiff
path: root/src/dbctx.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-04 19:32:38 -0700
committeriximeow <me@iximeow.net>2023-07-04 19:32:38 -0700
commit543150f1666690351d4698421cc6ceb115c1e251 (patch)
tree97be63ef2d0c28d5f9461279ddf6a842a44c25eb /src/dbctx.rs
parentd3b9a921d25412ffbafb9b9b500620aa500d55ac (diff)
[ci_ctl] command to artificially create new jobs
Diffstat (limited to 'src/dbctx.rs')
-rw-r--r--src/dbctx.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/dbctx.rs b/src/dbctx.rs
index e224310..7378b2e 100644
--- a/src/dbctx.rs
+++ b/src/dbctx.rs
@@ -289,6 +289,20 @@ impl DbCtx {
.map_err(|e| e.to_string())
}
+ pub fn remote_by_path_and_api(&self, api: &str, path: &str) -> Result<Option<Remote>, String> {
+ self.conn.lock()
+ .unwrap()
+ .query_row("select id, repo_id, remote_path, remote_api, remote_url, remote_git_url, notifier_config_path from remotes where remote_api=?1 and remote_path=?2", [api, path], |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 remote_by_id(&self, id: u64) -> Result<Option<Remote>, String> {
self.conn.lock()
.unwrap()