enver v0.2.0 Enver.IntegerParser

Link to this section Summary

Functions

Converts the given binary to an integer

Link to this section Types

Link to this type invalid()
invalid() :: Enver.invalid()
Link to this type valid()
valid() :: {:ok, integer()}

Link to this section Functions

Link to this function parse(val, opts)
parse(val(), opts()) :: valid() | invalid()

Converts the given binary to an integer.

iex(1)> Enver.IntegerParser.parse("123", %{type: :integer})
{:ok, 123}

Options:

  • :greater_than

    • Must be an integer
    • An error will be returned if the parsed integer is not greater than the :greater_than integer.
  • :less_than

    • Must be an integer
    • An error will be returned if the parsed integer is not greater than the :less_than integer