wip: remove unused struct

This commit is contained in:
Greg Heartsfield 2022-10-15 16:07:29 -05:00
parent 78f55f3d83
commit 66cca169f1

View File

@ -43,6 +43,7 @@ pub enum Field {
Kind, Kind,
CreatedAt, CreatedAt,
} }
impl FromStr for Field { impl FromStr for Field {
type Err = Error; type Err = Error;
fn from_str(value: &str) -> Result<Self, Self::Err> { fn from_str(value: &str) -> Result<Self, Self::Err> {
@ -80,12 +81,6 @@ impl FromStr for Operator {
} }
} }
//#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
/// Values are the data associated with a restriction. For now, these can only be a single numbers.
//pub enum Value {
// Number(u64),
//}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
pub struct ConditionQuery { pub struct ConditionQuery {
pub(crate) conditions: Vec<Condition>, pub(crate) conditions: Vec<Condition>,
@ -231,7 +226,7 @@ mod tests {
#[test] #[test]
fn parse_multi_conditions() -> Result<()> { fn parse_multi_conditions() -> Result<()> {
// given an empty condition query, produce an empty vector // given an empty condition query, produce an empty vector
let kind_cq = ConditionQuery { let cq = ConditionQuery {
conditions: vec![ conditions: vec![
Condition { Condition {
field: Field::Kind, field: Field::Kind,
@ -257,7 +252,7 @@ mod tests {
}; };
let parsed = let parsed =
"kind>10000&kind<20000&kind!10001&created_at<1665867123".parse::<ConditionQuery>()?; "kind>10000&kind<20000&kind!10001&created_at<1665867123".parse::<ConditionQuery>()?;
assert_eq!(parsed, kind_cq); assert_eq!(parsed, cq);
Ok(()) Ok(())
} }
} }