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

22 lines
442 B
Go
Raw Normal View History

2018-09-18 16:42:38 -04:00
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)
2018-09-18 16:42:38 -04:00
}