Skip to content

Conversation

@olavloite
Copy link
Collaborator

@olavloite olavloite commented Aug 21, 2025

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.

@olavloite olavloite force-pushed the transactional-connection-state branch 2 times, most recently from 72d0872 to 3563a09 Compare August 22, 2025 08:48
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.
@olavloite olavloite force-pushed the transactional-connection-state branch from 3563a09 to 4825aa4 Compare August 22, 2025 09:28
@olavloite olavloite marked this pull request as ready for review August 22, 2025 09:32
@olavloite olavloite requested a review from a team as a code owner August 22, 2025 09:32
@olavloite olavloite requested a review from bhatt4982 August 22, 2025 09:32
// 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)
Copy link
Contributor

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)

Copy link
Collaborator Author

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
Copy link
Contributor

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...

Copy link
Collaborator Author

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)

Copy link
Contributor

@bhatt4982 bhatt4982 left a 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()...

@olavloite olavloite requested a review from bhatt4982 September 2, 2025 09:17
@olavloite olavloite force-pushed the transactional-connection-state branch from ce53ec7 to 26fc367 Compare September 2, 2025 09:19
Copy link
Contributor

@bhatt4982 bhatt4982 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM...

@bhatt4982 bhatt4982 merged commit c0781a7 into main Sep 2, 2025
20 checks passed
@bhatt4982 bhatt4982 deleted the transactional-connection-state branch September 2, 2025 09:23
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.

3 participants