Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions rust/perspective-vieux/src/rust/config/view_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ pub enum FilterOp {
#[serde(rename = "in")]
In,

#[serde(rename = "not in")]
NotIn,

#[serde(rename = "begins with")]
BeginsWith,

Expand Down Expand Up @@ -106,9 +109,17 @@ pub enum SortDir {
ColAscAbs,
}

#[derive(Clone, Deserialize, Debug, PartialEq, Serialize)]
#[serde(untagged)]
pub enum FilterTerm {
Scalar(Scalar),
Array(Vec<Scalar>),
}

#[derive(Clone, Deserialize, Debug, PartialEq, Serialize)]
#[serde()]
pub struct Filter(String, FilterOp, Scalar);
pub struct Filter(String, FilterOp, FilterTerm);


#[derive(Clone, Deserialize, Debug, PartialEq, Serialize)]
#[serde()]
Expand Down Expand Up @@ -379,7 +390,7 @@ mod tests {
vec!(Filter(
"Test".to_owned(),
FilterOp::Contains,
Scalar::String("aaa".to_owned())
FilterTerm::Scalar(Scalar::String("aaa".to_owned()))
))
);
}
Expand All @@ -396,7 +407,7 @@ mod tests {
vec!(Filter(
"Test".to_owned(),
FilterOp::LT,
Scalar::Float(4_f64)
FilterTerm::Scalar(Scalar::Float(4_f64))
))
);
}
Expand Down