1use std::path::{Path, PathBuf};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum MetadataFilter {
6 HasKey(String),
8 KeyValue { key: String, value: String },
10}
11
12#[derive(Debug, Clone, Default, PartialEq, Eq)]
16pub struct BondQuery {
17 pub source: Option<PathBuf>,
18 pub target: Option<PathBuf>,
19 pub metadata: Option<MetadataFilter>,
20}
21
22impl BondQuery {
23 pub fn new() -> Self {
25 Self::default()
26 }
27
28 pub fn with_source<P: AsRef<Path>>(mut self, source: P) -> Self {
30 self.source = Some(source.as_ref().to_path_buf());
31 self
32 }
33
34 pub fn with_target<P: AsRef<Path>>(mut self, target: P) -> Self {
36 self.target = Some(target.as_ref().to_path_buf());
37 self
38 }
39
40 pub fn with_metadata_key(mut self, key: impl Into<String>) -> Self {
42 self.metadata = Some(MetadataFilter::HasKey(key.into()));
43 self
44 }
45
46 pub fn with_metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
48 self.metadata = Some(MetadataFilter::KeyValue {
49 key: key.into(),
50 value: value.into(),
51 });
52 self
53 }
54}