-
Notifications
You must be signed in to change notification settings - Fork 28
chore: add generic transactional connection state #493
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
72d0872 to
3563a09
Compare
Adds data structures for generic transactional connection state. These structures will be used to keep all connection state in one place, making it easier to add new connection variables. This also adds support for transactional connection state; Changes that are made during a transaction are only persisted if the transaction is committed. It also allows for setting temporary (local) values during a transaction. This change is the first step in a multi-step process for moving all connection variables into a generic structure. Following changes will move the other connection variables into this structure, and will add support for executing `set local ...` statements.
3563a09 to
4825aa4
Compare
| // GetValueOrDefault returns the current value of the property in the given ConnectionState. | ||
| // It returns the default of the property if no value is found. | ||
| func (p *TypedConnectionProperty[T]) GetValueOrDefault(state *ConnectionState) T { | ||
| value, _ := state.value(p /*returnErrForUnknownProperty=*/, false) |
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.
nit: comment should be associated with right param... state.value(p, /returnErrForUnknownProperty=/ false)
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.
While I agree with you, the Go formatter does not agree with that (and simply does not allow it). It just moves it back to this position automatically.
| return nil | ||
| } | ||
| } | ||
| return nil |
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.
This should probably return error...
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.
Thanks for spotting that. Fixed (and added a test case)
bhatt4982
left a comment
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.
Please check the checkValidValue()...
ce53ec7 to
26fc367
Compare
bhatt4982
left a comment
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.
LGTM...
Adds data structures for generic transactional connection state. These structures will be used to keep all connection state in one place, making it easier to add new connection variables.
This also adds support for transactional connection state; Changes that are made during a transaction are only persisted if the transaction is committed. It also allows for setting temporary (local) values during a transaction.
This change is the first step in a multi-step process for moving all connection variables into a generic structure. Following changes will move the other connection variables into this structure, and will add support for executing
set local ...statements.