onChange

abstract fun onChange(tables: Set<String>, throttleMs: Long = DEFAULT_THROTTLE.inWholeMilliseconds, triggerImmediately: Boolean = true): Flow<Set<String>>

Returns a Flow that emits whenever the source tables are modified.

Return

A Flow emitting the set of modified tables.

Parameters

tables

The set of tables to monitor for changes.

throttleMs

The minimum interval, in milliseconds, between emissions. Defaults to DEFAULT_THROTTLE. Table changes are accumulated while throttling is active. The accumulated set of tables will be emitted on the trailing edge of the throttle.

triggerImmediately

If true (default), the flow will immediately emit an empty set of tables when the flow is first collected. This can be useful for ensuring that the flow emits at least once, even if no changes occur to the monitored tables.

Throws

If a database error occurs.

If the operation is cancelled.