1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-12-01 22:19:32 +02:00
Files
ferret/pkg/runtime/core/expression.go
Tim Voronov 8f2957e6ca Feature/optimized member expression (#653)
* Added new member path resolution logic

* Updated Getter and Setter interfaces

* Added ssupport of pre-compiled static member path

* Improved error handling
2021-09-08 21:01:22 -04:00

22 lines
442 B
Go

package core
import "context"
type (
Expression interface {
Exec(ctx context.Context, scope *Scope) (Value, error)
}
ExpressionFn struct {
fn func(ctx context.Context, scope *Scope) (Value, error)
}
)
func NewExpressionFn(fn func(ctx context.Context, scope *Scope) (Value, error)) Expression {
return &ExpressionFn{fn}
}
func (f *ExpressionFn) Exec(ctx context.Context, scope *Scope) (Value, error) {
return f.fn(ctx, scope)
}