Skip to main content

Module user_params

Module user_params 

Source
Expand description

User-supplied positional parameter binding for $N placeholders.

Tracer-bullet half of issue #353. The parser emits Expr::Parameter nodes when it sees $N; this module validates that the indices form a contiguous 0-based range and substitutes the user-provided values into the AST. Type validation is delegated to the existing engine type checker, which runs on the substituted literals downstream.

Structs§

ParameterRef
One parameter placeholder found in the parsed query AST.

Enums§

UserParamError
Errors surfaced when binding fails. The wire layer turns these into QUERY_ERROR / INVALID_PARAMS responses.

Functions§

bind
One-shot helper: validate arity/gaps then substitute the values.
bind_parameters
One-shot helper matching the parameter-contract ADR wording.
collect_indices
Walk expr, collect every Expr::Parameter { index } encountered. Also picks up parameter slots that live outside the Expr tree — today only the vector slot of SEARCH SIMILAR $N (see #355).
expr_contains_parameter
Recursively check whether expr contains any Expr::Parameter node. Used by the INSERT parser to know when to defer literal folding to the user_params binder.
scan_parameters
Walk expr, collecting parameter placeholders that carry source spans.
validate
Validate that the indices used by the SQL match the caller’s supplied params (contiguous from 0, length match).

Type Aliases§

BindError
Public bind error alias matching the parameter-contract ADR wording.