mirror of
https://github.com/ash-project/ash.git
synced 2024-09-21 05:53:06 +12:00
b20c4afd9b
fix: fix chart links rendering
41 lines
1.1 KiB
Elixir
41 lines
1.1 KiB
Elixir
defmodule Ash.Flow.StepHelpers do
|
|
@moduledoc "Template functions available while declaring steps."
|
|
|
|
@doc "Accesses a flow argument"
|
|
def arg(name) do
|
|
{:_arg, name}
|
|
end
|
|
|
|
@doc "Accesses a flow argument"
|
|
def merge(results) do
|
|
{:_merge, results}
|
|
end
|
|
|
|
@doc "Constructs an expression that can access"
|
|
defmacro expr(expr) do
|
|
quote do
|
|
require Ash.Expr
|
|
{:_expr, Ash.Expr.expr(unquote(expr))}
|
|
end
|
|
end
|
|
|
|
@doc "Accesses the result of a step"
|
|
def result(step) do
|
|
{:_result, step}
|
|
end
|
|
|
|
@doc "Accesses a path in a value lazily. Supports the value being a template, e.g `path(result(:foo), [:bar, 0, :baz])`"
|
|
def path(template, path) do
|
|
{:_path, template, List.wrap(path)}
|
|
end
|
|
|
|
@doc "Creates a range lazily. Supports the start or finish being a template, e.g `range(result(:foo), result(:bar))`"
|
|
def range(start, finish) do
|
|
{:_range, start, finish}
|
|
end
|
|
|
|
@doc "Accesses the value being iterated over for a given map step. The name is required so that `map` steps can be nested."
|
|
def element(element) do
|
|
{:_element, element}
|
|
end
|
|
end
|