View Source Arke.System.BaseParameter (Arke v1.1.33)

Link to this section Summary

Functions

Used in the parameter macro to create the map for every parameter which have the values option. It check if the given value are the same type as the parameter type and then creates a list of map as follows

Link to this section Functions

Link to this function

parameter_options(opts, id, type)

View Source
@spec parameter_options(opts :: list(), id :: atom(), type :: atom()) :: %{
  type: atom(),
  opts: list()
}

Used in the parameter macro to create the map for every parameter which have the values option. It check if the given value are the same type as the parameter type and then creates a list of map as follows:

 [%{label "given label", value: given_value}, %{label "given label two ", value: given_value_two}]

Keep in mind that if the values are declared as list instead of map the label will be generated from the value itself.

 ... omitted code

      parameter :custom_parameter2, :integer, required: true, values: [1, 2, 3]

 ... omitted code

The code above will results in an {arke_struct} with the values as follows

  ... omitted code

      values: [%{label "1", value: 1}, %{label "2", value: 2}, %{label "3", value: 3}]

  ... omitted code