Companion

object Companion

Provides some usual transaction functions for the DatasyncNode.runTransaction method.

Functions

increment
Link copied to clipboard
fun increment(step: Int = 1, start: Int = 0): (DatasyncValue) -> TransactionOperation.Set

Transaction function that atomically increments the value of a data node by a given step or sets the initial start value if the data node had no value.

toggle
Link copied to clipboard
fun toggle(defaultValue: Boolean = false): (DatasyncValue) -> TransactionOperation

Transaction function that atomically toggles the value of a boolean data node.

inline fun <T : Any> toggle(ping: T, pong: T): (DatasyncValue) -> TransactionOperation

Transaction function that atomically toggles the value of a data node between 2 values ping and pong.

writeIfNone
Link copied to clipboard
fun writeIfNone(value: Any?): (DatasyncValue) -> TransactionOperation

Transaction function that atomically sets a given value to a data node only if it had no value.

Properties

decrement
Link copied to clipboard
val decrement: (DatasyncValue) -> TransactionOperation.Set

Transaction function that atomically decrements the value of a data node or sets its initial value to 0 if it had no value.

increment
Link copied to clipboard
val increment: (DatasyncValue) -> TransactionOperation.Set

Transaction function that atomically increments the value of a data node or sets its initial value to 0 if it had no value.