Skip to content

Add runTransaction(MutableData) to Realtime Database#820

Open
pmodernme wants to merge 3 commits intoGitLiveApp:masterfrom
pmodernme:feature/database-transaction
Open

Add runTransaction(MutableData) to Realtime Database#820
pmodernme wants to merge 3 commits intoGitLiveApp:masterfrom
pmodernme:feature/database-transaction

Conversation

@pmodernme
Copy link
Copy Markdown

Summary

Adds a DatabaseReference.runTransaction overload that mirrors the Firebase SDK's MutableData-based transaction API. Unlike the existing serializer-based overload, which always commits, this variant lets callers explicitly abort a transaction by returning Transaction.abort() from the handler. Returns the committed DataSnapshot, or null if aborted.

New public types:

  • MutableData — a multiplatform wrapper around the platform MutableData type, with key, value, child(), hasChildren, and children. Inline value<T>() / setValue<T>() extension functions handle serialization.
  • Transaction / Transaction.Result — DSL for returning success or abort from the transaction handler.

Implemented on Android, Apple, and JS.

Test plan

  • Run existing firebase-database common tests
  • Verify runTransaction commits correctly on Android, iOS, and JS
  • Verify Transaction.abort() returns null on all platforms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant