https://kotlinlang.org logo
Title
u

ursus

10/22/2021, 6:59 PM
Any sqldelight users? I have api which returns 
data1
data2
data3
 types. They're not related. For reasons I need to normalize this into 3 tables, and cannot be kept as json together. But now, how should I query all three reactively together, in a way that the listener emits only once, same way join changes do? I could do
combine(
   data1Query.asFlow().mapOneOrNull(), 
   data2Query.asFlow().mapOneOrNull(),
   data3Query.asFlow().mapOneOrNull()
)
etc, but as I said, all 3 get updated together in a transaction. Which means there would be bunch on unwanted emits for 
combine
 when update happens I know I could 
debounce
 it, but feels wrong. Is there a way library could handle this, same way it does for joins? Or is debouncing this a standard solution?
g

gildor

10/24/2021, 2:59 PM
It looks that you just need one more request, which comines data on level of sq file, instead doing 3 requests and combine them on level of code