mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
docs: clean up old docs
This commit is contained in:
parent
957ac1880e
commit
e6abba0de8
3 changed files with 1 additions and 40 deletions
|
@ -1,37 +0,0 @@
|
|||
# Atomics
|
||||
|
||||
Atomics allow you to attach expression-based changes to changesets, to be executed in the data layer when the action is performed.
|
||||
|
||||
For example:
|
||||
|
||||
```elixir
|
||||
update :increment_score do
|
||||
argument :points, :integer, allow_nil?: false
|
||||
change atomic_update(:score, expr(score + ^arg(:points)))
|
||||
end
|
||||
```
|
||||
|
||||
## What is supported
|
||||
|
||||
- Atomics are only supported in update actions and upserts. In the case of upserts, the atomic changes are only applied in the case of a conflicting record.
|
||||
- Attaching atomics to an action using the `atomic_update/2` change in the action, as shown in the example below.
|
||||
- Attaching atomics to a changeset manually with `Ash.Changeset.atomic_update/3`
|
||||
- Using calculations that don't refer to aggregates or related values in expressions
|
||||
|
||||
### Manually attached
|
||||
|
||||
```elixir
|
||||
changeset
|
||||
|> Ash.Changeset.atomic_update(:score, Ash.Expr.expr(score + 1))
|
||||
|> Ash.update!()
|
||||
```
|
||||
|
||||
### Upsert example
|
||||
|
||||
```elixir
|
||||
create :upsert do
|
||||
upsert? true
|
||||
change set_attribute(:points, 1) # set to 1
|
||||
set_on_upsert :points, expr(points + 1) # or increment existing
|
||||
end
|
||||
```
|
|
@ -574,7 +574,7 @@ On `:update` actions, and `:destroy` actions, they now default to `require_atomi
|
|||
3. the action has a manual implementation
|
||||
4. the action has applicable notifiers that require the original data.
|
||||
|
||||
Updates and destroys that can be made fully atomic are always safe to do concurrently, and as such we now require that actions meet this criteria. See the [atomics guide](/documentation/topics/atomics.md) for more.
|
||||
Updates and destroys that can be made fully atomic are always safe to do concurrently, and as such we now require that actions meet this criteria. See the [update actions guide](/documentation/topics/actions/update-actions.md#fully-atomic-updates) for more.
|
||||
|
||||
#### What you'll need to change
|
||||
|
||||
|
|
2
mix.exs
2
mix.exs
|
@ -65,7 +65,6 @@ defmodule Ash.MixProject do
|
|||
"documentation/how_to/validate-changes.md",
|
||||
"documentation/how_to/auto-format-code.md",
|
||||
"documentation/topics/aggregates.md",
|
||||
"documentation/topics/atomics.md",
|
||||
"documentation/topics/attributes.md",
|
||||
"documentation/topics/calculations.md",
|
||||
"documentation/topics/code-interface.md",
|
||||
|
@ -147,7 +146,6 @@ defmodule Ash.MixProject do
|
|||
"documentation/how_to/validate-changes.md",
|
||||
"documentation/how_to/auto-format-code.md",
|
||||
"documentation/topics/aggregates.md",
|
||||
"documentation/topics/atomics.md",
|
||||
"documentation/topics/attributes.md",
|
||||
"documentation/topics/calculations.md",
|
||||
"documentation/topics/code-interface.md",
|
||||
|
|
Loading…
Reference in a new issue