-
Notifications
You must be signed in to change notification settings - Fork 149
Deprecate Session.(read|write)Transaction
in favor of execute(Read|Write)
methods
#911
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
Conversation
…d|Write)" methods The new methods provides a `ManagedTransaction` objects to the transaction functions. These transaction objects don't have `commit`, `rollback` and `close` capabilities exposed in the API.
Session.(read|write)Transaction
in favor for execute(Read|Write)
methodsSession.(read|write)Transaction
in favor of execute(Read|Write)
methods
* @returns {Observable} | ||
*/ | ||
_executeInTransaction (accessMode, work, transactionConfig) { | ||
const wrapper = txc => new RxManagedTransaction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be easier if RxManagedTransaction
constructor accepted txc
as its argument instead of an arbitrary object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bind will only change places at the end. I don't want to keep reference from the transaction inside the ManagedTransaction to avoid the client code by pass the encapsulation and commit/rollback/close it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about:
class RxManagedTransaction {
constructor(txc) {
this._run = txc.run.bind(txc)
this._isOpen = tcx.isOpen.bind(txc)
}
so you don't have to repeat the destructuring every time you call the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved to the binding to a static factory method called fromTransaction
. It makes easier to pass the function as parameter.
Co-authored-by: Florent Biville <[email protected]>
* @returns {Observable} | ||
*/ | ||
_executeInTransaction (accessMode, work, transactionConfig) { | ||
const wrapper = txc => new RxManagedTransaction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about:
class RxManagedTransaction {
constructor(txc) {
this._run = txc.run.bind(txc)
this._isOpen = tcx.isOpen.bind(txc)
}
so you don't have to repeat the destructuring every time you call the constructor
The new methods provides a
ManagedTransaction
objects to the transaction functions. Thesetransaction objects don't have
commit
,rollback
andclose
capabilities exposed in the API.