refactoring: symplify generics

This commit is contained in:
2019-07-15 22:32:41 +02:00
parent e6b8e66b28
commit ea4dac5d97
7 changed files with 45 additions and 71 deletions

View File

@@ -59,14 +59,14 @@ data class Migrations private constructor(
*/
private fun getMigrationFromDB() {
File(this::class.java.getResource("/sql/migration/findAllFunction.sql").toURI()).let {
connection.select<String, List<MigrationEntity?>>(it.readText())
connection.select<List<MigrationEntity>>(it.readText())
.filterNotNull().map { function ->
functions[function.filename] = Function(function.up, function.down, connection, function.executedAt)
}
}
File(this::class.java.getResource("/sql/migration/findAllHistory.sql").toURI()).let {
connection.select<String, List<MigrationEntity?>>(it.readText())
connection.select<List<MigrationEntity>>(it.readText())
.filterNotNull().map { query ->
queries[query.filename] = Query(query.filename, query.up, query.down, connection, query.executedAt)
}