mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
docs: Spelling fixes, add :upsert_identity example (#327)
* Minor spelling fixes, :upsert_identity example * Grammatical tweaks in API docs * Adjust phrasing, consistent formatting
This commit is contained in:
parent
ddde776fd0
commit
9b5c713bcd
5 changed files with 14 additions and 14 deletions
|
@ -88,7 +88,7 @@ defmodule Ash.Api do
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
default: true,
|
default: true,
|
||||||
doc:
|
doc:
|
||||||
"For Ash errors, wether or not each error has a stacktrace. See the error_handling guide for more."
|
"For Ash errors, whether or not each error has a stacktrace. See the error_handling guide for more."
|
||||||
],
|
],
|
||||||
tenant: [
|
tenant: [
|
||||||
type: :any,
|
type: :any,
|
||||||
|
@ -271,7 +271,7 @@ defmodule Ash.Api do
|
||||||
```
|
```
|
||||||
|
|
||||||
If you tried to load that `:full_name` calculation after receiving the data, the `last_name` would not be selected and as such would not be
|
If you tried to load that `:full_name` calculation after receiving the data, the `last_name` would not be selected and as such would not be
|
||||||
usable in the calculation, regardless of wether or not the calculation includes that field in its select list.
|
usable in the calculation, regardless of whether or not the calculation includes that field in its select list.
|
||||||
"""
|
"""
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -286,7 +286,7 @@ defmodule Ash.Api do
|
||||||
upsert_identity: [
|
upsert_identity: [
|
||||||
type: :atom,
|
type: :atom,
|
||||||
doc:
|
doc:
|
||||||
"The identity to use when detecting conflicts for upsert?. By default, the primary key is used. Has no effect if `upsert?: true` is not provided"
|
"The identity to use when detecting conflicts for `upsert?`, e.g. `upsert_identity: :full_name`. By default, the primary key is used. Has no effect if `upsert?: true` is not provided"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|> merge_schemas(@global_opts, "Global Options")
|
|> merge_schemas(@global_opts, "Global Options")
|
||||||
|
@ -364,10 +364,10 @@ defmodule Ash.Api do
|
||||||
Ash.Resource.record() | {Ash.Resource.record(), Ash.Query.t()} | no_return
|
Ash.Resource.record() | {Ash.Resource.record(), Ash.Query.t()} | no_return
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Run a query on a resource, but fail on more than one result
|
Run a query on a resource, but fail on more than one result.
|
||||||
|
|
||||||
This is useful if you have a query that doesn't include a primary key
|
This is useful if you have a query that doesn't include a primary key
|
||||||
but you know that it will only ever return a single result
|
but you know that it will only ever return a single result.
|
||||||
"""
|
"""
|
||||||
@callback read_one(Ash.Query.t() | Ash.Resource.t(), params :: Keyword.t()) ::
|
@callback read_one(Ash.Query.t() | Ash.Resource.t(), params :: Keyword.t()) ::
|
||||||
{:ok, Ash.Resource.record()}
|
{:ok, Ash.Resource.record()}
|
||||||
|
@ -384,7 +384,7 @@ defmodule Ash.Api do
|
||||||
@doc """
|
@doc """
|
||||||
Run a query on a resource.
|
Run a query on a resource.
|
||||||
|
|
||||||
For more information, on building a query, see `Ash.Query`.
|
For more information on building a query, see `Ash.Query`.
|
||||||
|
|
||||||
#{Ash.OptionsHelpers.docs(@read_opts_schema)}
|
#{Ash.OptionsHelpers.docs(@read_opts_schema)}
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ defmodule Ash.Api do
|
||||||
Gets the resources of an Api module. DO NOT USE AT COMPILE TIME.
|
Gets the resources of an Api module. DO NOT USE AT COMPILE TIME.
|
||||||
|
|
||||||
If you need the resource list at compile time, you will need to introduce a compile time
|
If you need the resource list at compile time, you will need to introduce a compile time
|
||||||
dependency on all of the resources, and therefore should use the registry directly. `Registry |> Ash.Registry.entries()`
|
dependency on all of the resources, and therefore should use the registry directly. `Registry |> Ash.Registry.entries()`.
|
||||||
"""
|
"""
|
||||||
@spec resources(Ash.Api.t()) :: list(Ash.Resource.t())
|
@spec resources(Ash.Api.t()) :: list(Ash.Resource.t())
|
||||||
def resources(api) do
|
def resources(api) do
|
||||||
|
|
|
@ -34,7 +34,7 @@ defmodule Ash.Api.Dsl do
|
||||||
allow: [
|
allow: [
|
||||||
type: :mfa,
|
type: :mfa,
|
||||||
doc: """
|
doc: """
|
||||||
Support a dynamic resource list by providing a callback that checks wether or not the resource should be allowed.
|
Support a dynamic resource list by providing a callback that checks whether or not the resource should be allowed.
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
allow_unregistered?: [
|
allow_unregistered?: [
|
||||||
|
|
|
@ -16,7 +16,7 @@ defmodule Ash.Engine do
|
||||||
As the complexity of a system grows, it becomes very difficult to write code that
|
As the complexity of a system grows, it becomes very difficult to write code that
|
||||||
is both imperative and performant. This is especially true of a framework that is
|
is both imperative and performant. This is especially true of a framework that is
|
||||||
designed to be configurable. What exactly is done, as well as the order it is done in,
|
designed to be configurable. What exactly is done, as well as the order it is done in,
|
||||||
and wether or not is can be parallelized, varies wildly based on factors like how
|
and whether or not is can be parallelized, varies wildly based on factors like how
|
||||||
the resources are configured and what capabilities the data layer has. By implementing
|
the resources are configured and what capabilities the data layer has. By implementing
|
||||||
a generic "parallel engine", we can let the engine solve that problem. We simply
|
a generic "parallel engine", we can let the engine solve that problem. We simply
|
||||||
have to express the various operations that must happen, and what other pieces of data
|
have to express the various operations that must happen, and what other pieces of data
|
||||||
|
|
|
@ -46,7 +46,7 @@ defmodule Ash.Engine.Request do
|
||||||
|
|
||||||
defmodule UnresolvedField do
|
defmodule UnresolvedField do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents an unresolved field to be resolved by the engine
|
Represents an unresolved field to be resolved by the engine.
|
||||||
"""
|
"""
|
||||||
defstruct [:resolver, deps: [], data?: false]
|
defstruct [:resolver, deps: [], data?: false]
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ defmodule Ash.Engine.Request do
|
||||||
being processed, like `[:data]`, and the last element is the
|
being processed, like `[:data]`, and the last element is the
|
||||||
key of that request that is required. Make sure to pass a
|
key of that request that is required. Make sure to pass a
|
||||||
list of lists of atoms. The second argument is a map, which
|
list of lists of atoms. The second argument is a map, which
|
||||||
contains all the values you requested, at the same path
|
contains all of the values you requested, at the same path
|
||||||
that they were requested.
|
that they were requested.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
@ -115,7 +115,7 @@ defmodule Ash.Engine.Request do
|
||||||
When other requests depend on a value from this request, they will
|
When other requests depend on a value from this request, they will
|
||||||
not be sent unless this request has completed its authorization (or this
|
not be sent unless this request has completed its authorization (or this
|
||||||
request has been configured not to do authorization). This allows requests
|
request has been configured not to do authorization). This allows requests
|
||||||
to depend on eachother without those requests happening just before a request
|
to depend on each other without those requests happening just before a request
|
||||||
fails with a forbidden error. These fields are `data`, `query`, `changeset`
|
fails with a forbidden error. These fields are `data`, `query`, `changeset`
|
||||||
and `authorized?`.
|
and `authorized?`.
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ defmodule Ash.Engine.Request do
|
||||||
* name - A human readable name for the request, used when logging/in errors
|
* name - A human readable name for the request, used when logging/in errors
|
||||||
* strict_check_only? - If true, authorization will not be allowed to proceed to a runtime check (so it cannot run db queries unless authorization is assured)
|
* strict_check_only? - If true, authorization will not be allowed to proceed to a runtime check (so it cannot run db queries unless authorization is assured)
|
||||||
* actor - The actor performing the action, used for authorization
|
* actor - The actor performing the action, used for authorization
|
||||||
* authorize? - Wether or not to perform authorization (defaults to true)
|
* authorize? - Whether or not to perform authorization (defaults to true)
|
||||||
* verbose? - print informational logs (warning, this will be a whole lot of logs)
|
* verbose? - print informational logs (warning, this will be a whole lot of logs)
|
||||||
* write_to_data? - If set to false, this value is not returned from the initial call to the engine
|
* write_to_data? - If set to false, this value is not returned from the initial call to the engine
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -19,7 +19,7 @@ defmodule Ash.Resource.Actions.SharedOptions do
|
||||||
transaction?: [
|
transaction?: [
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
doc: """
|
doc: """
|
||||||
Wether or not the action should be run in transactions. Reads default to false, while create/update/destroy actions default to `true`.
|
Whether or not the action should be run in transactions. Reads default to false, while create/update/destroy actions default to `true`.
|
||||||
|
|
||||||
Has no effect if the data layer does not support transactions, or if that data layer is already in a transaction.
|
Has no effect if the data layer does not support transactions, or if that data layer is already in a transaction.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue