Skip to content

Commit 7e53091

Browse files
committed
[6.0.10][publish] update persistent-container
1 parent b673117 commit 7e53091

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

expansion/expansion-persistent-container/src/main/kotlin/taboolib/expansion/ContainerBuilder.kt

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ open class ContainerBuilder(val name: String) {
2929
key("key")
3030
value("value")
3131
}
32-
3332
dataList.size != 2 -> {
3433
error("Invalid container length")
3534
}

expansion/expansion-persistent-container/src/main/kotlin/taboolib/expansion/ContainerOperator.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ abstract class ContainerOperator {
2626

2727
abstract operator fun set(uniqueId: UUID, map: Map<String, Any?>)
2828

29-
/**
30-
* 统一容器
31-
*/
3229
abstract fun select(where: Where.() -> Unit): Map<String, Any?>
3330

3431
abstract fun select(vararg rows: String, where: Where.() -> Unit): Map<String, Any?>
@@ -37,8 +34,10 @@ abstract class ContainerOperator {
3734

3835
abstract fun selectAll(vararg rows: String, where: Where.() -> Unit): List<Map<String, Any?>>
3936

37+
/** 仅限标准容器 */
4038
abstract fun update(map: Map<String, Any?>, where: Where.() -> Unit)
4139

40+
/** 仅限标准容器 */
4241
abstract fun insert(map: Map<String, Any?>)
4342
}
4443

expansion/expansion-persistent-container/src/main/kotlin/taboolib/expansion/ContainerOperatorFlatten.kt

+11-4
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,26 @@ class ContainerOperatorFlatten(
5353
}
5454

5555
override fun select(where: Where.() -> Unit): Map<String, Any?> {
56-
error("Not supported in flatten container")
56+
return select(key, value) { where() }
5757
}
5858

5959
override fun select(vararg rows: String, where: Where.() -> Unit): Map<String, Any?> {
60-
error("Not supported in flatten container")
60+
return table.select(dataSource) {
61+
rows(*rows)
62+
where(where)
63+
limit(1)
64+
}.firstOrNull { rows.associateWith { getObject(it) } } ?: emptyMap()
6165
}
6266

6367
override fun selectAll(where: Where.() -> Unit): List<Map<String, Any?>> {
64-
error("Not supported in flatten container")
68+
return selectAll(key, value) { where() }
6569
}
6670

6771
override fun selectAll(vararg rows: String, where: Where.() -> Unit): List<Map<String, Any?>> {
68-
error("Not supported in flatten container")
72+
return table.select(dataSource) {
73+
rows(*rows)
74+
where(where)
75+
}.map { rows.associateWith { getObject(it) } }
6976
}
7077

7178
override fun update(map: Map<String, Any?>, where: Where.() -> Unit) {

0 commit comments

Comments
 (0)