viralshah
04/05/2020, 3:05 PMprivate val myRowMapper = BiFunction<Row, RowMetadata, Person> { row, _ ->
Person(
row["Id", Integer::class.java]!!.toInt(), row["NAME", String::class.java]!!,
row["StudentId", Integer::class.java]!!.toInt(),
row["GroupId", Integer::class.java]?.toInt(), row["startDate", Instant::class.java]!!,
row["endDate", Instant::class.java], row["authId", Integer::class.java]!!.toInt(),
row["statusId", Integer::class.java]?.toInt(),
row["IS_TEST", Boolean::class.java]!!,
row["DELETED", Boolean::class.java]
)
}
databaseClient.execute(myQuery).bind("Id" to "12345").map(myRowMapper).flow().toList()
data class Person(
val id: Int,
val name: String,
val studentId: Int,
val groupId: Int?,
startDate: Instant,
endDate: Instant?,
authId: Int,
statusId: Int,
isTest: Boolean,
deleted: Boolean?)
Am I doing this correctly. It seems like I have to do an awful lot of conversions just to get a simple data type like Int / Booleanmarstran
04/05/2020, 3:08 PMviralshah
04/05/2020, 3:09 PMmarstran
04/05/2020, 3:09 PMviralshah
04/05/2020, 3:10 PMmarstran
04/05/2020, 3:12 PMmarstran
04/05/2020, 3:13 PMDavid Eriksson
04/06/2020, 2:34 PMmarstran
04/06/2020, 4:04 PM