XT.Seed (xt v0.1.1) View Source

Seed Utilities Functions

Link to this section Summary

Functions

Convert the given fields to float values for the Map

Convert the given fields to float values for the Map

Convert the given field to float value for the Map

Convert the given field to float value for the Map

Parse the string into a float

Parse the string into a float

Link to this section Functions

Link to this function

convert_fields_to_float(row, keys)

View Source

Specs

convert_fields_to_float(map(), list()) :: map()

Convert the given fields to float values for the Map

Examples

iex> XT.Seed.convert_fields_to_float(%{balance: "1.1"}, [:balance]) %{balance: 1.1}

iex> XT.Seed.convert_fields_to_float(%{balance: "3333.333", name: "john"}, [:balance]) %{balance: 3333.333, name: "john"}

Link to this function

convert_fields_to_int(row, keys)

View Source

Specs

convert_fields_to_int(map(), list()) :: map()

Convert the given fields to float values for the Map

Examples

iex> XT.Seed.convert_fields_to_int(%{balance: "10"}, [:balance]) %{balance: 10}

iex> XT.Seed.convert_fields_to_int(%{balance: "11", name: "john"}, [:balance]) %{balance: 11, name: "john"}

Link to this function

convert_to_float(row, key)

View Source

Specs

convert_to_float(map(), atom()) :: map()

Convert the given field to float value for the Map

Examples

iex> XT.Seed.convert_to_float(%{balance: "3.33"}, :balance) %{balance: 3.33}

iex> XT.Seed.convert_to_float(%{balance: "1.11", name: "john"}, :balance) %{balance: 1.11, name: "john"}

Link to this function

convert_to_int(row, key)

View Source

Specs

convert_to_int(map(), atom()) :: map()

Convert the given field to float value for the Map

Examples

iex> XT.Seed.convert_to_int(%{balance: "10"}, :balance) %{balance: 10}

iex> XT.Seed.convert_to_int(%{balance: "11", name: "john"}, :balance) %{balance: 11, name: "john"}

Link to this function

parse_string_to_float(value)

View Source

Specs

parse_string_to_float(String.t()) :: nil | float()

Parse the string into a float

Link to this function

parse_string_to_int(value)

View Source

Specs

parse_string_to_int(String.t()) :: nil | integer()

Parse the string into a float