mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 17:14:32 +01:00
Cleanup Residue Files
This commit is contained in:
parent
d5007f084b
commit
d52ab8155b
@ -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) }
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package com.shabinder.common.database
|
|
||||||
|
|
||||||
import com.squareup.sqldelight.db.SqlDriver
|
|
||||||
|
|
||||||
@Suppress("FunctionName")
|
|
||||||
expect fun TestDatabaseDriver(): SqlDriver
|
|
@ -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
|
|
||||||
}
|
|
@ -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
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user