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

fix: rectify SkipHooks not working with NewDB set in Session method #6484

Merged
merged 2 commits into from Aug 4, 2023

Conversation

aayushacharya
Copy link
Contributor

@aayushacharya aayushacharya commented Jul 27, 2023

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

When the Session method is invoked with &gorm.Session{NewDB: true, SkipHooks: true} object, it ignores the SkipHooks. This PR adds the SkipHooks in getInstance method.

User Case Description

// This will still call the associated hook currently. With this PR, hooks associated will not be called in this case.
db.Session(&gorm.Session{NewDB: true, SkipHooks: true}).First(&sampleObj)

@aayushacharya aayushacharya changed the title fix: rectifySkipHooks not working with NewDB set in Session method fix: rectify SkipHooks not working with NewDB set in Session method Jul 30, 2023
@jinzhu jinzhu merged commit f473761 into go-gorm:master Aug 4, 2023
26 checks passed
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.

None yet

2 participants