https://kotlinlang.org logo
#exposed
Title
# exposed
j

jeggy

11/09/2018, 6:09 PM
I'm trying to create a auto batch inserter. I have a map of
<T: Any> Map<Column<out T?>, T>
. My only problem is, how can I convert the
out T?
into
T?
?
This is how it looks now:
Copy code
fun <T: Any> List<Map<Column<out T?>, T>>.bulkInsert(table: Table) = transaction {
    table.batchInsert(this@bulkInsert) { values ->
        values.keys.forEach {
            this[it] = values[it]
        }
    }
}
image.png
t

tapac

11/10/2018, 9:23 AM
Why you want to use T here? Just replace you declaration with
Copy code
fun  List<Map<Column<Any?>, Any>>.bulkInsert(table: Table)
2 Views