pub enum ConditionGroup {
Single(Condition),
Compound {
left: Box<ConditionGroup>,
operator: LogicalOperator,
right: Box<ConditionGroup>,
},
Not(Box<ConditionGroup>),
Exists(Box<ConditionGroup>),
Forall(Box<ConditionGroup>),
Accumulate {
result_var: String,
source_pattern: String,
extract_field: String,
source_conditions: Vec<String>,
function: String,
function_arg: String,
},
}Expand description
Group of conditions with logical operators
Variants§
Single(Condition)
A single condition
Compound
A compound condition with two sub-conditions and a logical operator
Fields
left: Box<ConditionGroup>The left side condition
operator: LogicalOperatorThe logical operator (AND, OR)
right: Box<ConditionGroup>The right side condition
Not(Box<ConditionGroup>)
A negated condition group
Exists(Box<ConditionGroup>)
Pattern matching: check if at least one fact matches the condition
Forall(Box<ConditionGroup>)
Pattern matching: check if all facts of the target type match the condition
Accumulate
Accumulate pattern: aggregate values from matching facts Example: accumulate(Order($amount: amount, status == “completed”), sum($amount))
Fields
Implementations§
Source§impl ConditionGroup
impl ConditionGroup
Sourcepub fn and(left: ConditionGroup, right: ConditionGroup) -> Self
pub fn and(left: ConditionGroup, right: ConditionGroup) -> Self
Create a compound condition using logical AND operator
Sourcepub fn or(left: ConditionGroup, right: ConditionGroup) -> Self
pub fn or(left: ConditionGroup, right: ConditionGroup) -> Self
Create a compound condition using logical OR operator
Sourcepub fn not(condition: ConditionGroup) -> Self
pub fn not(condition: ConditionGroup) -> Self
Create a negated condition using logical NOT operator
Sourcepub fn exists(condition: ConditionGroup) -> Self
pub fn exists(condition: ConditionGroup) -> Self
Create an exists condition - checks if at least one fact matches
Sourcepub fn forall(condition: ConditionGroup) -> Self
pub fn forall(condition: ConditionGroup) -> Self
Create a forall condition - checks if all facts of target type match
Sourcepub fn accumulate(
result_var: String,
source_pattern: String,
extract_field: String,
source_conditions: Vec<String>,
function: String,
function_arg: String,
) -> Self
pub fn accumulate( result_var: String, source_pattern: String, extract_field: String, source_conditions: Vec<String>, function: String, function_arg: String, ) -> Self
Create an accumulate condition - aggregates values from matching facts
Sourcepub fn evaluate(&self, facts: &HashMap<String, Value>) -> bool
pub fn evaluate(&self, facts: &HashMap<String, Value>) -> bool
Evaluate this condition group against facts
Sourcepub fn evaluate_with_facts(&self, facts: &Facts) -> bool
pub fn evaluate_with_facts(&self, facts: &Facts) -> bool
Evaluate this condition group against Facts (supports pattern matching)
Trait Implementations§
Source§impl Clone for ConditionGroup
impl Clone for ConditionGroup
Source§fn clone(&self) -> ConditionGroup
fn clone(&self) -> ConditionGroup
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConditionGroup
impl RefUnwindSafe for ConditionGroup
impl Send for ConditionGroup
impl Sync for ConditionGroup
impl Unpin for ConditionGroup
impl UnwindSafe for ConditionGroup
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more