hyperjumptech / grule-rule-engine

Rule engine implementation in Golang
Other
2.22k stars 346 forks source link

Can we support comparing number sizes using string types #417

Open Fwenjie opened 1 year ago

Fwenjie commented 1 year ago

Can we support comparing number sizes using string types

Fwenjie commented 1 year ago

rule rule_2359427640113137664 "2359427640113137664" salience 4 { when ( Fact.Map["amount"] >= "10" ) then Fact.RuleResult.Append("success"); Fact.Log("hit rule:rule_2359427640113137664"); // remove current rule,else maybe execute repeatedly Retract("rule_2359427640113137664"); }

fact := vo.RuleFact{ Map: map[string]any{ "amount": "9", }, RuleResult: make([]string, 0, 16), }