RxRoom

class RxRoom


Helper class to add RxJava3 support to Room.

Summary

Constants

const Any

Data dispatched by the publisher created by createFlowable.

Public functions

java-static Flowable<Any!>
createFlowable(database: RoomDatabase, tableNames: Array<String!>)

Creates a Flowable that emits at least once and also re-emits whenever one of the observed tables is updated.

java-static Observable<Any!>
createObservable(database: RoomDatabase, tableNames: Array<String!>)

Creates a Observable that emits at least once and also re-emits whenever one of the observed tables is updated.

Constants

NOTHING

Added in 2.3.0
const val NOTHINGAny

Data dispatched by the publisher created by createFlowable.

Public functions

createFlowable

java-static fun createFlowable(database: RoomDatabase, tableNames: Array<String!>): Flowable<Any!>

Creates a Flowable that emits at least once and also re-emits whenever one of the observed tables is updated.

You can easily chain a database operation to downstream of this Flowable to ensure that it re-runs when database is modified.

Since database invalidation is batched, multiple changes in the database may results in just 1 emission.

Parameters
database: RoomDatabase

The database instance

tableNames: Array<String!>

The list of table names that should be observed

Returns
Flowable<Any!>

A Flowable which emits NOTHING when one of the observed tables is modified (also once when the invalidation tracker connection is established).

createObservable

java-static fun createObservable(database: RoomDatabase, tableNames: Array<String!>): Observable<Any!>

Creates a Observable that emits at least once and also re-emits whenever one of the observed tables is updated.

You can easily chain a database operation to downstream of this Observable to ensure that it re-runs when database is modified.

Since database invalidation is batched, multiple changes in the database may results in just 1 emission.

Parameters
database: RoomDatabase

The database instance

tableNames: Array<String!>

The list of table names that should be observed

Returns
Observable<Any!>

A Observable which emits NOTHING when one of the observed tables is modified (also once when the invalidation tracker connection is established).