Struct representing a secondary index definition on a ScyllaDB table.
Used by the DSL, migration generator, and filter validator to introspect index configurations programmatically.
Fields
:columns— List of column names (atoms) to index:name— Optional custom index name override:options— Additional index options
Summary
Functions
Generates the default index name for a given table and column.
Returns the effective index name — custom name if set, otherwise the default.
Parses a secondary index DSL input into a %SecondaryIndex{} struct.
Types
Functions
Generates the default index name for a given table and column.
Examples
iex> AshScylla.DataLayer.SecondaryIndex.default_name("users", :email)
"idx_users_email"
Returns the effective index name — custom name if set, otherwise the default.
Parses a secondary index DSL input into a %SecondaryIndex{} struct.
Accepts three call signatures:
- A single atom:
:email - A list of atoms:
[:name, :age] - A tuple with options:
{:email, name: "idx_email"}
Examples
iex> AshScylla.DataLayer.SecondaryIndex.parse(:email)
%AshScylla.DataLayer.SecondaryIndex{columns: [:email], name: nil, options: []}
iex> AshScylla.DataLayer.SecondaryIndex.parse([:name, :age])
%AshScylla.DataLayer.SecondaryIndex{columns: [:name, :age], name: nil, options: []}
iex> AshScylla.DataLayer.SecondaryIndex.parse({:email, name: "idx_email"})
%AshScylla.DataLayer.SecondaryIndex{columns: [:email], name: "idx_email", options: [name: "idx_email"]}