From 8974d6bac7120d81e5b96d6dabe75ca6e1d9f313 Mon Sep 17 00:00:00 2001 From: Tony HB Date: Fri, 27 Jun 2025 13:41:34 -0700 Subject: [PATCH 1/2] Remove comments --- expr.go | 1 - 1 file changed, 1 deletion(-) diff --git a/expr.go b/expr.go index 63f16fa..3619d6d 100644 --- a/expr.go +++ b/expr.go @@ -639,7 +639,6 @@ func engineType(p Predicate) EngineType { if p.Operator == operators.NotEquals || p.Operator == operators.In { return EngineTypeNone } - // return EngineTypeNone return EngineTypeBTree case string: if len(v) == 0 { From 4f62e517b0b042910baa6b72dbabb4a15416e80c Mon Sep 17 00:00:00 2001 From: Tony HB Date: Mon, 28 Jul 2025 10:54:53 -0700 Subject: [PATCH 2/2] Always use non-nil lifted resp --- caching_compiler.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/caching_compiler.go b/caching_compiler.go index 4220721..01ab592 100644 --- a/caching_compiler.go +++ b/caching_compiler.go @@ -8,9 +8,7 @@ import ( "github.com/karlseguin/ccache/v2" ) -var ( - CacheTime = time.Hour -) +var CacheTime = time.Hour // NewCachingCompiler returns a CELCompiler which lifts quoted literals out of the expression // as variables and uses caching to cache expression parsing, resulting in improved @@ -39,6 +37,10 @@ func (c *cachingCompiler) Parse(expr string) (*cel.Ast, *cel.Issues, LiftedArgs) } expr, vars := liftLiterals(expr) + if vars == nil { + // enusre this is never non-nil. + vars = regularArgMap{} + } if cached := c.cache.Get("cc:" + expr); cached != nil { cached.Extend(CacheTime)