Skip to main content

Module eval

Module eval 

Source
Expand description

Shared expression evaluation logic for Code Mode.

This module provides core evaluation functions that are used by both synchronous (PlanExecutor) and asynchronous (AsyncScope) executors. By centralizing this logic, we avoid duplication and ensure consistent behavior across execution modes.

§Design

The evaluation functions are generic over a VariableProvider trait, allowing them to work with different variable storage mechanisms:

// Sync executor uses HashMap directly
let value = evaluate_expr(&expr, &sync_vars, &local_scope)?;

// Async executor uses the same functions
let value = evaluate_expr(&expr, &async_vars, &local_scope)?;

Enums§

JsonStringMode
Controls how non-primitive JSON values are rendered to string.

Traits§

VariableProvider
Trait for providing variable values during evaluation.

Functions§

evaluate
Evaluate an expression with just a variable map (no local scope). This is a convenience wrapper for the common case.
evaluate_array_method_with_scope
Evaluate an array method with scope.
evaluate_binary_op
Evaluate a binary operation.
evaluate_number_method
Evaluate a number method.
evaluate_unary_op
Evaluate a unary operation.
evaluate_with_binding
Evaluate an expression with an extra variable binding. Creates a merged scope with the new binding and evaluates.
evaluate_with_scope
Evaluate a ValueExpr with access to global and local variables.
evaluate_with_two_bindings
Evaluate an expression with two extra variable bindings. Used for reduce operations with accumulator and item variables.
is_nullish
Check if a JSON value is nullish (null or undefined).
is_truthy
Check if a JSON value is truthy (JavaScript semantics).
json_to_string
Convert JSON value to string (JavaScript-compatible mode).
json_to_string_with_mode
Convert JSON value to string with configurable object rendering.
to_number
Convert a JSON value to a number (JavaScript semantics).