Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec03af8

Browse files
committed
fix: access data_layer_query with function
1 parent4f2ce6b commitec03af8

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

‎lib/data_layer.ex‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,23 @@ defmodule AshPostgres.DataLayer do
319319
)
320320
)
321321

322-
data_layer_query=Ash.Query.new(source_resource).data_layer_query
323-
324-
from(sourceindata_layer_query,
325-
as::source_record,
326-
where:field(source,^source_field)in^source_values,
327-
inner_lateral_join:destinationin^subquery,
328-
on:field(source,^source_field)==field(destination,^destination_field),
329-
select:destination
330-
)
322+
source_resource
323+
|>Ash.Query.new()
324+
|>Ash.Query.data_layer_query()
325+
|>casedo
326+
{:ok,data_layer_query}->
327+
from(sourceindata_layer_query,
328+
as::source_record,
329+
where:field(source,^source_field)in^source_values,
330+
inner_lateral_join:destinationin^subquery,
331+
on:field(source,^source_field)==field(destination,^destination_field),
332+
select:destination
333+
)
334+
|>IO.inspect()
335+
336+
{:error,error}->
337+
{:error,error}
338+
end
331339
end
332340

333341
@impltrue

‎test/support/multitenancy/resources/org.ex‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ defmodule AshPostgres.MultitenancyTest.Org do
2323

2424
postgresdo
2525
table"multitenant_orgs"
26-
repo(AshPostgres.TestRepo)
26+
repoAshPostgres.TestRepo
2727

2828
manage_tenantdo
29-
template(["org_",:id])
29+
template["org_",:id]
3030
end
3131
end
3232

‎test/support/multitenancy/resources/post.ex‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ defmodule AshPostgres.MultitenancyTest.Post do
2121
end
2222

2323
multitenancydo
24+
# Tells the resource to use the data layer
25+
# multitenancy, in this case separate postgres schemas
2426
strategy(:context)
2527
end
2628

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp