Skip to content

fix: preload shouldn't overwrite the value of join#6771

Merged
jinzhu merged 3 commits intogo-gorm:masterfrom
black-06:fix_nested_preload
Jan 29, 2024
Merged

fix: preload shouldn't overwrite the value of join#6771
jinzhu merged 3 commits intogo-gorm:masterfrom
black-06:fix_nested_preload

Conversation

@black-06
Copy link
Copy Markdown
Contributor

@black-06 black-06 commented Jan 2, 2024

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

What did this pull request do?

Fix the issue #6715, preload shouldn't overwrite the value of join.

See #6715 (comment)

User Case Description

type (
	Preload struct {
		ID       uint
		Value    string
		NestedID uint
	}
	Join struct {
		ID       uint
		Value    string
		NestedID uint
	}
	Nested struct {
		ID       uint
		Preloads []*Preload
		Join     Join
		ValueID  uint
	}
	Value struct {
		ID     uint
		Name   string
		Nested Nested
	}
)

DB.Joins("Nested").Joins("Nested.Join").Preload("Nested.Preloads").First(&find)

@black-06 black-06 requested a review from a631807682 January 2, 2024 12:57
Comment thread callbacks/preload.go
@alexisvisco
Copy link
Copy Markdown
Contributor

Hello, just to be sure, we are waiting a merge from @jinzhu ?

@black-06
Copy link
Copy Markdown
Contributor Author

Hello, just to be sure, we are waiting a merge from @jinzhu ?

I think so 😴

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.

5 participants