Exposed objects

The Messages object provides the mapping between the object and the database and it represents the structure of the table. It is required by the Exposed library:

    /**      * Message table structure       */    object Messages : Table() {      val id = integer("id").autoIncrement().primaryKey()      val content = text("content")      val location = point("location").nullable()    }

The following is a diagram of the Message class and the Messages object required for the Exposed library:

We have specified our Messages object for Exposed in the Database.kt file. It is recommended to specify all your Exposed objects in a single Kotlin file for easier maintenance.  ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.