abstract class Table
Base class for Table definitions. A table is defined by making a singleton object that implements this type, with TableColumn members. Columns register themselves with their table, which is the first parameter to their constructor.
Usage example:
object People : Table("People") {
val id = TableColumn(this, "id", "INT AUTO_INCREMENT", Types.sqlInt)
val name = TableColumn(this, "name", "VARCHAR(50) NOT NULL", Types.sqlString)
val worried = TableColumn(this, "worried", "BOOLEAN", Types.sqlBoolean)
override val primaryKeys = listOf(id)
}
<init> |
Base class for Table definitions. A table is defined by making a singleton object that implements this type, with TableColumn members. Columns register themselves with their table, which is the first parameter to their constructor. Table(tableName: String) |
columns |
The columns that make up this table. val columns: List<TableColumn<*>> |
constraintsSql |
A string value put at the end of the CREATE TABLE statement,
typically to define constraints, like foreign keys. For example, the demo
program has a table that overrides this to be
open val constraintsSql: String |
primaryKeys |
The primary key(s) of this table. If specified, the CREATE TABLE will include a PRIMARY KEY section, which has the effect of automatically creating an index. See also InsertStatement.Builder for the variant of insert statements that allows code to get the value of the primary key columns. open val primaryKeys: List<TableColumn<*>> |
tableName |
This table's name. Used for the CREATE TABLE and DROP TABLE statements. val tableName: String |