defmodule ExSQL.AST.CreateIndex do
@moduledoc "A `CREATE [UNIQUE] INDEX [IF NOT EXISTS] name ON table(cols) [WHERE expr]` statement."
defstruct name: nil,
schema: nil,
table: nil,
columns: [],
unique: false,
if_not_exists: false,
where: nil
@type index_column :: %{
name: String.t() | nil,
expr: term() | nil,
direction: :asc | :desc,
collate: String.t() | nil
}
@type t :: %__MODULE__{
name: String.t(),
schema: String.t() | nil,
table: String.t(),
columns: [index_column()],
unique: boolean(),
if_not_exists: boolean(),
where: ExSQL.Parser.expr() | nil
}
end