where

abstract fun where(clause: Clause.() -> Unit): Index

Specifies a WHERE clause for a partial INDEX.

A partial index is an index that covers only a subset of the rows in a table. This can improve performance and reduce storage space if you frequently query a specific subset of the data.

Example:

// Inside KQLiteTable
override val indexes: (IndexBuilder.() -> Unit)? = {
// Creates an index only for active users
createIndex("idx_active_users")
.on(status)
.where { status eq "active" }
}

Return

The Index instance for method chaining.

Author

MOHAMMAD AZIM ANSARI

Parameters

clause

A lambda with a Clause receiver to define the condition for the index.