mirror of
https://github.com/MontFerret/ferret.git
synced 2025-06-21 00:19:35 +02:00
.github
assets
cli
e2e
examples
pkg
compiler
drivers
parser
runtime
collections
core
expressions
clauses
literals
operators
block.go
block_test.go
body.go
body_test.go
condition.go
data_source.go
data_source_test.go
for.go
func_call.go
func_call_test.go
member.go
param.go
param_test.go
return.go
return_test.go
variable.go
logging
values
options.go
program.go
program_test.go
stdlib
.codecov.yml
.editorconfig
.env
.gitignore
.golangci.yml
.goreleaser.yml
.travis.yml
CHANGELOG.md
LICENSE
Makefile
README.md
go.mod
go.sum
install.sh
main.go
revive.toml
31 lines
664 B
Go
31 lines
664 B
Go
package expressions
|
|
|
|
import (
|
|
"context"
|
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
"github.com/MontFerret/ferret/pkg/runtime/values"
|
|
)
|
|
|
|
type ParameterExpression struct {
|
|
src core.SourceMap
|
|
name string
|
|
}
|
|
|
|
func NewParameterExpression(src core.SourceMap, name string) (*ParameterExpression, error) {
|
|
if name == "" {
|
|
return nil, core.Error(core.ErrMissedArgument, "name")
|
|
}
|
|
|
|
return &ParameterExpression{src, name}, nil
|
|
}
|
|
|
|
func (e *ParameterExpression) Exec(ctx context.Context, _ *core.Scope) (core.Value, error) {
|
|
param, err := core.ParamFrom(ctx, e.name)
|
|
|
|
if err != nil {
|
|
return values.None, core.SourceError(e.src, err)
|
|
}
|
|
|
|
return param, nil
|
|
}
|