feat: make IsExactly equality more strict and case sensitive
This commit is contained in:
@@ -72,7 +72,7 @@ fn from_condition(
|
|||||||
(_, Condition::Real(_)) => return Err(FailedTo::ComposeFilter),
|
(_, Condition::Real(_)) => return Err(FailedTo::ComposeFilter),
|
||||||
// TEXT
|
// TEXT
|
||||||
(Comparison::IsExactly, Condition::Text(_)) => {
|
(Comparison::IsExactly, Condition::Text(_)) => {
|
||||||
compose_fragment(name, "value_text", "LIKE", i)
|
compose_fragment(name, "value_text", "=", i)
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
Comparison::StartsWith | Comparison::EndsWith | Comparison::Contains,
|
Comparison::StartsWith | Comparison::EndsWith | Comparison::Contains,
|
||||||
|
|||||||
@@ -828,8 +828,8 @@ mod tests {
|
|||||||
let catalog = Catalog::new(db_path);
|
let catalog = Catalog::new(db_path);
|
||||||
let filter = Filter::new().with_text("name", Comparison::IsExactly, "item one");
|
let filter = Filter::new().with_text("name", Comparison::IsExactly, "item one");
|
||||||
assert!(catalog.load_by_filter(&filter).is_ok());
|
assert!(catalog.load_by_filter(&filter).is_ok());
|
||||||
assert_eq!(catalog.len().unwrap(), 1);
|
assert_eq!(catalog.len().unwrap(), 0);
|
||||||
assert!(catalog.contains_key("item-1").unwrap());
|
assert!(catalog.is_empty().unwrap());
|
||||||
// No match
|
// No match
|
||||||
let catalog = Catalog::new(db_path);
|
let catalog = Catalog::new(db_path);
|
||||||
let filter = Filter::new().with_text("name", Comparison::IsExactly, "Item Four");
|
let filter = Filter::new().with_text("name", Comparison::IsExactly, "Item Four");
|
||||||
|
|||||||
Reference in New Issue
Block a user