repl
packagemoduleThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package repl defines a set of utilities for working with command line processing of CEL.
Index¶
- func ParseType(t string) (*exprpb.Type, error)
- func UnparseType(t *exprpb.Type) string
- type Cmder
- type EvaluationContext
- type Evaluator
- func (e *Evaluator) AddDeclFn(name string, params []letFunctionParam, typeHint *exprpb.Type) error
- func (e *Evaluator) AddDeclVar(name string, typeHint *exprpb.Type) error
- func (e *Evaluator) AddLetFn(name string, params []letFunctionParam, resultType *exprpb.Type, expr string) error
- func (e *Evaluator) AddLetVar(name string, expr string, typeHint *exprpb.Type) error
- func (e *Evaluator) AddOption(opt Optioner) error
- func (e *Evaluator) Compile(expr string) (*cel.Ast, error)
- func (e *Evaluator) DelLetFn(name string) error
- func (e *Evaluator) DelLetVar(name string) error
- func (e *Evaluator) EnablePartialEval() error
- func (e *Evaluator) Evaluate(expr string) (ref.Val, *exprpb.Type, error)
- func (e *Evaluator) Parse(expr string) (*cel.Ast, error)
- func (e *Evaluator) Process(cmd Cmder) (string, bool, error)
- func (e *Evaluator) Status() string
- type Optioner
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcUnparseType¶
UnparseType pretty-prints a type for the REPL.
Types¶
typeCmder¶
type Cmder interface {// Cmd returns the normalized name for the command.Cmd()string}Cmder interface provides normalized command name from a repl command.Command specifics are available via checked type casting to the specificcommand type.
typeEvaluationContext¶
type EvaluationContext struct {// contains filtered or unexported fields}EvaluationContext context for the repl.Handles maintaining state for multiple let expressions.
typeEvaluator¶
type Evaluator struct {// contains filtered or unexported fields}Evaluator provides basic environment for evaluating an expression withapplied context.
func (*Evaluator)AddDeclFn¶
AddDeclFn declares a function in the environment but doesn't register an expr with it.This allows planning to succeed, but with no value for the function at runtime.
func (*Evaluator)AddDeclVar¶
AddDeclVar declares a variable in the environment but doesn't register an expr with it.This allows planning to succeed, but with no value for the variable at runtime.
func (*Evaluator)AddLetFn¶
func (e *Evaluator) AddLetFn(namestring, params []letFunctionParam, resultType *exprpb.Type, exprstring)error
AddLetFn adds a let function to the evaluation context.
func (*Evaluator)AddLetVar¶
AddLetVar adds a let variable to the evaluation context.The expression is planned but evaluated lazily.
func (*Evaluator)AddOption¶
AddOption adds an option to the basic environment.Options are applied before evaluating any of the let statements.Returns an error if setting the option prevents planning any of the defined let expressions.
func (*Evaluator)DelLetFn¶
DelLetFn removes a function from the evaluation context.If deleting the function breaks a later expression, this function will return an error without modifying the context.
func (*Evaluator)DelLetVar¶
DelLetVar removes a variable from the evaluation context.If deleting the variable breaks a later expression, this function will return an error without modifying the context.
func (*Evaluator)EnablePartialEval¶
EnablePartialEval enables the option to allow partial evaluations.
Directories¶
| Path | Synopsis |
|---|---|
appenginemodule | |
cel-repl> %let x = 42 cel-repl> %let y = {'a': x, 'b': y} Adding let failed: Error updating y = {'a': x, 'b': y} ERROR: <input>:1:15: undeclared reference to 'y' (in container ”) | cel-repl> %let x = 42 cel-repl> %let y = {'a': x, 'b': y} Adding let failed: Error updating y = {'a': x, 'b': y} ERROR: <input>:1:15: undeclared reference to 'y' (in container ”) |