The VertX way is certainly doable when using Kotli...
# exposed
j
The VertX way is certainly doable when using Kotlin since you can write a User constructor and just map the values back via the constructor:
Copy code
User(fname=it.getString(0), lname=it.getString(1), …)
The RX-Java one I’ll have a look at, maybe VertX is stable enough for use, just feel strange going back a decade and manually mapping results from a database call to an object.
Copy code
16     override fun getUser(id: String): Future<User> =
17         client.queryOne("SELECT ID, FNAME, LNAME FROM USERS WHERE ID=?", listOf(id)) {
18             it.results.map { User(it.getString(0), it.getString(1), it.getString(2)) }.first()
19         }
At startup all you have to do is:
Copy code
1 val client = JDBCClient.createShared(vertx, JsonObject()
2         .put("url", "jdbc:hsqldb:mem:test?shutdown=true")
3         .put("driver_class", "org.hsqldb.jdbcDriver")
4         .put("max_pool_size", 30));
http://maballesteros.com/articles/vertx3-kotlin-rest-jdbc-tutorial/