(expression *expr.Expr, conditionCELAttributes []cel.EnvOption)
| 188 | } |
| 189 | |
| 190 | func validateCELExpr(expression *expr.Expr, conditionCELAttributes []cel.EnvOption) (cel.Program, error) { |
| 191 | if expression == nil || expression.Expression == "" { |
| 192 | return nil, nil |
| 193 | } |
| 194 | e, err := cel.NewEnv( |
| 195 | conditionCELAttributes..., |
| 196 | ) |
| 197 | if err != nil { |
| 198 | return nil, connect.NewError(connect.CodeInternal, err) |
| 199 | } |
| 200 | ast, issues := e.Compile(expression.Expression) |
| 201 | if issues != nil && issues.Err() != nil { |
| 202 | return nil, connect.NewError(connect.CodeInvalidArgument, issues.Err()) |
| 203 | } |
| 204 | prog, err := e.Program(ast) |
| 205 | if err != nil { |
| 206 | return nil, connect.NewError(connect.CodeInvalidArgument, err) |
| 207 | } |
| 208 | return prog, nil |
| 209 | } |
| 210 | |
| 211 | // QueryExportFactors is the factors for query and export. |
| 212 | type QueryExportFactors struct { |
no outgoing calls
no test coverage detected