ExposedOneToManyKeyValueRepo fixes

This commit is contained in:
InsanusMokrassar 2021-06-16 13:22:40 +06:00
parent 261d8827e3
commit 96e97d1691
2 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,8 @@
* `Repos`:
* `Common`:
* Fixes in `WriteOneToManyRepo#add`
* `Exposed`:
* Fixes in `ExposedOneToManyKeyValueRepo#add`
## 0.5.10

View File

@ -31,6 +31,9 @@ open class ExposedOneToManyKeyValueRepo<Key, Value>(
transaction(database) {
toAdd.keys.flatMap { k ->
toAdd[k] ?.mapNotNull { v ->
if (select { keyColumn.eq(k).and(valueColumn.eq(v)) }.limit(1).count() > 0) {
return@mapNotNull null
}
insertIgnore {
it[keyColumn] = k
it[valueColumn] = v