View Source EctoRange.Int8 (ecto_range v0.2.1)
A Postgres range of int8
integers. Equivalent to int8range
.
Allows bigint
values.
Link to this section Summary
Functions
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Converts a Postgrex.Range.t() into a normalized form. For bounded ranges, it will make the lower and upper bounds inclusive.
Checks and converts a Postgrex.Range
or tuple into a Postgrex.Range.t()
Link to this section Functions
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Converts a Postgrex.Range.t() into a normalized form. For bounded ranges, it will make the lower and upper bounds inclusive.
examples
Examples
iex> range = %Postgrex.Range{lower: 1, upper: 3, lower_inclusive: true, upper_inclusive: false}
iex> EctoRange.Int8.normalize_range(range)
%Postgrex.Range{lower: 1, upper: 2, lower_inclusive: true, upper_inclusive: true}
iex> range = %Postgrex.Range{lower: 1, upper: 3, lower_inclusive: false, upper_inclusive: true}
iex> EctoRange.Int8.normalize_range(range)
%Postgrex.Range{lower: 2, upper: 3, lower_inclusive: true, upper_inclusive: true}
@spec to_postgrex_range(Postgrex.Range.t() | {integer(), integer()}) :: Postgrex.Range.t()
Checks and converts a Postgrex.Range
or tuple into a Postgrex.Range.t()
examples
Examples
iex> EctoRange.Int8.to_postgrex_range({1, 3})
%Postgrex.Range{lower: 1, upper: 3, lower_inclusive: true, upper_inclusive: true}