glimr/db/gen/parser/params

Parameter Extraction

Functions for extracting SQL parameters ($1, $2, etc.) and mapping them to column names. This module provides the main entry points for parameter extraction.

The parsing logic is split across sub-modules:

Values

pub fn extract(sql: String) -> List(Int)

Extract all parameter numbers ($1, $2, etc.) from SQL query. Returns a sorted, deduplicated list of parameter numbers found anywhere in the query.

pub fn extract_columns(sql: String) -> List(#(Int, String))

Extract parameter-to-column mappings from SQL. Combines mappings from INSERT, UPDATE SET, and WHERE clauses with INSERT/UPDATE taking precedence for duplicate parameters.

Search Document