UpdateData

fun EventSchemaBuilderScope.UpdateData(id: String = randomId(), trigger: EventTrigger, events: EventSchemaBuilderScope.() -> Unit = {}, updates: UpdateDataUpdateBuilderScope.() -> Unit)

Writes values into data sources, on the IO dispatcher. Updates are grouped by data source, and each updates entry (built with update) resolves to a set of key/value entries: incoming data (built with incomingUpdateData) spreads incomingData when it is a map (and contributes nothing when it isn't), inline data (built with inlineUpdateData) writes a literal map, and explicit data (built with explicitUpdateData/explicitIncomingUpdateData/explicitNullUpdateData) writes a single known key taking its value from a literal or from incomingData as-is — the only way to write a value that is itself a map/record intact. Supports the application and screen data holders (plain and segmented) and the plain and segmented local databases; updates targeting navigation data, a tile or an inline source are silently ignored. The in-memory data holders accept null (clearing the entry); the databases don't yet, so entries resolving to null are skipped instead of written. Dispatches onSuccess (no data) when every write completes without error; onFailure (no data, each failure logged), once at the end, when at least one database write failed.

Parameters

id

Unique identifier of this event. Defaults to a random id.

trigger

Trigger that fires this event, built via EventTriggers.

events

Child events chained after this one, wired to its triggers (onSuccess, onFailure).

updates

Data source writes, declared with update.