Cleanup Residue Files

This commit is contained in:
shabinder 2021-01-26 18:25:51 +05:30
parent d5007f084b
commit d52ab8155b
4 changed files with 0 additions and 62 deletions

View File

@ -1,28 +0,0 @@
package com.shabinder.common.database
import com.badoo.reaktive.base.setCancellable
import com.badoo.reaktive.observable.Observable
import com.badoo.reaktive.observable.map
import com.badoo.reaktive.observable.observable
import com.badoo.reaktive.observable.observeOn
import com.badoo.reaktive.scheduler.ioScheduler
import com.squareup.sqldelight.Query
fun <T : Any, R> Query<T>.asObservable(execute: (Query<T>) -> R): Observable<R> =
asObservable()
.observeOn(ioScheduler)
.map(execute)
fun <T : Any> Query<T>.asObservable(): Observable<Query<T>> =
observable { emitter ->
val listener =
object : Query.Listener {
override fun queryResultsChanged() {
emitter.onNext(this@asObservable)
}
}
emitter.onNext(this@asObservable)
addListener(listener)
emitter.setCancellable { removeListener(listener) }
}

View File

@ -1,6 +0,0 @@
package com.shabinder.common.database
import com.squareup.sqldelight.db.SqlDriver
@Suppress("FunctionName")
expect fun TestDatabaseDriver(): SqlDriver

View File

@ -1,13 +0,0 @@
package com.shabinder.common.database
import com.squareup.sqldelight.db.SqlDriver
import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
import com.shabinder.database.TodoDatabase
@Suppress("FunctionName") // FactoryFunction
actual fun TestDatabaseDriver(): SqlDriver {
val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
TodoDatabase.Schema.create(driver)
return driver
}

View File

@ -1,15 +0,0 @@
package com.shabinder.common.database
import com.squareup.sqldelight.db.SqlDriver
import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
import com.shabinder.database.TodoDatabase
import java.io.File
@Suppress("FunctionName") // FactoryFunction
fun TodoDatabaseDriver(): SqlDriver {
val databasePath = File(System.getProperty("java.io.tmpdir"), "ComposeTodoDatabase.db")
val driver = JdbcSqliteDriver(url = "jdbc:sqlite:${databasePath.absolutePath}")
TodoDatabase.Schema.create(driver)
return driver
}