Selecto.Builder.LateralJoin (Selecto v0.4.5)

Copy Markdown

SQL generation for LATERAL joins.

This module handles the conversion of LATERAL join specifications into proper PostgreSQL LATERAL JOIN SQL syntax.

Summary

Functions

Build a single LATERAL JOIN SQL clause.

Build LATERAL JOIN SQL clauses from specifications.

Integrate LATERAL joins into the main SQL generation pipeline.

Functions

build_lateral_join(spec, opts \\ [])

Build a single LATERAL JOIN SQL clause.

build_lateral_joins(lateral_specs, opts \\ [])

Build LATERAL JOIN SQL clauses from specifications.

Takes a list of LATERAL join specifications and generates the corresponding SQL JOIN clauses with LATERAL keyword and proper correlation handling.

Examples

iex> build_lateral_joins([lateral_spec])
{["LEFT JOIN LATERAL (SELECT ...) AS recent_rentals ON true"], [param1, param2]}

integrate_lateral_joins_sql(base_sql_parts, lateral_specs)

Integrate LATERAL joins into the main SQL generation pipeline.

This function is called by the main SQL builder to include LATERAL JOIN clauses in the generated SQL.