Selecto.Builder.ValuesClause (Selecto v0.3.15)

SQL generation for VALUES clauses in PostgreSQL queries.

Generates inline table definitions from literal data using the VALUES construct. Supports both list-of-lists and list-of-maps data formats with proper parameter binding and type handling.

Link to this section Summary

Functions

Generate SQL for a VALUES clause.

Generate parameter-bound VALUES clause for use with prepared statements.

Generate a CTE (Common Table Expression) version of the VALUES clause.

Link to this section Functions

Link to this function

build_values_clause(spec)

Generate SQL for a VALUES clause.

Returns SQL in the form:

  • VALUES ('val1', 'val2', 123), ('val3', 'val4', 456) AS alias (col1, col2, col3)
Link to this function

build_values_clause_with_params(spec)

Generate parameter-bound VALUES clause for use with prepared statements.

Returns {sql_iodata, parameters} tuple where parameters is a flat list of values in the order they appear in the SQL.

Link to this function

build_values_cte(spec)

Generate a CTE (Common Table Expression) version of the VALUES clause.

Returns SQL in the form: WITH alias (col1, col2, col3) AS (VALUES ('val1', 'val2', 123), ('val3', 'val4', 456))