mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
docs: doc fixes, move code interface docs
This commit is contained in:
parent
52e608336d
commit
d2612a9ed8
12 changed files with 22 additions and 20 deletions
|
@ -98,7 +98,7 @@ define name
|
|||
```
|
||||
|
||||
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
|
||||
|
||||
|
||||
|
@ -140,7 +140,7 @@ define_calculation name
|
|||
```
|
||||
|
||||
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
|
||||
|
||||
|
||||
|
@ -166,7 +166,7 @@ define_calculation :referral_link, User, args: [{:arg, :id}, {:ref, :id}]
|
|||
| Name | Type | Default | Docs |
|
||||
|------|------|---------|------|
|
||||
| [`calculation`](#resources-resource-define_calculation-calculation){: #resources-resource-define_calculation-calculation } | `atom` | | The name of the calculation that will be evaluated. Defaults to the same name as the function. |
|
||||
| [`args`](#resources-resource-define_calculation-args){: #resources-resource-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/code-interface.md) for more. |
|
||||
| [`args`](#resources-resource-define_calculation-args){: #resources-resource-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. |
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1287,7 +1287,7 @@ end
|
|||
| Name | Type | Default | Docs |
|
||||
|------|------|---------|------|
|
||||
| [`manual`](#actions-read-manual){: #actions-read-manual } | `(any, any, any -> any) \| module` | | Delegates running of the query to the provided module. Accepts a module or module and opts, or a function that takes the ash query, the data layer query, and context. See the [manual actions guide](/documentation/topics/manual-actions.md) for more. |
|
||||
| [`get?`](#actions-read-get?){: #actions-read-get? } | `boolean` | `false` | Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/code-interface.md) for more. |
|
||||
| [`get?`](#actions-read-get?){: #actions-read-get? } | `boolean` | `false` | Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. |
|
||||
| [`modify_query`](#actions-read-modify_query){: #actions-read-modify_query } | `mfa \| (any, any -> any)` | | Allows direct manipulation of the data layer query via an MFA. The ash query and the data layer query will be provided as additional arguments. The result must be `{:ok, new_data_layer_query} \| {:error, error}`. |
|
||||
| [`get_by`](#actions-read-get_by){: #actions-read-get_by } | `atom \| list(atom)` | | A helper to automatically generate a "get by X" action. Sets `get?` to true, add args for each of the specified fields, and adds a filter for each of the arguments. |
|
||||
| [`timeout`](#actions-read-timeout){: #actions-read-timeout } | `pos_integer` | | The maximum amount of time, in milliseconds, that the action is allowed to run for. Ignored if the data layer doesn't support transactions *and* async is disabled. |
|
||||
|
@ -1973,7 +1973,7 @@ Target: `Ash.Resource.Actions.Destroy`
|
|||
|
||||
|
||||
## code_interface
|
||||
Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
|
||||
|
||||
### Nested DSLs
|
||||
|
@ -2008,7 +2008,7 @@ define name
|
|||
```
|
||||
|
||||
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
|
||||
|
||||
|
||||
|
@ -2050,7 +2050,7 @@ define_calculation name
|
|||
```
|
||||
|
||||
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
|
||||
|
||||
|
||||
|
@ -2076,7 +2076,7 @@ define_calculation :referral_link, args: [{:arg, :id}, {:ref, :id}]
|
|||
| Name | Type | Default | Docs |
|
||||
|------|------|---------|------|
|
||||
| [`calculation`](#code_interface-define_calculation-calculation){: #code_interface-define_calculation-calculation } | `atom` | | The name of the calculation that will be evaluated. Defaults to the same name as the function. |
|
||||
| [`args`](#code_interface-define_calculation-args){: #code_interface-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/code-interface.md) for more. |
|
||||
| [`args`](#code_interface-define_calculation-args){: #code_interface-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. |
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ Welcome to the Ash Framework documentation! Here you will find everything you ne
|
|||
- [Attributes](documentation/topics/resources/attributes.md)
|
||||
- [Calculations](documentation/topics/resources/calculations.md)
|
||||
- [Aggregates](documentation/topics/resources/aggregates.md)
|
||||
- [Code Interfaces](documentation/topics/resources/code-interfaces.md)
|
||||
|
||||
### Actions
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Ticket
|
|||
|> Ash.create!()
|
||||
```
|
||||
|
||||
See the [Code Interface guide](documentation/topics/code-interface.md) for creating an interface to call the action more elegantly, like so:
|
||||
See the [Code Interface guide](documentation/topics/resources/code-interfaces.md) for creating an interface to call the action more elegantly, like so:
|
||||
|
||||
```elixir
|
||||
Support.open_ticket!("Need help!")
|
||||
|
|
|
@ -18,7 +18,7 @@ ticket # providing an initial ticket to close
|
|||
|> Ash.update!()
|
||||
```
|
||||
|
||||
See the [Code Interface guide](documentation/topics/code-interface.md) for creating an interface to call the action more elegantly, like so:
|
||||
See the [Code Interface guide](documentation/topics/resources/code-interfaces.md) for creating an interface to call the action more elegantly, like so:
|
||||
|
||||
```elixir
|
||||
Support.close_ticket!(ticket, "I figured it out.")
|
||||
|
|
|
@ -609,4 +609,4 @@ See the [Policies guide](/documentation/topics/security/policies.md) for informa
|
|||
|
||||
Creating and using changesets manually can be verbose, and they all look very similar. Luckily, Ash has your back and can help you build high quality interfaces for you!
|
||||
|
||||
Check out the [Code Interface Guide](/documentation/topics/code-interface.md) to derive things like `Helpdesk.Support.Ticket.assign!(representative.id)`
|
||||
Check out the [Code Interface Guide](/documentation/topics/topics/code-interfaces.md) to derive things like `Helpdesk.Support.Ticket.assign!(representative.id)`
|
||||
|
|
|
@ -89,7 +89,7 @@ defmodule Ash.Domain.Dsl do
|
|||
@define %Spark.Dsl.Entity{
|
||||
name: :define,
|
||||
describe: """
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
""",
|
||||
examples: [
|
||||
"define :get_user_by_id, User, action: :get_by_id, args: [:id], get?: true"
|
||||
|
@ -103,7 +103,7 @@ defmodule Ash.Domain.Dsl do
|
|||
@define_calculation %Spark.Dsl.Entity{
|
||||
name: :define_calculation,
|
||||
describe: """
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
""",
|
||||
examples: [
|
||||
"define_calculation :referral_link, User, args: [:id]",
|
||||
|
|
|
@ -56,7 +56,7 @@ defmodule Ash.Resource.Actions.Read do
|
|||
type: :boolean,
|
||||
default: false,
|
||||
doc: """
|
||||
Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
"""
|
||||
],
|
||||
modify_query: [
|
||||
|
|
|
@ -21,7 +21,7 @@ defmodule Ash.Resource.CalculationInterface do
|
|||
type: :any,
|
||||
default: [],
|
||||
doc: """
|
||||
Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
"""
|
||||
]
|
||||
]
|
||||
|
|
|
@ -839,7 +839,7 @@ defmodule Ash.Resource.Dsl do
|
|||
@define_calculation %Spark.Dsl.Entity{
|
||||
name: :define_calculation,
|
||||
describe: """
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
""",
|
||||
examples: [
|
||||
"define_calculation :referral_link, args: [:id]",
|
||||
|
@ -854,7 +854,7 @@ defmodule Ash.Resource.Dsl do
|
|||
@define %Spark.Dsl.Entity{
|
||||
name: :define,
|
||||
describe: """
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
""",
|
||||
examples: [
|
||||
"define :get_user_by_id, action: :get_by_id, args: [:id], get?: true"
|
||||
|
@ -868,7 +868,7 @@ defmodule Ash.Resource.Dsl do
|
|||
@code_interface %Spark.Dsl.Section{
|
||||
name: :code_interface,
|
||||
describe: """
|
||||
Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/code-interface.md) for more.
|
||||
Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more.
|
||||
""",
|
||||
examples: [
|
||||
"""
|
||||
|
|
5
mix.exs
5
mix.exs
|
@ -48,6 +48,7 @@ defmodule Ash.MixProject do
|
|||
"documentation/topics/about_ash/contributing-to-ash.md",
|
||||
"documentation/topics/resources/attributes.md",
|
||||
"documentation/topics/resources/embedded-resources.md",
|
||||
"documentation/topics/resources/code-interfaces.md",
|
||||
"documentation/topics/actions/actions.md",
|
||||
"documentation/topics/actions/read-actions.md",
|
||||
"documentation/topics/actions/create-actions.md",
|
||||
|
@ -68,7 +69,6 @@ defmodule Ash.MixProject do
|
|||
"documentation/how_to/validate-changes.md",
|
||||
"documentation/topics/resources/aggregates.md",
|
||||
"documentation/topics/resources/calculations.md",
|
||||
"documentation/topics/code-interface.md",
|
||||
"documentation/topics/extending-resources.md",
|
||||
"documentation/topics/expressions.md",
|
||||
"documentation/topics/reference/glossary.md",
|
||||
|
@ -102,8 +102,9 @@ defmodule Ash.MixProject do
|
|||
Resources: [
|
||||
"documentation/topics/resources/attributes.md",
|
||||
"documentation/topics/resources/calculations.md",
|
||||
"documentation/topics/resources/aggregates.md"
|
||||
"documentation/topics/resources/aggregates.md",
|
||||
"documentation/topics/resources/embedded-resources.md",
|
||||
"documentation/topics/resources/code-interfaces.md"
|
||||
],
|
||||
Actions: [
|
||||
"documentation/topics/actions/actions.md",
|
||||
|
|
Loading…
Reference in a new issue