Selecto.Subfilter.SQL.InBuilder (Selecto v0.3.8)
Builds IN subqueries for subfilters.
This strategy is useful when you need to filter the main query based on a set of IDs returned by the subquery. It can be more performant than EXISTS in some cases, especially when the subquery returns a small number of rows.
example-sql
Example SQL
film_id IN (
SELECT fc.film_id
FROM film_category fc
JOIN category c ON fc.category_id = c.category_id
WHERE c.name IN ('Action', 'Comedy')
)
Link to this section Summary
Functions
Generate IN subquery SQL for a given subfilter.
Link to this section Functions
Link to this function
generate(spec, join_resolution, registry)
@spec generate( Selecto.Subfilter.Spec.t(), Selecto.Subfilter.JoinPathResolver.JoinResolution.t(), any() ) :: {:ok, String.t(), [any()]} | {:error, Selecto.Subfilter.Error.t()}
Generate IN subquery SQL for a given subfilter.