diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-09-08 13:29:32 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-09-09 08:35:20 +0200 |
commit | 800ec41fadf58762ec30d864622806087cadc09c (patch) | |
tree | dbc7e93058a45f32b3a8e48fcecbb9dcab39074e /src/commands/db.rs | |
parent | 910af91c2eb5d58b9fdf0317ba086c4ed687d690 (diff) |
Add --image flag to "db submits" command for filtering for a specific image
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Tested-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/commands/db.rs')
-rw-r--r-- | src/commands/db.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/commands/db.rs b/src/commands/db.rs index f3a6721..38f4beb 100644 --- a/src/commands/db.rs +++ b/src/commands/db.rs @@ -341,6 +341,7 @@ fn submits(conn_cfg: DbConnectionConfig<'_>, matches: &ArgMatches) -> Result<()> let query = schema::submits::table .order_by(schema::submits::id.desc()) // required for the --limit implementation .inner_join(schema::githashes::table.on(schema::submits::repo_hash_id.eq(schema::githashes::id))) + .inner_join(schema::images::table) .into_boxed(); let query = if let Some(commithash) = commit.as_ref() { @@ -349,6 +350,12 @@ fn submits(conn_cfg: DbConnectionConfig<'_>, matches: &ArgMatches) -> Result<()> query }; + let query = if let Some(image) = matches.value_of("image") { + query.filter(schema::images::name.eq(image)) + } else { + query + }; + let submits = if let Some(pkgname) = matches.value_of("with_pkg").map(String::from) { // Get all submits which included the package, but were not necessarily made _for_ the package let query = query |