feat: add error handling during filter composition and new filter conditions for text matching
This commit is contained in:
@@ -24,6 +24,7 @@ pub fn run(filter: &Filter) -> Result<String, FailedTo> {
|
|||||||
(Comparison::Equal, Condition::Bool(_)) => {
|
(Comparison::Equal, Condition::Bool(_)) => {
|
||||||
compose_fragment(name, "value_bool", "=", i + 1)
|
compose_fragment(name, "value_bool", "=", i + 1)
|
||||||
}
|
}
|
||||||
|
(_, Condition::Bool(_)) => return Err(FailedTo::ComposeFilter),
|
||||||
// SIGNED INT
|
// SIGNED INT
|
||||||
(Comparison::Equal, Condition::SignedInt(_)) => {
|
(Comparison::Equal, Condition::SignedInt(_)) => {
|
||||||
compose_fragment(name, "value_int", "=", i + 1)
|
compose_fragment(name, "value_int", "=", i + 1)
|
||||||
|
|||||||
@@ -5,4 +5,8 @@ pub enum E {
|
|||||||
GreaterOrEqual,
|
GreaterOrEqual,
|
||||||
Lesser,
|
Lesser,
|
||||||
LesserOrEqual,
|
LesserOrEqual,
|
||||||
|
IsExactly,
|
||||||
|
StartsWith,
|
||||||
|
EndsWith,
|
||||||
|
Contains,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ use crate::*;
|
|||||||
/// Represents the possible failures that can occur in the library.
|
/// Represents the possible failures that can occur in the library.
|
||||||
#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Hash)]
|
#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Hash)]
|
||||||
pub enum FailedTo {
|
pub enum FailedTo {
|
||||||
|
/// Failed to compose filter statement
|
||||||
|
ComposeFilter,
|
||||||
/// Failed to convert from Entity to type.
|
/// Failed to convert from Entity to type.
|
||||||
ConvertEntity,
|
ConvertEntity,
|
||||||
/// Failed to convert from type to Entity.
|
/// Failed to convert from type to Entity.
|
||||||
|
|||||||
Reference in New Issue
Block a user