mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 13:03:02 +12:00
docs: Fix examples for builtin before_action
and after_action
preparations (#1439)
This commit is contained in:
parent
295778bbf5
commit
b13181730b
1 changed files with 6 additions and 4 deletions
|
@ -39,11 +39,12 @@ defmodule Ash.Resource.Preparation.Builtins do
|
|||
@doc ~S"""
|
||||
Directly attach a `before_action` function to the query.
|
||||
|
||||
See `Ash.Query.before_action/2` for more information.
|
||||
This function will be called by `Ash.Query.before_action/2`,
|
||||
with an additional `context` argument.
|
||||
|
||||
## Example
|
||||
|
||||
prepare before_action(fn query ->
|
||||
prepare before_action(fn query, _context ->
|
||||
Logger.debug("About to execute query for #{query.action.name} on #{inspect(query.resource)}")
|
||||
|
||||
query
|
||||
|
@ -63,11 +64,12 @@ defmodule Ash.Resource.Preparation.Builtins do
|
|||
@doc ~S"""
|
||||
Directly attach an `after_action` function to the query.
|
||||
|
||||
See `Ash.Query.after_action/2` for more information.
|
||||
This function will be called by `Ash.Query.after_action/2`,
|
||||
with an additional `context` argument.
|
||||
|
||||
## Example
|
||||
|
||||
prepare after_action(fn query, records ->
|
||||
prepare after_action(fn query, records, _context ->
|
||||
Logger.debug("Query for #{query.action.name} on resource #{inspect(query.resource)} returned #{length(records)} records")
|
||||
|
||||
{:ok, records}
|
||||
|
|
Loading…
Reference in a new issue