Add pkg/expr for unified expression handling

This commit is contained in:
Denis Arh
2020-11-30 20:31:02 +01:00
parent c19b5392c9
commit 61469330f3
2 changed files with 9 additions and 6 deletions
+2 -6
View File
@@ -3,8 +3,8 @@ package values
import (
"context"
"fmt"
"github.com/PaesslerAG/gval"
"github.com/cortezaproject/corteza-server/compose/types"
"github.com/cortezaproject/corteza-server/pkg/expr"
)
func makeInvalidExprErr(field *types.ModuleField, expr string, err error) types.RecordValueError {
@@ -30,15 +30,11 @@ func makeValueExprIncompErr(field *types.ModuleField) types.RecordValueError {
}
}
func parser() gval.Language {
return gval.Full()
}
// Expression evaluates expression in ModuleField.Expressions.Value and
// assigns results to the record on that field
func Expression(ctx context.Context, m *types.Module, r *types.Record, old *types.Record, rve *types.RecordValueErrorSet) {
var (
exprParser = parser()
exprParser = expr.Parser()
scope = make(map[string]interface{})
+7
View File
@@ -0,0 +1,7 @@
package expr
import "github.com/PaesslerAG/gval"
func Parser() gval.Language {
return gval.Full()
}