unixEpochColumn

Defines a nullable BIGINT column to store a Unix Epoch timestamp.

This function creates and registers a column that stores date and time values as the number of seconds since 1970-01-01 00:00:00 UTC. The underlying SQLite type is BIGINT. KQLite handles the conversion between this integer representation and the KQLiteUnixEpoch wrapper class, providing type safety and convenient timestamp handling. The column is nullable by default.

Unix Epoch is a common standard for representing timestamps in computer systems.

Example:

object Logs : KQLiteTable("logs") {
// A nullable BIGINT column for an event's Unix timestamp
val eventTimestamp = unixEpochColumn("event_timestamp")

// A non-null column
val createdAt = unixEpochColumn("created_at").notNull()
}

Logs.quickInsert {
it.eventTimestamp.bind(UNIXEPOCH())
it.createdAt.bind(UNIXEPOCH(1761301829).unixepoch())
}

Return

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