Skip to content
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

Add ExecuteQueryWithTransactionConfig option for ExecuteQuery #553

Conversation

StephenCathcart
Copy link
Contributor

A new ExecuteQueryConfigurationOption has been added (ExecuteQueryWithTransactionConfig) to specify transaction config like metadata and transaction timeout with ExecuteQuery.

result, err := neo4j.ExecuteQuery(ctx, driver, query, parameters, transformer,
        neo4j.ExecuteQueryWithTransactionConfig(
                neo4j.WithTxTimeout(30*time.Second),
                neo4j.WithTxMetadata(map[string]any{"key": "value"}),
        ),
)

@StephenCathcart StephenCathcart changed the title Add ExecuteQueryWithTransactionConfig option for ExecuteQuery Add ExecuteQueryWithTransactionConfig option for ExecuteQuery Dec 7, 2023
@StephenCathcart
Copy link
Contributor Author

Copy link

@AndyHeap-NeoTech AndyHeap-NeoTech left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@robsdedude robsdedude left a comment

Choose a reason for hiding this comment

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

consider adding unit tests

// ExecuteQueryConfiguration holds all the possible configuration settings for DriverWithContext.ExecuteQuery
type ExecuteQueryConfiguration struct {
Routing RoutingControl
ImpersonatedUser string
Database string
BookmarkManager BookmarkManager
BoltLogger log.BoltLogger
Configurers []func(*TransactionConfig)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe call it something more self-explanatory like TransactionConfigurers.

Copy link
Member

Choose a reason for hiding this comment

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

ExecuteQuery docs could use an update. Especially the section following

The equivalent functionality of ExecuteQuery can be replicated with pre-existing APIs as follows:

Copy link
Member

Choose a reason for hiding this comment

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

The docs for WithTxTimeout and WithTxMetadata list examples for each of the APIs they can be used with. Consider adding ExecuteQueryWithTransactionConfig there.

@StephenCathcart StephenCathcart merged commit 4354f3a into neo4j:5.0 Dec 8, 2023
@StephenCathcart StephenCathcart deleted the feat/execute-query-transaction-config branch December 8, 2023 17:50
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