ecto_fields v1.3.0 EctoFields.PositiveInteger

Link to this section Summary

Functions

Validate that the given value is a positive integer.

Callback implementation for Ecto.Type.dump/1.

Callback implementation for Ecto.Type.equal?/2.

Callback implementation for Ecto.Type.load/1.

Callback implementation for Ecto.Type.type/0.

Link to this section Functions

Validate that the given value is a positive integer.

Examples

iex> EctoFields.PositiveInteger.cast(1)
{:ok, 1}

iex> EctoFields.PositiveInteger.cast(0)
:error

iex> EctoFields.PositiveInteger.cast(-10)
:error

Callback implementation for Ecto.Type.dump/1.

Callback implementation for Ecto.Type.equal?/2.

Callback implementation for Ecto.Type.load/1.

Callback implementation for Ecto.Type.type/0.