-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cced85
commit 0143d4d
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
libs/cti/src/breaches/application/find_one/find_breach_query.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use std::any::Any; | ||
|
||
use cqrs::domain::query::Query; | ||
|
||
pub struct FindBreachQuery { | ||
pub cve_id: Option<String>, | ||
pub vendor: Option<String>, | ||
pub product: Option<String>, | ||
pub version: Option<String>, | ||
} | ||
|
||
impl FindBreachQuery { | ||
pub const QUERY_TYPE: &'static str = "FindBreachQuery"; | ||
|
||
pub fn new(cve_id: Option<String>, vendor: Option<String>, product: Option<String>, version: Option<String>) -> FindBreachQuery { | ||
FindBreachQuery { cve_id, vendor, product, version } | ||
} | ||
|
||
pub fn new_boxed(cve_id: Option<String>, vendor: Option<String>, product: Option<String>, version: Option<String>) -> Box<dyn Query> { | ||
Box::new(FindBreachQuery::new(cve_id, vendor, product, version)) | ||
} | ||
} | ||
|
||
impl Query for FindBreachQuery { | ||
fn get_type(&self) -> String { | ||
FindBreachQuery::QUERY_TYPE.to_string() | ||
} | ||
|
||
fn as_any(&self) -> &dyn Any { | ||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod find_breach_query; |