date Column
Defines a nullable DATE column to store a date.
This function creates and registers a column that stores date values in the ISO-8601 format (YYYY-MM-DD). The underlying type is DATE. KQLite handles the conversion between this string representation and the KQLiteDate wrapper class, which provides type safety and convenient date handling. The column is nullable by default.
Example:
object Events : KQLiteTable("events") {
// A nullable DATE column for the event date
val eventDate = dateColumn("event_date")
// A non-null column with a default value of the current date
val createdDate = dateColumn("created_date").notNull().default(CURRENT_DATE)
}
Events.quickInsert {
it.eventDate.bind(DATE("2023-01-01"))
it.createdDate.bind(DATE().now().localtime().days(2))
}Content copied to clipboard
Return
A KQLiteColumn instance representing the date 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.