mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-16 13:48:09 -07:00
Restrict raw database access to the data module
app no longer touches the database directly. Backup restore's queries move into a new RestoreRepository in :data, which restores a batch of entries all or nothing, stopping between entries if cancelled, as before. The remaining direct calls (excluded scanlators, clear database, backup creation, store and category restore) go through their repositories, and the database bindings move from AppBindings into :data.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package mihon.core.common.extensions
|
||||
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
val JsonObjectEmpty = JsonObject(emptyMap())
|
||||
@@ -8,3 +9,7 @@ val JsonObjectEmptyBytes = byteArrayOf(0x7B, 0x7D)
|
||||
|
||||
val JsonObject.Companion.EMPTY: JsonObject
|
||||
inline get() = JsonObjectEmpty
|
||||
|
||||
fun JsonObject.toByteArray(): ByteArray = toString().encodeToByteArray()
|
||||
|
||||
fun ByteArray.toJsonObject(): JsonObject = Json.decodeFromString<JsonObject>(decodeToString())
|
||||
|
||||
Reference in New Issue
Block a user