View Source EctoRange.Int4 (ecto_range v0.2.1)

A Postgres range of int4 integers. Equivalent to int4range.

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.Int4.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.Int4.normalize_range(range)
%Postgrex.Range{lower: 2, upper: 3, lower_inclusive: true, upper_inclusive: true}
Link to this function

to_postgrex_range(range)

View Source
@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.Int4.to_postgrex_range({1, 3})
%Postgrex.Range{lower: 1, upper: 3, lower_inclusive: true, upper_inclusive: true}