Jdbi: Map kotlin.Pair

Created on 16 May 2018  路  5Comments  路  Source: jdbi/jdbi

It looks like Pair doesn't work with JDBI, it would be great if we could support it via rs.getObject(Int)

feature help wanted

All 5 comments

Do you mean you want to map rows into Pair<A, B> for arbitrary mappable A and B? I think we could reasonably support that (although not through rs.getObject(int), as it is defined in the JDK and we have no control over it).

We already do something similar with Map.Entry<K,V>. See http://jdbi.org/#_map_entry_mapping

We also support mapping to Vavr Tuple2.

@qualidafial, yes as a RowMapper. I thought that KotlinMapper should support that but it seems to support only data class.

FYI: there probably won't be progress on this unless you or somebody else submits a PR. None of the project members (that I'm aware of) code in Kotlin, and we rather have our hands full just keeping up with the volume of PRs since 3.0 was released.

have our hands full just keeping up with the volume of PRs

sorry :p

@buremba : As a quick workaround, you could use the Map.Entry mapper mentioned above and do .map { it.toPair() } (the toPair extension method is added to the Map.Entry class via Kotlin's stdlib).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keith-miller picture keith-miller  路  3Comments

Shujito picture Shujito  路  5Comments

dhardtke picture dhardtke  路  3Comments

agavrilov76 picture agavrilov76  路  5Comments

Romqa picture Romqa  路  5Comments