Extension functions

The common and utility functions are grouped in a file named Extension.kt (you can specify any name you want). It contains top-level functions that can be used anywhere in the project.

Complete the Extension.kt file:

    /**     * Builds the insert query for the specified message     */     fun insertQuery(m: Message): Messages.(UpdateBuilder<*>) -> Unit =       {      if (m.id != null) it[id] = m.id      it[content] = m.content      it[location] = m.location    }    /**     * Create the message object from Result row     * @return message     */     fun ResultRow.getMessage() =      Message(this[Messages.content], this[Messages.location],         this[Messages.id])    // Other extension functions

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.