Reactor.Argument (reactor v0.15.0)
View SourceA step argument.
Summary
Functions
Build an argument which refers to to an element within a map step with an optional transformation applied.
Build an argument which refers to a reactor input with an optional transformation applied.
Build an argument which refers to the result of another step with an optional transformation applied.
Build an argument directly from a template.
Build an argument which refers to a statically defined value.
Validate that the argument source has a sub_path
Validate that the argument has a transform.
Validate that the argument is an Argument struct.
Validate that the argument contains an element.
Validate that the argument refers to a reactor input.
Validate that the argument refers to a step result.
Validate that the argument contains a static value.
Set a sub-path on the argument.
Types
@type t() :: %Reactor.Argument{ description: nil | String.t(), name: atom(), source: Reactor.Template.t(), transform: transform() }
Functions
Build an argument which refers to to an element within a map step with an optional transformation applied.
Example
iex> Argument.from_element(:argument_name, &Atom.to_string/1)
Build an argument which refers to a reactor input with an optional transformation applied.
Options
:transform
- An optional transformation function which can be used to modify the argument before it is passed to the step. The default value isnil
.:description
- An optional description for the argument. The default value isnil
.
Example
iex> Argument.from_input(:argument_name, :input_name, transform: &String.to_integer/1)
Build an argument which refers to the result of another step with an optional transformation applied.
Example
iex> Argument.from_result(:argument_name, :step_name, &Atom.to_string/1)
Build an argument directly from a template.
Example
iex> Argument.from_template(:argument_name, Reactor.Dsl.Argument.input(:input_name))
Build an argument which refers to a statically defined value.
Example
iex> Argument.from_value(:argument_name, 10)
Validate that the argument source has a sub_path
Validate that the argument has a transform.
Validate that the argument is an Argument struct.
Validate that the argument contains an element.
Validate that the argument refers to a reactor input.
Validate that the argument refers to a step result.
Validate that the argument contains a static value.
Set a sub-path on the argument.
Example
iex> Argument.from_value(:example, :value)
...> |> Argument.sub_path([:nested, :values])