commonMain.app.cash.sqldelight.db.QueryResult.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of runtime Show documentation
Show all versions of runtime Show documentation
Multiplatform runtime library to support generated code
The newest version!
package app.cash.sqldelight.db
sealed interface QueryResult {
val value: T get() = throw IllegalStateException(
"""
The driver used with SQLDelight is asynchronous, so SQLDelight should be configured for
asynchronous usage:
sqldelight {
MyDatabase {
generateAsync = true
}
}
""".trimIndent(),
)
suspend fun await(): T
data class Value(override val value: T) : QueryResult {
override suspend fun await() = value
}
class AsyncValue(private inline val getter: suspend () -> T) : QueryResult {
override suspend fun await() = getter()
}
/**
* A [QueryResult] representation of a Kotlin [Unit].
*
* Equivalent to `QueryResult.Value(Unit)`.
*/
object Unit : QueryResult {
override val value: kotlin.Unit = kotlin.Unit
override suspend fun await() {
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy