short Column
Defines a nullable SMALLINT column in the table, intended to store a Short.
This function creates and registers a column with the type SMALLINT. While SQLite's INTEGER type can store up to a 64-bit signed integer, this function maps it to Kotlin's 16-bit Short for cases where a smaller integer range is sufficient, potentially saving memory in the application layer. The column is nullable by default.
Example:
object ProductVariants : KQLiteTable("product_variants") {
// A nullable SMALLINT column for a variant type identifier
val variantType = shortColumn("variant_type")
// A non-null column for stock count, which is unlikely to exceed Short.MAX_VALUE
val stockCount = shortColumn("stock_count").notNull().default(0)
}Content copied to clipboard
Return
A KQLiteColumn instance representing the SMALLINT 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.