float Column
Defines a nullable FLOAT column in the table, intended to store a Float.
This function creates and registers a column with the type FLOAT. While SQLite's REAL type stores an 8-byte floating-point number (equivalent to a Double), this function maps it to Kotlin's 4-byte Float for convenience when the full precision of a Double is not required, potentially saving memory in the application layer. The column is nullable by default.
Example:
object Sensors : KQLiteTable("sensors") {
// A nullable FLOAT column for a temperature reading
val temperature = floatColumn("temperature")
// A non-null column for humidity percentage with a default value
val humidity = floatColumn("humidity").notNull().default(0.0f)
}Content copied to clipboard
Return
A KQLiteColumn instance representing the FLOAT 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.