pub struct Index {
pub name: String,
pub columns: Vec<String>,
pub kind: IndexType,
pub lengths: Vec<(String, i64)>,
pub orders: Vec<(String, String)>,
pub method: String,
pub operator_class: String,
pub collations: Vec<(String, String)>,
pub raw_columns: Vec<String>,
pub algorithm: Option<IndexAlgorithm>,
pub algorithm_args: Vec<Value>,
pub granularity: Option<i64>,
}Expand description
An index of a table: its columns (with per-column lengths, orders and collations), raw expressions, method and operator class, and for ClickHouse data-skipping indexes the algorithm, its arguments and the granularity.
Index::new makes one with defaults; Index::validated runs the
checks PHP’s constructor makes.
PHP: Utopia\Query\Schema\Index.
Fields§
§name: StringThe name.
columns: Vec<String>The columns.
kind: IndexTypeThe kind.
lengths: Vec<(String, i64)>Prefix lengths, by column.
orders: Vec<(String, String)>Orders (ASC / DESC, any case), by column.
method: StringThe method (USING btree), or empty.
operator_class: StringThe operator class applied to every column, or empty.
collations: Vec<(String, String)>Collations, by column.
raw_columns: Vec<String>Raw SQL expressions appended to the column list, unquoted.
algorithm: Option<IndexAlgorithm>The ClickHouse skip-index algorithm, if any.
algorithm_args: Vec<Value>The algorithm’s arguments: strings, integers or floats.
granularity: Option<i64>The ClickHouse granularity, if set.
Implementations§
Source§impl Index
impl Index
Sourcepub fn new(
name: impl Into<String>,
columns: Vec<String>,
kind: IndexType,
) -> Self
pub fn new( name: impl Into<String>, columns: Vec<String>, kind: IndexType, ) -> Self
An index of kind named name over columns, with no other option
(not validated: see Index::validated).
Sourcepub fn validated(self) -> Result<Self>
pub fn validated(self) -> Result<Self>
The index, after PHP’s constructor checks: a ClickHouse index name
is an identifier, there is at least one column or raw expression, the
method, operator class and collations are plain words, the
granularity is at least 1, and minmax / inverted take no
arguments.
PHP: new Index(...), which throws ValidationException.