mithril_aggregator/database/query/immutable_file_digest/
delete_immutable_file_digest.rs
1use mithril_persistence::sqlite::{Query, WhereCondition};
2
3use crate::database::record::ImmutableFileDigestRecord;
4
5pub struct DeleteImmutableFileDigestQuery {
7 condition: WhereCondition,
8}
9
10impl DeleteImmutableFileDigestQuery {
11 pub fn all() -> Self {
12 Self {
13 condition: WhereCondition::default(),
14 }
15 }
16}
17
18impl Query for DeleteImmutableFileDigestQuery {
19 type Entity = ImmutableFileDigestRecord;
20
21 fn filters(&self) -> WhereCondition {
22 self.condition.clone()
23 }
24
25 fn get_definition(&self, condition: &str) -> String {
26 let projection = Self::Entity::expand_projection("immutable_file_digest");
27
28 format!("delete from immutable_file_digest where {condition} returning {projection}")
29 }
30}