KQLiteColumn

sealed class KQLiteColumn<T>(name: String, type: KQLiteType)

Represents a column in a KQLite database table (KQLiteTable).

This sealed class is the base for all specific column types (e.g., KQLiteTable.longColumn, KQLiteTable.textColumn). It encapsulates the properties of a database column, such as its name, data type, and constraints. Instances of this class are typically created within a KQLiteTable definition.

This class and its subclasses use a fluent API to define column constraints like KQLiteTable.primaryKey, KQLiteTable.unique, etc.

Author

MOHAMMAD AZIM ANSARI

Parameters

name

The name of the column as defined by the user stored in columnName. This name will be escaped to ensure it is a valid SQL identifier.

type

Underlying data type of the column.

Type Parameters

T

The Kotlin type that this column will hold (e.g., Int, String?, ByteArray).

See also

Inheritors

Constructors

Link copied to clipboard
protected constructor(name: String, type: KQLiteType)

Properties

Link copied to clipboard

The escaped name of the column, safe for use in SQL statements.

Functions

Link copied to clipboard
infix fun <T> KQLiteColumn<T>.AS(alias: String): KQLiteColumn<T>

Creates an alias for a column using SQL AS.

Link copied to clipboard

Applies the auto modifier, allowing SQLite to automatically convert between date/time text representations and Julian day numbers as needed.

Link copied to clipboard

Applies ceiling modifier to a date/time value.

Link copied to clipboard

Concatenates this column with another column. This is an infix version of the CONCAT function, corresponding to the SQLite || operator.

infix fun KQLiteColumn<*>.CONCAT(literal: String): KQLiteColumn<String>

Concatenates two or more strings or columns together. This function corresponds to the SQLite CONCAT or || operator.

Link copied to clipboard

Applies NNN days modifier to a date/time value.

Link copied to clipboard
operator fun <T> KQLiteColumn<T>.div(literal: T): KQLiteColumn<T>

Represents the SQL / (division) operator between a column and a literal value.

operator fun <T> KQLiteColumn<T>.div(column: KQLiteColumn<out T>): KQLiteColumn<T>

Represents the SQL / (division) operator between two columns.

Link copied to clipboard

Applies floor modifier to a date/time value.

Link copied to clipboard

Applies NNN hours modifier to a date/time value.

Link copied to clipboard

Applies julianday modifier to a date/time value.

Link copied to clipboard

Applies the localtime modifier to a date/time value, converting it from UTC to the local time zone.

Link copied to clipboard
operator fun <T> KQLiteColumn<T>.minus(literal: T): KQLiteColumn<T>

Represents the SQL - (subtraction) operator between a column and a literal value.

operator fun <T> KQLiteColumn<T>.minus(column: KQLiteColumn<out T>): KQLiteColumn<T>

Represents the SQL - (subtraction) operator between two columns.

Link copied to clipboard

Applies -YYYY-MM-DD modifier to a date/time value.

Link copied to clipboard

Applies NNN minutes modifier to a date/time value.

Link copied to clipboard

Applies NNN months modifier to a date/time value.

Link copied to clipboard

Adds a NOT NULL constraint to the column.

Link copied to clipboard

Applies the now modifier to a date/time function, representing the current UTC date and time. For local time, use localtime.

Link copied to clipboard
operator fun <T> KQLiteColumn<T>.plus(literal: T): KQLiteColumn<T>

Represents the SQL + (addition) operator between a column and a literal value.

operator fun <T> KQLiteColumn<T>.plus(column: KQLiteColumn<out T>): KQLiteColumn<T>

Represents the SQL + (addition) operator between two columns.

Link copied to clipboard

Applies +YYYY-MM-DD modifier to a date/time value.

Link copied to clipboard
operator fun <T> KQLiteColumn<T>.rem(literal: T): KQLiteColumn<T>

Represents the SQL % (modulo) operator between a column and a literal value.

operator fun <T> KQLiteColumn<T>.rem(column: KQLiteColumn<out T>): KQLiteColumn<T>

Represents the SQL % (modulo) operator between two columns.

Link copied to clipboard

Applies NNN seconds modifier to a date/time value.

Link copied to clipboard

Applies start of day modifier to a date/time value.

Link copied to clipboard

Applies start of month modifier to a date/time value.

Link copied to clipboard

Applies start of year modifier to a date/time value.

Link copied to clipboard

Applies the subsec modifier to a date/time value, enabling fractional second precision.

Link copied to clipboard

Applies the subsecond modifier to a date/time value, enabling fractional second precision.

Link copied to clipboard
operator fun <T> KQLiteColumn<T>.times(literal: T): KQLiteColumn<T>

Represents the SQL * (multiplication) operator between a column and a literal value.

operator fun <T> KQLiteColumn<T>.times(column: KQLiteColumn<out T>): KQLiteColumn<T>

Represents the SQL * (multiplication) operator between two columns.

Link copied to clipboard
open override fun toString(): String

Returns a string representation of the column.

Link copied to clipboard

Applies unixepoch modifier to a date/time value.

Link copied to clipboard

Applies the utc modifier to a date/time value, interpreting it as Coordinated Universal Time (UTC).

Link copied to clipboard

Applies weekday N modifier to a date/time value.

Link copied to clipboard

Applies NNN years modifier to a date/time value.