Ecto type to cast floats or strings to integers for your schemas.
Available in Hex, the package can be installed as:
- Add
lazy_integer
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:lazy_integer, "~> 1.0.0"}]
end
```
- Ensure
lazy_integer
is started before your application:
```elixir
def application do
[applications: [:lazy_integer]]
end
```
Use LazyInteger as a type for your Ecto Schemas:
defmodule YourProject.Thing do
use Ecto.Model
schema "things" do
field :first_name, :string
field :second_name, :string
field :age, LazyInteger
end
end