db.query("select * from messages") { rs, _ - > Message(rs.getString("id"), rs.getString("text")) } fun findMessageById(id: String): List<Message> = db.query("select * from messages where id = ?", id) { rs, _ - > Message(rs.getString("id"), rs.getString("text")) } fun post(message: Message){ db.update("insert into messages values ( ?, ? )", message.id ?: message.text.uuid(), message.text) } } fun findMessageById(id: String): List<Message> = db.query("select * from messages where id = ?", RowMapper { rs, _ -> Message(rs.getString("id"), rs.getString("text")) }, id) RowMapper is a functional interface