Improvments on expressions, gw tests

This commit is contained in:
Denis Arh
2021-03-30 14:58:04 +02:00
parent 723c361171
commit 597c18fd16
8 changed files with 319 additions and 161 deletions
+6 -2
View File
@@ -3,7 +3,6 @@ package expr
import (
"context"
"fmt"
"github.com/PaesslerAG/gval"
)
@@ -71,7 +70,12 @@ func (e *gvalEval) Eval(ctx context.Context, scope *Vars) (interface{}, error) {
}
func (e *gvalEval) Test(ctx context.Context, scope *Vars) (bool, error) {
return e.evaluable.EvalBool(ctx, scope.Dict())
r, err := e.evaluable(ctx, scope.Dict())
if err != nil {
return false, err
}
return !isEmpty(r), nil
}
func Parser(ll ...gval.Language) gval.Language {