intColumn

protected fun intColumn(name: String): KQLiteColumn<Int?>

Defines a nullable INT column in the table, intended to store an Int.

This function creates and registers a column with the type INTEGER if it is declared as primaryKey otherwise it will register with the type INT. While SQLite's INTEGER type can store up to a 64-bit signed integer (Long), this function maps it to Kotlin's 32-bit Int for convenience when the full range of a Long is not needed. The column is nullable by default.

Example:

object Settings : KQLiteTable("settings") {
// A nullable INT column for a setting's priority
val priority = intColumn("priority_level")

// A non-null column with a default value
val version = intColumn("schema_version").notNull().default(1)
}

Return

A KQLiteColumn instance representing the INT column, which can be further chained with constraints like notNull(), default(), etc.

Author

MOHAMMAD AZIM ANSARI

Parameters

name

The name of the column in the database.

See also