Skip to content

add custom flag gorm:custom_transaction to bypass default transaction #12

Open
maxshine wants to merge 1 commit intojinzhu:masterfrom
maxshine:maxshine-AddCustomTransaction
Open

add custom flag gorm:custom_transaction to bypass default transaction #12
maxshine wants to merge 1 commit intojinzhu:masterfrom
maxshine:maxshine-AddCustomTransaction

Conversation

@maxshine
Copy link

…faultHandler

Make sure these boxes checked before submitting your pull request.

  • [*] Do only one thing
  • [*] No API-breaking changes
  • [*] New code/logic commented & tested

For significant changes like big bug fixes, new features, please open an issue to make an agreement on an implementation design/plan first before starting it.

What did this pull request do?

This PR is to add a setting to enable application developer to control when GORM should do things for them in GORM transactions.

For details, the PR adds a new setting named gorm:custom_transaction. The application developer could set it before call any GORM API. As DefaultHandler has most CUD callbacks with transaction started automatically, the new logic will check gorm:custom_transaction firstly before do transaction things.

This feature can help application developer do their things at their demands easily and do not need to do the global setting or develop a customized callback plugin to do this. It is more convenient to use this setting.

Please kindly help review this PR.

Thanks.

@maxshine maxshine changed the title add custom flag gorm:custom_transaction to bypass transaction from De… add custom flag gorm:custom_transaction to bypass default transaction Nov 17, 2020
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.

1 participant