-
Notifications
You must be signed in to change notification settings - Fork 117
feat: add query relation #1463
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
Open
LinboLen
wants to merge
15
commits into
goravel:master
Choose a base branch
from
LinboLen:feat/relation_query
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: add query relation #1463
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2bf0b1b
feat(orm): add relation, relation writer, and pivot query contracts
LinboLen 7c7c51d
feat(orm): add morph map registry for polymorphic class resolution
LinboLen 4513622
feat(orm): add eager loader, OfMany aggregates, and rewire With/Load
LinboLen 8607ed4
feat(orm): add relation resolver and Has/HasMorph existence queries
LinboLen f329810
feat(orm): add relation writer and pivot query for many-to-many
LinboLen 18dbdc3
test(orm): add integration tests and many-to-many docs for relation r…
LinboLen da8db93
chore: remove unused ColumnType mock
LinboLen da72ea3
fix: remove dangling OrmAssociation factory referencing deleted mock
LinboLen e03ac4b
refactor(orm): simplify quoteIdent to strip quote characters
LinboLen 9e1cb34
fix(tests): migrate test models to use Relations() method
LinboLen eda8bab
fix(tests): update with_test to use new RelationWriter API
LinboLen e3bbdc1
fix: the pivot query
LinboLen d7f9eba
fix: the & from pointer multi times
LinboLen 7b9c318
feat: add or test case
LinboLen e338e9a
fix(tests): correct expected results for OrWhereDoesntHave tests
LinboLen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package orm | ||
|
|
||
| // ModelWithMorphClass lets a model override the value written to and matched against polymorphic | ||
| // `*_type` columns. The override takes precedence over both the global morph map (registered via | ||
| // orm.MorphMap) and GORM's default of using the parent's table name. | ||
| // | ||
| // A model that wants to be aliased as e.g. "post" in polymorphic relations declares: | ||
| // | ||
| // func (Post) MorphClass() string { return "post" } | ||
| // | ||
| // This is the recommended primary mechanism for aliasing morph types because it co-locates the | ||
| // alias with the model definition. The global morph map is provided as a fallback for models the | ||
| // caller cannot modify (e.g. third-party types) or for teams that prefer a single boot-time | ||
| // registration. | ||
| type ModelWithMorphClass interface { | ||
| MorphClass() string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will Relation replace this function? It's a break change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are no need Association any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can both of them be kept for now? We don't want to have such a break change in the next major version.