1use std::path::{Path, PathBuf};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
7pub enum MetadataFilter {
8 HasKey(String),
10 KeyValue { key: String, value: String },
12}
13
14#[derive(Debug, Clone, Default, PartialEq, Eq)]
20pub struct BondQuery {
21 pub source: Option<PathBuf>,
22 pub target: Option<PathBuf>,
23 pub metadata: Option<MetadataFilter>,
24}
25
26impl BondQuery {
27 pub fn new() -> Self {
29 Self::default()
30 }
31
32 pub fn with_source<P: AsRef<Path>>(mut self, source: P) -> Self {
34 self.source = Some(source.as_ref().to_path_buf());
35 self
36 }
37
38 pub fn with_target<P: AsRef<Path>>(mut self, target: P) -> Self {
40 self.target = Some(target.as_ref().to_path_buf());
41 self
42 }
43
44 pub fn with_metadata_key(mut self, key: impl Into<String>) -> Self {
46 self.metadata = Some(MetadataFilter::HasKey(key.into()));
47 self
48 }
49
50 pub fn with_metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
52 self.metadata = Some(MetadataFilter::KeyValue {
53 key: key.into(),
54 value: value.into(),
55 });
56 self
57 }
58}