我使用 slick-3.0.0 并尝试使用streaming。
假设有AccountsTable
和PreferencesTable
:
我想从中获取一些信息PreferencesTable
并将其用于流中AccountsTable
。例如(参见 TODO):
val somePrefQuery: Query[Rep[String], ...] = PreferencesTable.filter(...)
val somePrefAction = somePrefQuery.result
val somePrefStream = db.stream(somePrefAction)
val accountsStream: DatabasePublisher[String] =
db.stream(AccountsTable.map(_.id).result)
accountsStream.mapResult { accountId: String =>
//TODO how to get somePref value from
// somePrefQuery or somePrefAction or somePrefStream
// Is there best approach for such task?
val somePref: String = ???
val result:(String, String) = (accountId, somePref)
result
}