IndexBuilder

class IndexBuilder(indexes: MutableList<Index>)

A DSL builder for creating INDEX and UNIQUE INDEX constraints on a table.

This builder is provided as the receiver in the indexes block of a KQLiteTable definition, allowing you to define one or more indexes for that table.

Example

override val indexes: (IndexBuilder.() -> Unit)? = {
// Creates a standard index on the 'name' column
createIndex("idx_person_name").on(name)

// Creates a unique composite index on 'email' and 'phone'
createUniqueIndex("uidx_person_email_phone").on(email, phone)

// Creates a partial index for active users
createIndex("idx_active_users")
.on(status)
.where { status eq "active" }
}

Author

MOHAMMAD AZIM ANSARI

Parameters

indexes

A mutable list used internally to collect the created Index definitions.

See also

Constructors

Link copied to clipboard
constructor(indexes: MutableList<Index>)

Functions

Link copied to clipboard

Creates a standard (non-unique) INDEX.

Link copied to clipboard

Creates a UNIQUE INDEX.