//! Should compile. No test functions yet. use modql::filter::{FilterNode, IntoFilterNodes, OpVal, OpValInt64, OpValString, OpValsString}; pub struct ProjectFilter { id: Option>, name: Option>, } impl IntoFilterNodes for ProjectFilter { fn filter_nodes(self, rel: Option) -> Vec { let mut nodes = Vec::new(); if let Some(id) = self.id { let node = FilterNode::new_with_rel( rel.clone(), "id".to_string(), id.into_iter().map(|n| n.into()).collect::>(), ); nodes.push(node) } if let Some(name) = self.name { let node = FilterNode::new_with_rel( rel, "name".to_string(), name.into_iter().map(|n| n.into()).collect::>(), ); nodes.push(node) } nodes } } #[allow(unused)] pub struct TaskFilter { project: Option, title: Option, kind: Option, } impl IntoFilterNodes for TaskFilter { fn filter_nodes(self, rel: Option) -> Vec { let mut nodes = Vec::new(); if let Some(title) = self.title { let node = FilterNode::new_with_rel( rel, "title".to_string(), title.0.into_iter().map(|n| n.into()).collect::>(), ); nodes.push(node) } nodes } }