mirror of
https://github.com/ash-project/ash.git
synced 2024-09-21 05:53:06 +12:00
37 lines
801 B
Elixir
37 lines
801 B
Elixir
|
defmodule Ash.Test.Flow.Flows.Halting do
|
||
|
@moduledoc false
|
||
|
use Ash.Flow
|
||
|
|
||
|
flow do
|
||
|
argument :on_step, :atom do
|
||
|
allow_nil? false
|
||
|
constraints one_of: [:a, :b, :c]
|
||
|
default :a
|
||
|
end
|
||
|
|
||
|
returns :c
|
||
|
end
|
||
|
|
||
|
steps do
|
||
|
custom :a, Ash.Test.Flow.Steps.SimpleReturn do
|
||
|
input %{return: "a"}
|
||
|
halt_if expr(not (^arg(:on_step) == :a))
|
||
|
halt_reason :not_on_step_a
|
||
|
end
|
||
|
|
||
|
custom :b, Ash.Test.Flow.Steps.SimpleReturn do
|
||
|
input %{return: "b"}
|
||
|
halt_if expr(not (^arg(:on_step) == :b))
|
||
|
wait_for result(:a)
|
||
|
halt_reason :not_on_step_b
|
||
|
end
|
||
|
|
||
|
custom :c, Ash.Test.Flow.Steps.SimpleReturn do
|
||
|
input %{return: "c"}
|
||
|
halt_if expr(not (^arg(:on_step) == :c))
|
||
|
wait_for result(:b)
|
||
|
halt_reason :not_on_step_c
|
||
|
end
|
||
|
end
|
||
|
end
|