uIntColumn

protected fun uIntColumn(name: String): KQLiteColumn<UInt?>

Defines a nullable INT UNSIGNED column in the table, intended to store an unsigned 32-bit integer (UInt).

This function creates and registers a column with the type INT UNSIGNED. While SQLite does not have a native unsigned integer type, this function maps the database value to Kotlin's UInt for type safety and to represent values up to UInt.MAX_VALUE. The column is nullable by default.

Important: UInt values are stored as Long to prevent overflow. So, this is safe to use without overflow issues.

Example:

object Configs : KQLiteTable("configs") {
// A nullable INT UNSIGNED column for an unsigned configuration ID
val configId = uIntColumn("config_id")

// A non-null column for a revision number, which is always positive
val revision = uIntColumn("revision_number").notNull().default(0u)
}

Return

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