(e ast.BinaryExpr)
| 56 | var binaryExpressionExecutors = map[lexer.TokenKind]binaryExpressionExecutorFn{} |
| 57 | |
| 58 | func binaryExprExecutor(e ast.BinaryExpr) (expressionExecutor, error) { |
| 59 | return func(ctx context.Context, options *Options, data *model.Value) (*model.Value, error) { |
| 60 | ctx = WithExecutorID(ctx, "binaryExpr") |
| 61 | if e.Left == nil || e.Right == nil { |
| 62 | return nil, fmt.Errorf("left and right expressions must be provided") |
| 63 | } |
| 64 | |
| 65 | exec, ok := binaryExpressionExecutors[e.Operator.Kind] |
| 66 | if !ok { |
| 67 | return nil, fmt.Errorf("unhandled operator: %s", e.Operator.Value) |
| 68 | } |
| 69 | |
| 70 | return exec(ctx, e, data, options) |
| 71 | }, nil |
| 72 | } |
| 73 | |
| 74 | func init() { |
| 75 | binaryExpressionExecutors[lexer.Plus] = basicBinaryExpressionExecutorFn(func(ctx context.Context, left *model.Value, right *model.Value, _ ast.BinaryExpr) (*model.Value, error) { |
no test coverage detected