JustBash.Commands.Jq.Evaluator (JustBash v0.4.0)

View Source

Evaluator for jq AST expressions.

Takes a parsed jq AST and input data, returns the transformed output. Complex functionality is delegated to submodules:

  • Evaluator.Functions - Built-in function implementations
  • Evaluator.Format - Output formatting (@csv, @json, etc.)

Summary

Functions

Evaluate a generator expression, collecting results one-by-one. Stops after n results are collected (or collects all if n == :all). Errors after enough results are collected are suppressed. Returns {:ok, results} if enough results were collected, or {:error, reason, partial_results} if an error occurred before collecting n results.

Evaluate a jq AST against input data.

Functions

eval_generator_take(expr, data, opts, n \\ :all)

Evaluate a generator expression, collecting results one-by-one. Stops after n results are collected (or collects all if n == :all). Errors after enough results are collected are suppressed. Returns {:ok, results} if enough results were collected, or {:error, reason, partial_results} if an error occurred before collecting n results.

evaluate(ast, data, opts)

@spec evaluate(JustBash.Commands.Jq.Parser.ast(), any(), map()) ::
  {:ok, [any()]} | {:error, String.t()}

Evaluate a jq AST against input data.

Returns {:ok, results} where results is a list of values, or {:error, message} on failure.