我拿不到
vararg
一起工作
JdbcTemplate.query(String!, RowMapper<T!>!, vararg Any!)
. 如果我不讨论变量参数,它似乎有效。例如:
fun translates(field: String) = template.query("SELECT key, value FROM table", {
rs: ResultSet, _: Int -> Pair(rs.getString("key"), rs.getString("value"))
})
或者这个工程:
fun translates(field: String) = template.query("SELECT key, value FROM table") {
rs: ResultSet, _: Int -> Pair(rs.getString("key"), rs.getString("value"))
}
但是这个
工作(我补充道
, field
query(String!, RowMapper<T!>!, vararg Any!)
):
fun translates(field: String) = template.query("SELECT key, value FROM table WHERE field = ?", {
rs: ResultSet, _: Int -> Pair(rs.getString("key"), rs.getString("value"))
}, field)
query(String!, RowMapper<T!>!, vararg Any!)
where T cannot be inferred for
  fun <T : Any!> query(sql: String!, rowMapper: RowMapper<T!>!, vararg args: Any!): (Mutable)List<T!>!