Thread
#exposed
    i

    Ivan

    1 year ago
    Hi, there is any way to create kotrin coroutine flow from exposed query?
    i

    Ivan

    1 year ago
    Hi @Bogdan, i know coroutines feature of exposed; But I meant how to create a flow using these features. I think I did it in this way:
    suspend fun Query.asFlowOnDb(
        database: Database,
        transactionIsolation: Int? = null
    ): Flow<ResultRow> {
        val q = this
        return channelFlow {
            val f = this
            newSuspendedTransaction (db = database,  transactionIsolation = transactionIsolation) {
                q.forEach { el -> f.send(el) }
            }
        }
    }
    @tapac Do u think there is another way to create flow with exposed or this method is ok?