mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-14 21:09:24 +00:00
fixes in ExposedOneToManyKeyValueRepo and includeWebsocketHandling
This commit is contained in:
@@ -35,10 +35,15 @@ open class ExposedOneToManyKeyValueRepo<Key, Value>(
|
||||
if (select { keyColumn.eq(k).and(valueColumn.eq(v)) }.limit(1).count() > 0) {
|
||||
return@mapNotNull null
|
||||
}
|
||||
insertIgnore {
|
||||
val insertResult = insert {
|
||||
it[keyColumn] = k
|
||||
it[valueColumn] = v
|
||||
}.getOrNull(keyColumn) ?.let { k to v }
|
||||
}
|
||||
if (insertResult.insertedCount > 0) {
|
||||
k to v
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} ?: emptyList()
|
||||
}
|
||||
}.forEach { _onNewValue.emit(it) }
|
||||
|
Reference in New Issue
Block a user