StorIOSQLite has interesting method observeChangesInTable(). And When I saw it I thought that it would observe changes in given table and return list of updated items.
But it just returns updated table name. Why would I need an updated table name? I can just subscribe to hole table to be notified about an update
storIoSqLite.get()
.listOfObjects(Item.class)
.withQuery(
Query.builder()
.table(ItemTable.NAME)
.build()
)
.prepare()
.asRxObservable()
Please explain what is the point of observeChangesInTable() method. And what is the best solution for my problem.
With your approach you're actually doing a
query
to the db and only then reacting to the change.With
StorIOSQLite.observeChangesInTable()
you can react on changes in the table without doing anyqueries
to the db. This is much much cheaper and should be used in situations when you need to do adebounce()
orwindow()
,filter()
etc and only then make actualquery
to the db.Hope that helps!