package eu.kanade.data import androidx.paging.PagingSource import com.squareup.sqldelight.Query import com.squareup.sqldelight.Transacter import eu.kanade.tachiyomi.Database import kotlinx.coroutines.flow.Flow interface DatabaseHandler { suspend fun await(inTransaction: Boolean = false, block: suspend Database.() -> T): T suspend fun awaitList( inTransaction: Boolean = false, block: suspend Database.() -> Query ): List suspend fun awaitOne( inTransaction: Boolean = false, block: suspend Database.() -> Query ): T suspend fun awaitOneOrNull( inTransaction: Boolean = false, block: suspend Database.() -> Query ): T? fun subscribeToList(block: Database.() -> Query): Flow> fun subscribeToOne(block: Database.() -> Query): Flow fun subscribeToOneOrNull(block: Database.() -> Query): Flow fun subscribeToPagingSource( countQuery: Database.() -> Query, transacter: Database.() -> Transacter, queryProvider: Database.(Long, Long) -> Query ): PagingSource }