Skip to main content

eval_function

Function eval_function 

Source
pub fn eval_function(name: &str, args: &[Value]) -> Result<Value, EvalError>
Expand description

Evaluate a scalar function call.

A NULL argument gives Ok(Value::Null) (SQL NULL propagation). These calls fail instead:

  • mod’s zero-modulus arm (math::try_eval) returns Err(EvalError::DivisionByZero);
  • a vector distance over operands of different dimensions or over a non-vector operand (vector::try_eval);
  • a document function given a malformed JSONPath (json::try_eval);
  • a name no family module implements returns Err(EvalError::UnknownFunction), never a silent NULL.

The fallible families (math, vector, json) return Option<Result<Value, EvalError>>. The rest stay Option<Value>-shaped and are wrapped in Ok at this dispatch boundary.