-
Notifications
You must be signed in to change notification settings - Fork 39
Transaction API features #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also (and maybe this should be in a separate issue): Can the return type of |
One more idea I had: Firestore enforces that all reads precede all writes in a transaction. It seems like this could be enforced via types, by having But maybe this is beyond the scope of the library? |
No worries, thank you for taking the time and share your ideas. As I said in another issue I didn't receive notifications, so sorry for the long response. I really appreciate your interest in the library!
Wow, I didn't know that. Weird that it's not mentioned in the docs or simply missed it when worked on the function. Do you know if it's supported by the web version as well?
I'll be really happy, contributions are very welcome 🙏 |
Good point, I've created a separate issue for that: #8 |
That's an interesting idea and might help new developers. When I just started with Firestore I remember how I was confused by the transaction limitations. How do you the API? Maybe something like this? transaction({
read: t => { /* ... */ },
write: (readResults, t) => { /* ... */ }
}) I've created an issue for that: #9 |
Yep, something like that would be great! |
@whaatt @kossnocorp Working with the API now, it would be very cool if every Typesaurus function returns an interface or some kind of typed object. For example I'm using the For example: import { batch, Batch } from 'typesaurus'
const foo = (batch: Batch) => {
batch.set(...)
batch.commit(...)
}
const myBatch: Batch = batch()
foo(myBatch) Greetings :) |
Closing the issue as I addressed all the feedback, thank you a lot @whaatt! |
Hi there (and sorry for creating all the issues)!
I noticed that the transaction API in
typesaurus
doesn't support querying within a transaction. In the types for Firestore, they allowtransaction.get
to take a query object (and acquire pessimistic locks on all the returned documents).Adding
query
to the transaction API seems straightforward enough; is this something that could be added in the near-term?Also, please let me know if I could help out with this task.
The text was updated successfully, but these errors were encountered: