From b2af098139179594462fd219d930438e09316c2e Mon Sep 17 00:00:00 2001 From: Kamal Nasser Date: Mon, 28 Apr 2025 19:16:09 +0300 Subject: [PATCH] matches op: match against numbers --- nodes.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nodes.go b/nodes.go index edcf611..39f3045 100644 --- a/nodes.go +++ b/nodes.go @@ -3,6 +3,7 @@ package rulekit import ( "fmt" "regexp" + "strconv" "github.com/qpoint-io/rulekit/set" ) @@ -178,6 +179,18 @@ func (n *nodeMatch) apply(lv any, rv any) bool { return true } } + case int: + return r.MatchString(strconv.Itoa(val)) + case int64: + return r.MatchString(strconv.FormatInt(val, 10)) + case uint: + return r.MatchString(strconv.FormatUint(uint64(val), 10)) + case uint64: + return r.MatchString(strconv.FormatUint(val, 10)) + case float32: + return r.MatchString(strconv.FormatFloat(float64(val), 'f', -1, 32)) + case float64: + return r.MatchString(strconv.FormatFloat(val, 'f', -1, 64)) } return false }