-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
feat: Support Through Relationships #1780
base: main
Are you sure you want to change the base?
feat: Support Through Relationships #1780
Conversation
is this a feat or enhancement? 🤔😅 |
This would be a feature 😄 . Will have to review next week. |
39b2366
to
d301173
Compare
@@ -1191,6 +1251,9 @@ defmodule Ash.Actions.Read.Relationships do | |||
has_page? = query.page not in [nil, false] | |||
|
|||
cond do | |||
is_list(relationship.through) -> | |||
false |
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.
So this will actually be the way that we enable data layers to join through relationships. So this should return true
if the data layer can :lateral_join_through_relationships
or something. For now, nothing will implement this, so we can leave it as a stub and talk about that implementation later. It is actually quite complex to do 😄
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.
In fact...yeah returning false
makes sense here, never mind. When its time to support doing this in an optimized way in the data layer, then we'd return true
here.
@@ -612,6 +623,50 @@ defmodule Ash.Actions.Read.Relationships do | |||
) | |||
end | |||
|
|||
defp load_related_records(records, through, cardinality) do | |||
load_statement = |
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.
We need to pass through the actor, tenant, authorize? and tracer options from the parent call to this call.
Additionally, we should call Ash.load
with the list of records, not each individual record. That will be much more optimized.
#72
Contributor checklist