get

abstract operator fun <T> get(column: KQLiteColumn<T>): T

Returns the value of the requested column from the current row in a type-safe manner.

  • This operator allows for convenient, array-like access to column data using a KQLiteColumn instance. The return type T is inferred from the column definition, ensuring type safety at compile time.

  • For nullable columns, the return type T will be nullable (e.g., String?). For columns defined as notNull() or as a primaryKey(), the return type will be non-nullable (e.g., String, Int).

Example

// Assuming 'Employee' table object with 'id' (PK) and 'name' (nullable) columns
cursor.forEach {
val id: Int = it[Employee.id] // Non-nullable Int
val name: String? = it[Employee.name] // Nullable String
}

Return

The value of the column as type T.

Author

MOHAMMAD AZIM ANSARI

Parameters

column

The KQLiteColumn representing the column whose value is requested.

Type Parameters

T

The expected data type of the column.

Throws

if the column is not found or NULL value found for non-nullable column.