mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
improvement: add load
option to Ash.Query.for_read
improvement: add backwards compat upgrade guide
This commit is contained in:
parent
cf6e738e4d
commit
2a1a1172f1
4 changed files with 18 additions and 1 deletions
3
documentation/moved/upgrade.md
Normal file
3
documentation/moved/upgrade.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Upgrade
|
||||
|
||||
This document has been [moved](upgrading-to-3-0.html).
|
|
@ -471,6 +471,10 @@ defmodule Ash.Query do
|
|||
type: {:protocol, Ash.ToTenant},
|
||||
doc: "set the tenant on the query"
|
||||
],
|
||||
load: [
|
||||
type: :any,
|
||||
doc: "A load statement to apply to the query"
|
||||
],
|
||||
skip_unknown_inputs: [
|
||||
type: {:wrap_list, {:or, [:atom, :string]}},
|
||||
doc:
|
||||
|
@ -523,6 +527,12 @@ defmodule Ash.Query do
|
|||
"query:" <> Ash.Resource.Info.trace_name(query.resource) <> ":#{action_name}"
|
||||
end
|
||||
|
||||
query = if opts[:load] do
|
||||
load(query, opts[:load])
|
||||
else
|
||||
query
|
||||
end
|
||||
|
||||
Ash.Tracer.span :query,
|
||||
name,
|
||||
opts[:tracer] do
|
||||
|
|
4
mix.exs
4
mix.exs
|
@ -77,6 +77,7 @@ defmodule Ash.MixProject do
|
|||
"documentation/topics/development/testing.md",
|
||||
"documentation/topics/development/development-utilities.md",
|
||||
"documentation/topics/development/upgrading-to-3.0.md",
|
||||
"documentation/moved/upgrade.md",
|
||||
"documentation/topics/security/actors-and-authorization.md",
|
||||
"documentation/topics/security/sensitive-data.md",
|
||||
"documentation/topics/security/policies.md",
|
||||
|
@ -115,6 +116,9 @@ defmodule Ash.MixProject do
|
|||
Reference: [
|
||||
~r"documentation/topics/reference",
|
||||
~r"documentation/dsls"
|
||||
],
|
||||
Moved: [
|
||||
~r"documentation/moved"
|
||||
]
|
||||
],
|
||||
skip_undefined_reference_warnings_on: [
|
||||
|
|
|
@ -601,7 +601,7 @@ defmodule Ash.Test.Actions.LoadTest do
|
|||
|
||||
[author] =
|
||||
Author
|
||||
|> Ash.Query.load(posts: [:author])
|
||||
|> Ash.Query.for_read(:read, %{}, load: [posts: [:author]])
|
||||
|> Ash.Query.filter(posts.id == ^post1.id)
|
||||
|> Ash.read!(authorize?: true)
|
||||
|
||||
|
|
Loading…
Reference in a new issue