mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-04 23:59:29 +00:00
ExposedOneToManyKeyValueRepo fixes
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
* `Repos`:
|
* `Repos`:
|
||||||
* `Common`:
|
* `Common`:
|
||||||
* Fixes in `WriteOneToManyRepo#add`
|
* Fixes in `WriteOneToManyRepo#add`
|
||||||
|
* `Exposed`:
|
||||||
|
* Fixes in `ExposedOneToManyKeyValueRepo#add`
|
||||||
|
|
||||||
## 0.5.10
|
## 0.5.10
|
||||||
|
|
||||||
|
@@ -31,6 +31,9 @@ open class ExposedOneToManyKeyValueRepo<Key, Value>(
|
|||||||
transaction(database) {
|
transaction(database) {
|
||||||
toAdd.keys.flatMap { k ->
|
toAdd.keys.flatMap { k ->
|
||||||
toAdd[k] ?.mapNotNull { v ->
|
toAdd[k] ?.mapNotNull { v ->
|
||||||
|
if (select { keyColumn.eq(k).and(valueColumn.eq(v)) }.limit(1).count() > 0) {
|
||||||
|
return@mapNotNull null
|
||||||
|
}
|
||||||
insertIgnore {
|
insertIgnore {
|
||||||
it[keyColumn] = k
|
it[keyColumn] = k
|
||||||
it[valueColumn] = v
|
it[valueColumn] = v
|
||||||
|
Reference in New Issue
Block a user