postgresChangeFlow

inline fun <T : PostgresAction> RealtimeChannel.postgresChangeFlow(schema: String, noinline filter: PostgresChangeFilter.() -> Unit = {}): Flow<T>(source)

Listen for postgres changes in a channel.

Example:

val productChangeFlow = channel.postgrestChangeFlow<PostgresAction.Update>("public") {
table = "products"
}.map { it.decodeRecord<Product>() }

If you just want to check for changes and also retrieve initial values, you can use the postgresListDataFlow or postgresSingleDataFlow functions.

Parameters

T

The event type you want to listen to (e.g. PostgresAction.Update for updates or only PostgresAction for all)

schema

The schema name of the table that is being monitored. For normal supabase tables that might be "public".