Skip to main content

lib/ex_sql/ast/with.ex

defmodule ExSQL.AST.With do
  @moduledoc "A `WITH [RECURSIVE] cte_name [(cols)] AS (query) [, ...] <select>` statement."

  defstruct recursive: false, ctes: [], query: nil

  @typedoc "A single CTE definition."
  @type cte_def :: %{name: String.t(), columns: [String.t()] | nil, query: term()}

  @type t :: %__MODULE__{
          recursive: boolean(),
          ctes: [cte_def()],
          query: term()
        }
end