primaryKey

protected fun <T> KQLiteColumn<T>.primaryKey(sort: Sort? = null): KQLiteColumn<T>

Designates this column as the PRIMARY KEY for the table.

For tables with a single-column primary key, this is the standard way to define it. For composite primary keys, use the constraints block in the table definition.

Example:

object Users : KQLiteTable("users") {
// 'id' is a auto-incrementing primary key.
val id = longColumn("id").primaryKey().autoIncrement()
}

Return

A new KQLiteColumn instance with a non-nullable type T, marked as the primary key.

Author

MOHAMMAD AZIM ANSARI

Parameters

sort

Optional sort order (ASC or DESC) for the primary key index.

See also