Closed pull-vert closed 1 year ago
Hi @pull-vert, it would be great to see an implementation of Reactive SQLite for JVM. Do you have any estimated time when we could see this issue moving forward? :)
Hi @pull-vert, it would be great to see an implementation of Reactive SQLite for JVM. Do you have any estimated time when we could see this issue moving forward? :)
Hi @dzikoysk, for now JVM SqLite is not expected at first. I intend to start with Android and IOS as primary multiplatform targets. Do you now any SqLite reactive Driver for JVM I can use ? I only now blocking drivers.
As SQLite is a database that we use as a bundled local storage, do we really need a truly reactive implementation of this driver? I guess it's something that could be handled through standard IO dispatcher under the hood, at least for now 🤔
As SQLite is a database that we use as a bundled local storage, do we really need a truly reactive implementation of this driver? I guess it's something that could be handled through standard IO dispatcher under the hood, at least for now
Having to develop a full SqLite reactive Driver from scratch does not seem that easy to me ;) I will instead use an an existing blocking SqLite driver for JVM.
I mean that what's I was thinking about - just wrapping standard blocking driver as I think you just cannot do much with the fact there is no available solution to this topic yet :(
Here is a Gradle kts convention file content for all JVM only modules, with JPMS support.
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
id("org.jetbrains.dokka")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(19))
}
}
repositories {
mavenCentral()
}
dependencies {
// import BOM
testImplementation(platform("org.junit:junit-bom:${findProperty("junitVersion")}"))
testImplementation("org.assertj:assertj-core:${findProperty("assertjVersion")}")
testRuntimeOnly("org.slf4j:slf4j-simple:${findProperty("slf4jVersion")}")
}
tasks {
compileKotlin {
kotlinOptions {
jvmTarget = "19"
languageVersion = "1.8"
apiVersion = "1.8"
freeCompilerArgs = listOf("-Xexplicit-api=strict")
// useK2 = true fixme uncomment when it does not throw warning anymore
allWarningsAsErrors = true
}
}
compileJava {
// replace '-' with '.' to match JPMS jigsaw module name
val jpmsName = project.name.replace('-', '.')
// this is needed because we have a separate compile step in this example with th
// 'module-info.java' is in 'main/java' and the Kotlin code is in 'main/kotlin'
options.compilerArgs = listOf(
// "--module-path",
// compileJava.classpath.asPath,
"--patch-module",
"$jpmsName=${sourceSets.main.get().output.asPath}")
}
compileTestKotlin {
kotlinOptions {
allWarningsAsErrors = true
}
}
test {
useJUnitPlatform()
testLogging {
events = setOf(TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED)
showStandardStreams = true
}
}
}
I will also have to add this to the jvm block of dev convention
tasks.withType<Jar> {
// replace '-' with '.' to match JPMS jigsaw module name
val jpmsName = project.name.replace('-', '.')
manifest {
attributes["Automatic-Module-Name"] = jpmsName
}
}
kotysa-core will become a kotlin multiplatform mobile (KMM) project (common for common API + SqLite, jvm for other DBs)
kotysa-sqlite (that depends on kotysa-core) will be a KMM project with
Guide : official KMM sample project and Multiplatform tutorial with Ktor and SqlDelight
[1] : SQLiter is a SQLite driver for Kotlin Multiplatform, currently supporting IOS and Windows, and may later target JVM/Android and all flavors of Native that support the sqlite3 c libraries.