1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-18 23:47:48 +02:00
ferret/pkg/runtime/core/function.go

17 lines
322 B
Go
Raw Normal View History

2018-09-18 22:42:38 +02:00
package core
import (
"context"
"fmt"
)
type Function = func(ctx context.Context, args ...Value) (Value, error)
2018-09-19 03:41:16 +02:00
func ValidateArgs(args []Value, required int) error {
if len(args) != required {
return Error(ErrMissedArgument, fmt.Sprintf("expected %d, but got %d arguments", required, len(args)))
2018-09-18 22:42:38 +02:00
}
return nil
}