uByteColumn

protected fun uByteColumn(name: String): KQLiteColumn<UByte?>

Defines a nullable TINYINT UNSIGNED column in the table, intended to store an unsigned 8-bit integer (UByte).

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

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

Example:

object StatusFlags : KQLiteTable("status_flags") {
// A nullable TINYINT UNSIGNED column for a status code (0-255)
val statusCode = uByteColumn("status_code")

// A non-null column for a media type identifier
val mediaType = uByteColumn("media_type").notNull().default(0u)
}

Return

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