timeColumn

protected fun timeColumn(name: String): KQLiteColumn<KQLiteTime?>

Defines a nullable TIME column to store a time.

This function creates and registers a column that stores time values in the ISO-8601 format (HH:MM:SS or HH:MM:SS.SSS). The underlying type is TIME. KQLite handles the conversion between this string representation and the KQLiteTime wrapper class, which provides type safety and convenient time handling. The column is nullable by default.

Example:

object Appointments : KQLiteTable("appointments") {
// A nullable TIME column for the appointment time
val appointmentTime = timeColumn("appointment_time")

// A non-null column with a default value of the current time
val entryTime = timeColumn("entry_time").notNull().default(CURRENT_TIME)
}

Appointments.quickInsert {
it.appointmentTime.bind(TIME("10:00:00"))
it.entryTime.bind(TIME().now().localtime().minutes(5))
}

Return

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