Improvments on expressions, gw tests
This commit is contained in:
@@ -213,6 +213,11 @@ func (t Array) Has(k string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Push appends value to array
|
||||
func (t *Array) Push(v TypedValue) {
|
||||
t.value = append(t.value, v)
|
||||
}
|
||||
|
||||
// Select is field accessor for *types.Array
|
||||
//
|
||||
// Similar to SelectGVal but returns typed values
|
||||
|
||||
+6
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user