Index

interface Index

Represents a database INDEX created using IndexBuilder.

An index is a special lookup table that the database search engine can use to speed up data retrieval. Simply put, an index is a pointer to data in a table. An index in a database is very similar to an index in the back of a book.

This interface is used within the indexes block of a com.kqlite.table.KQLiteTable to define one or more indexes for that table. It provides a DSL for specifying the columns to be indexed and an optional WHERE clause for creating partial indexes.

Use IndexBuilder.createIndex or IndexBuilder.createUniqueIndex to create an instance.

Example:

 // Inside KQLiteTable
override val indexes: (IndexBuilder.() -> Unit)? = {
createIndex("idx_name").on(name)
createUniqueIndex("idx_email_phone").on(email, phone)
}

Author

MOHAMMAD AZIM ANSARI

See also

Functions

Link copied to clipboard
abstract fun on(vararg column: KQLiteColumn<*>): Index

Represents the ON clause of the INDEX in a com.kqlite.table.KQLiteTable.

Link copied to clipboard
abstract fun where(clause: Clause.() -> Unit): Index

Specifies a WHERE clause for a partial INDEX.