booleanColumn

protected fun booleanColumn(name: String): KQLiteColumn<Boolean?>

Defines a nullable BOOLEAN column in the table, intended to store a Boolean.

This function creates and registers a column with the type BOOLEAN. SQLite does not have a dedicated BOOLEAN type and uses 0 for false and 1 for true. Conversion between the integer/text representation and Boolean in handled by the underlying driver. The column is nullable by default.

Example:

object Settings : KQLiteTable("settings") {
// A nullable BOOLEAN column for a boolean flag
val isEnabled = booleanColumn("is_enabled")

// A non-null column with a default value of true (1)
val autoSync = booleanColumn("auto_sync").notNull().default(true)
}

Return

A KQLiteColumn instance representing the BOOLEAN 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