docs: update docs & changelog

This commit is contained in:
Zach Daniel 2022-09-06 22:28:50 -04:00
parent 72da7d8e3c
commit c9d65384e5
3 changed files with 14 additions and 10 deletions

View file

@ -28,16 +28,18 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
* the semantics of `forbid_unless` were not wrong
## [v2.0.0-rc.1](https://github.com/ash-project/ash/compare/v2.0.0-rc.0...v2.0.0-rc.1) (2022-09-04)
### Bug Fixes:
* `forbid_unless` expression compilation
* fix runtime filter join simulation for multiple rows
## [v2.0.0-rc.0](https://github.com/ash-project/ash/compare/v1.53.3...v2.0.0-rc.0) (2022-09-04)
### Bug Fixes:
* Initial Ash 2.0.0-rc.0 release!
## [v1.53.3](https://github.com/ash-project/ash/compare/v1.53.2...v1.53.3) (2022-08-22)

View file

@ -18,6 +18,7 @@ These should all be straight forward enough to do a simple find and replace in y
- `source_field_on_join_table` -> `source_attribute_on_join_resource`
- `destination_field_on_join_table` -> `destination_attribute_on_join_resource`
- `no_fields?` -> `no_attributes?`
- `expensive?` -> `before_action?` (on validations)
### DSL changes

View file

@ -40,6 +40,7 @@ The following functions are built in:
- `get_path` | i.e `get_path(value, ["foo", "bar"])`. This is what expressions like `value[:foo]["bar"]` are turned into under the hood.
- `ago` | i.e `deleted_at > ago(7, :day)`. The available time intervals are documented in {{link:ash:module:Ash.Type.DurationName}}
- `contains` | if one string contains another string, i.e `contains("fred", "red")`
- `exists` | `exists(foo.bar, name == "fred")` takes an expression scoped to the destination, and
## Primitives
@ -48,16 +49,16 @@ The following functions are built in:
## Templates
Most of the time, when you are using an expression, you will actually be creating a `template`. In this template, you have a few references that can be used, which will be replaced when before the expression is evaluated. The following references are available:
Most of the time, when you are using an expression, you will actually be creating a `template`. In this template, you have a few references that can be used, which will be replaced when before the expression is evaluated. The following references are available. The ones that start with `^` must be imported from `Ash.Filter.TemplateHelpers`.
```elixir
actor(:key) # equivalent to `get_in(actor || %{}, [:key])`
actor([:key1, :key2]) # equivalent to `get_in(actor || %{}, [:key, :key2])`
arg(:arg_name) # equivalent to `Map.get(arguments, :arg_name)`
^actor(:key) # equivalent to `get_in(actor || %{}, [:key])`
^actor([:key1, :key2]) # equivalent to `get_in(actor || %{}, [:key, :key2])`
^arg(:arg_name) # equivalent to `Map.get(arguments, :arg_name)`
^context(:key) # equivalent to `get_in(context, :key)`
^context([:key1, :key2]) # equivalent to `get_in(context, [:key1, :key2])`
ref(:key) # equivalent to referring to `key`. Allows for dynamic references
ref(:key, [:path]) # equivalent to referring to `path.key`. Allows for dynamic references with dynamic (or static) paths.
context(:key) # equivalent to `get_in(context, :key)`
context([:key1, :key2]) # equivalent to `get_in(context, [:key1, :key2])`
```
## Use cases for expressions