Skip to main content

resolve_params

Function resolve_params 

Source
pub fn resolve_params(
    tpl: &QueryTemplate,
    exchange: &Exchange,
) -> Result<PreparedQuery, CamelError>
Expand description

Resolves parameter values from the exchange and builds the final SQL.

Resolution rules:

  • Named: Look up value in order: (1) body if it’s a JSON object → look for key, (2) exchange input headers, (3) exchange properties. Error if not found anywhere.
  • Positional: Body must be a JSON array → use index. Error if out of bounds.
  • InClause: Resolve same as Named, but value must be a JSON array → expand to multiple $N, $N+1, ... placeholders.

The output SQL uses $1, $2, ... numbered placeholders (sqlx style).

§Arguments

  • tpl - The parsed query template
  • exchange - The exchange containing message body, headers, and properties

§Returns

A PreparedQuery with the final SQL and bindings.