Table
Base class of Ktorm's table objects. This class extends from BaseTable, additionally providing a binding mechanism with Entity interfaces based on functions such as bindTo, references.
Table implements the doCreateEntity function from the parent class. The function automatically creates an entity object using the binding configuration specified by bindTo and references, reading columns’ values from the result set and filling them into corresponding entity properties.
To use this class, we need to define our entities as interfaces extending from Entity. Here is an example. More documents can be found at https://www.ktorm.org/en/entities-and-column-binding.html
interface Department : Entity<Department> {
val id: Int
var name: String
var location: String
}
object Departments : Table<Department>("t_department") {
val id = int("id").primaryKey().bindTo { it.id }
val name = varchar("name").bindTo { it.name }
val location = varchar("location").bindTo { it.location }
}
Constructors
Properties
Functions
Convert this table to a TableExpression.
Create an entity object from the specific row of query results. This function uses the binding configurations of the table, filling column values into corresponding properties of the returned entity.
Define a column typed of LocalDateTimeSqlType.
Define a column typed of DecimalSqlType.
Define a column typed of TimestampSqlType.