MCPcopy Create free account
hub / github.com/cockscomb/cel2sql / Convert

Function Convert

cel2sql.go:19–31  ·  view source on GitHub ↗

Implementations based on `google/cel-go`'s unparser https://github.com/google/cel-go/blob/master/parser/unparser.go

(ast *cel.Ast)

Source from the content-addressed store, hash-verified

17// https://github.com/google/cel-go/blob/master/parser/unparser.go
18
19func Convert(ast *cel.Ast) (string, error) {
20 checkedExpr, err := cel.AstToCheckedExpr(ast)
21 if err != nil {
22 return "", err
23 }
24 un := &converter{
25 typeMap: checkedExpr.TypeMap,
26 }
27 if err := un.visit(checkedExpr.Expr); err != nil {
28 return "", err
29 }
30 return un.str.String(), nil
31}
32
33type converter struct {
34 str strings.Builder

Callers 1

TestConvertFunction · 0.92

Calls 1

visitMethod · 0.95

Tested by 1

TestConvertFunction · 0.74