Transaction

actual class Transaction(source)
actual class Transaction(source)
expect class Transaction(source)

A transaction, mirroring com.google.firebase.firestore.Transaction from the Firebase Android SDK: the writes are applied atomically when the Function returns. Reads inside a transaction (get) are synchronous on Android, the JVM and Apple platforms and are declared in the nonJs source set, as the JS SDK only reads asynchronously.

actual class Transaction(source)
actual class Transaction(source)
actual class Transaction(source)

Types

Link copied to clipboard
actual fun interface Function<TResult>
actual fun interface Function<TResult>
expect fun interface Function<TResult>

The body of a transaction; may throw FirebaseFirestoreException to fail it.

actual fun interface Function<TResult>
actual fun interface Function<TResult>
actual fun interface Function<TResult>

Properties

Link copied to clipboard
val ios: <Error class: unknown class>

The underlying Firebase iOS SDK object.

Link copied to clipboard

The underlying Firebase JS SDK object.

The underlying Firebase JS SDK object.

Functions

Link copied to clipboard
actual fun delete(documentRef: DocumentReference): Transaction
actual fun delete(documentRef: DocumentReference): Transaction
expect fun delete(documentRef: DocumentReference): Transaction

Deletes documentRef.

actual fun delete(documentRef: DocumentReference): Transaction
actual fun delete(documentRef: DocumentReference): Transaction
actual fun delete(documentRef: DocumentReference): Transaction
Link copied to clipboard
actual fun get(documentRef: DocumentReference): DocumentSnapshot
actual fun get(documentRef: DocumentReference): DocumentSnapshot

Reads documentRef inside the transaction; the nonJsMain Transaction.get extension.

expect fun get(documentRef: DocumentReference): DocumentSnapshot

Reads documentRef inside the transaction. The JS SDK reads inside a transaction asynchronously, so on JS this throws UnsupportedOperationException: code that also targets JS uses the suspending dev.gitlive.firebase.firestore.Transaction.get instead.

actual fun get(documentRef: DocumentReference): DocumentSnapshot

Throws: the JS SDK reads inside a transaction asynchronously; use the suspending dev.gitlive.firebase.firestore.Transaction.get.

actual fun get(documentRef: DocumentReference): DocumentSnapshot
actual fun get(documentRef: DocumentReference): DocumentSnapshot

Throws: the JS SDK reads inside a transaction asynchronously; use the suspending dev.gitlive.firebase.firestore.Transaction.get.

Link copied to clipboard
actual fun set(documentRef: DocumentReference, data: Any): Transaction
actual fun set(documentRef: DocumentReference, data: Any, options: SetOptions): Transaction
actual fun set(documentRef: DocumentReference, data: Any): Transaction
actual fun set(documentRef: DocumentReference, data: Any, options: SetOptions): Transaction
expect fun set(documentRef: DocumentReference, data: Any): Transaction

Writes data (a map of field values) to documentRef, replacing the document.

expect fun set(documentRef: DocumentReference, data: Any, options: SetOptions): Transaction

Writes data (a map of field values) to documentRef according to options.

actual fun set(documentRef: DocumentReference, data: Any): Transaction
actual fun set(documentRef: DocumentReference, data: Any, options: SetOptions): Transaction
actual fun set(documentRef: DocumentReference, data: Any): Transaction
actual fun set(documentRef: DocumentReference, data: Any, options: SetOptions): Transaction
actual fun set(documentRef: DocumentReference, data: Any): Transaction
actual fun set(documentRef: DocumentReference, data: Any, options: SetOptions): Transaction
Link copied to clipboard
inline fun <T : Any> Transaction.setData(documentRef: DocumentReference, data: T): Transaction

Writes data (see DocumentReference.setData) to documentRef in the transaction.

inline fun <T : Any> Transaction.setData(documentRef: DocumentReference, data: T, options: SetOptions): Transaction

Writes data (see DocumentReference.setData) to documentRef in the transaction according to options.

Link copied to clipboard
actual fun update(documentRef: DocumentReference, data: Map<String, Any?>): Transaction
actual fun update(documentRef: DocumentReference, fieldPath: FieldPath, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, field: String, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, data: Map<String, Any?>): Transaction
actual fun update(documentRef: DocumentReference, fieldPath: FieldPath, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, field: String, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
expect fun update(documentRef: DocumentReference, data: Map<String, Any?>): Transaction

Updates the fields in data of documentRef; fails if the document does not exist.

expect fun update(documentRef: DocumentReference, fieldPath: FieldPath, value: Any?, vararg moreFieldsAndValues: Any?): Transaction

Updates fieldPath of documentRef to value and the further field path/value pairs in moreFieldsAndValues.

expect fun update(documentRef: DocumentReference, field: String, value: Any?, vararg moreFieldsAndValues: Any?): Transaction

Updates field of documentRef to value and the further field/value pairs in moreFieldsAndValues.

actual fun update(documentRef: DocumentReference, data: Map<String, Any?>): Transaction
actual fun update(documentRef: DocumentReference, fieldPath: FieldPath, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, field: String, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, data: Map<String, Any?>): Transaction
actual fun update(documentRef: DocumentReference, fieldPath: FieldPath, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, field: String, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, data: Map<String, Any?>): Transaction
actual fun update(documentRef: DocumentReference, fieldPath: FieldPath, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
actual fun update(documentRef: DocumentReference, field: String, value: Any?, vararg moreFieldsAndValues: Any?): Transaction
Link copied to clipboard

Updates the fields in data (see DocumentReference.updateData) of documentRef in the transaction.