Selecto.Builder.Pivot (Selecto v0.3.11)
SQL generation logic for Pivot functionality.
This module handles the construction of SQL queries that pivot from the source table to a target table while preserving existing filters through subqueries.
Link to this section Summary
Functions
Build the join chain subquery for connecting source to target.
Extract pivot conditions from existing filters to construct the subquery.
Link to this section Functions
Link to this function
build_join_chain_subquery(selecto, pivot_config, join_path)
@spec build_join_chain_subquery(Selecto.Types.t(), Selecto.Types.pivot_config(), [ atom() ]) :: {Selecto.Types.iodata_with_markers(), Selecto.Types.sql_params()}
Build the join chain subquery for connecting source to target.
Link to this function
build_pivot_query(selecto, opts \\ [])
@spec build_pivot_query( Selecto.Types.t(), keyword() ) :: Selecto.Types.builder_result()
Link to this function
extract_pivot_conditions(selecto, pivot_config, source_alias)
@spec extract_pivot_conditions( Selecto.Types.t(), Selecto.Types.pivot_config(), String.t() ) :: {Selecto.Types.iodata_with_markers(), Selecto.Types.sql_params()}
Extract pivot conditions from existing filters to construct the subquery.