View Source PgRanges.NumRange (PgRanges v1.1.1)

Wraps a Postgrex.Range and casts to a PostgreSQL numrange type.

Summary

Functions

Callback implementation for Ecto.Type.embed_as/1.

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

Creates a new Elixir.PgRanges.NumRange struct. It expects the lower and upper attributes to be acceptable by Decimal.new/1.

Types

@type t() :: %PgRanges.NumRange{
  lower: float(),
  lower_inclusive: boolean(),
  upper: float(),
  upper_inclusive: boolean()
}

Functions

Callback implementation for Ecto.Type.embed_as/1.

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

Link to this function

new(lower, upper, opts \\ [])

View Source
@spec new(any(), any(), keyword()) :: t()
@spec new(any(), any(), keyword()) :: t()

Creates a new Elixir.PgRanges.NumRange struct. It expects the lower and upper attributes to be acceptable by Decimal.new/1.

This will convert any acceptable input to Decimal.

Options

  • lower_inclusive: should the range be lower inclusive? Default is true
  • upper_inclusive: should the range be upper inclusive? Default is false