MCPcopy Create free account
hub / github.com/cel-expr/cel-go / ExprToString

Function ExprToString

cel/io.go:151–157  ·  view source on GitHub ↗

ExprToString converts an AST Expr node back to a string using macro call tracking metadata from source info if any macros are encountered within the expression.

(e ast.Expr, info *ast.SourceInfo, opts ...ASTFormatOption)

Source from the content-addressed store, hash-verified

149// ExprToString converts an AST Expr node back to a string using macro call tracking metadata from
150// source info if any macros are encountered within the expression.
151func ExprToString(e ast.Expr, info *ast.SourceInfo, opts ...ASTFormatOption) (string, error) {
152 unparserOpts := make([]parser.UnparserOption, len(opts))
153 for i, opt := range opts {
154 unparserOpts[i] = opt()
155 }
156 return parser.Unparse(e, info, unparserOpts...)
157}
158
159// RefValueToValue converts between ref.Val and google.api.expr.v1alpha1.Value.
160// The result Value is the serialized proto form. The ref.Val must not be error or unknown.

Callers 3

VisitExprMethod · 0.92
AstToStringFunction · 0.85
TestExprToStringFunction · 0.85

Calls 1

UnparseFunction · 0.92

Tested by 2

VisitExprMethod · 0.74
TestExprToStringFunction · 0.68