This commit is contained in:
Azalea
2025-01-05 02:13:55 -05:00
parent 96fb815bd8
commit 56e424c29b
13 changed files with 31 additions and 24 deletions

View File

@@ -62,7 +62,7 @@ abstract class MeowApi(val serialize: (String, Any?) -> String) {
}
else pageCache[cacheKey] = millis() to list
(mapOf("userId" to uid, "length" to lst.size, "nextIndex" to iAfter, key to lst) + add).toMutableMap()
(mapOf("userId" to uid, "length" to lst.size, "nextIndex" to iAfter, key to lst) + add).mut
.also { p.post?.invoke(it) }
}
fun String.paged(key: String, fn: PagedHandler) = pagedWithKind(key) { PagedProcessor(null, fn) }

View File

@@ -1,11 +1,12 @@
package icu.samnyan.aqua.sega.general
import ext.ls
import jakarta.persistence.AttributeConverter
import jakarta.persistence.Converter
@Converter
class IntegerListConverter : AttributeConverter<List<Int>, String> {
override fun convertToDatabaseColumn(lst: List<Int>?) = lst?.joinToString(";") ?: ""
override fun convertToEntityAttribute(str: String?) = if (str.isNullOrBlank()) mutableListOf() else
str.split(';').map { it.toInt() }.toMutableList()
override fun convertToEntityAttribute(str: String?) = if (str.isNullOrBlank()) ls() else
str.split(';').map { it.toInt() }
}