# `Selecto.Advanced.ArrayOperations`

Array operations support for PostgreSQL array functionality.

Provides comprehensive support for array construction, aggregation, manipulation,
testing, and unnesting operations. Works with PostgreSQL native array types
and provides type-safe operations for array columns.

## Examples

    # Array aggregation
    selecto
    |> Selecto.select([
        "category.name",
        {:array_agg, "film.title", as: "films"},
        {:array_length, {:array_agg, "film.film_id"}, 1, as: "film_count"}
      ])
    |> Selecto.group_by(["category.category_id", "category.name"])
    
    # Array filtering
    selecto
    |> Selecto.filter([
        {:array_contains, "film.special_features", ["Trailers"]},
        {:array_overlap, "film.special_features", ["Deleted Scenes", "Behind the Scenes"]}
      ])
    
    # Array unnesting
    selecto
    |> Selecto.select(["film.title", "feature"])
    |> Selecto.unnest("film.special_features", as: "feature")

# `create_array_filter`

Create an array containment/testing operation for filters.

## Examples

    # Array contains
    create_array_filter(:array_contains, "tags", ["featured", "new"])
    
    # Array overlap
    create_array_filter(:array_overlap, "categories", ["electronics", "computers"])

# `create_array_operation`

Create an array aggregation operation specification.

## Examples

    # Simple array aggregation
    create_array_operation(:array_agg, "film.title", as: "film_titles")
    
    # Array aggregation with DISTINCT
    create_array_operation(:array_agg, "actor.name", distinct: true, as: "unique_actors")
    
    # Array aggregation with ORDER BY
    create_array_operation(:array_agg, "film.title", 
      order_by: [{"film.release_year", :desc}], 
      as: "films_by_year")

# `create_array_size`

Create an array length/dimension operation.

## Examples

    # Get array length at dimension 1
    create_array_size(:array_length, "tags", 1, as: "tag_count")
    
    # Get array cardinality (total number of elements)
    create_array_size(:cardinality, "matrix", as: "total_elements")

# `create_unnest`

Create an unnest operation for array expansion.

## Examples

    # Unnest array column
    create_unnest("special_features", as: "feature")
    
    # Unnest with ordinality
    create_unnest("tags", with_ordinality: true, as: "tag")

# `is_aggregate?`

Check if an operation is an aggregation function.

# `is_filter?`

Check if an operation is a filter/WHERE clause operation.

# `is_unnest?`

Check if an operation is an unnest operation.

# `to_sql`

Generate SQL for an array operation.

# `validate_array_operation!`

Validate an array operation specification.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
